mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
chore(android): tidy up AuthViewModel (#10372)
- removes unused authFlowLaunched var - store long authUrl in val
This commit is contained in:
@@ -20,8 +20,6 @@ internal class AuthViewModel
|
||||
private val actionMutableLiveData = MutableLiveData<ViewAction>()
|
||||
val actionLiveData: LiveData<ViewAction> = actionMutableLiveData
|
||||
|
||||
private var authFlowLaunched: Boolean = false
|
||||
|
||||
fun onActivityResume() =
|
||||
viewModelScope.launch {
|
||||
val state = generateRandomString(NONCE_LENGTH)
|
||||
@@ -29,11 +27,10 @@ internal class AuthViewModel
|
||||
repo.saveNonceSync(nonce)
|
||||
repo.saveStateSync(state)
|
||||
val config = repo.getConfigSync()
|
||||
val authUrl = "${config.authUrl}/${config.accountSlug}?state=$state&nonce=$nonce&as=client"
|
||||
|
||||
actionMutableLiveData.postValue(
|
||||
ViewAction.LaunchAuthFlow(
|
||||
"${config.authUrl}/${config.accountSlug}?state=$state&nonce=$nonce&as=client",
|
||||
),
|
||||
ViewAction.LaunchAuthFlow(authUrl),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user