Fix logout button
This commit is contained in:
@@ -26,9 +26,7 @@ class AuthStorageImpl @Inject constructor(
|
||||
.distinctUntilChanged()
|
||||
private val singleThreadDispatcher = Executors.newSingleThreadExecutor().asCoroutineDispatcher()
|
||||
|
||||
override suspend fun setAuthHeader(authHeader: String?) {
|
||||
putString(AUTH_HEADER_KEY, authHeader)
|
||||
}
|
||||
override suspend fun setAuthHeader(authHeader: String?) = putString(AUTH_HEADER_KEY, authHeader)
|
||||
|
||||
override suspend fun getAuthHeader(): String? = getString(AUTH_HEADER_KEY)
|
||||
|
||||
@@ -45,9 +43,7 @@ class AuthStorageImpl @Inject constructor(
|
||||
value: String?
|
||||
) = withContext(singleThreadDispatcher) {
|
||||
Timber.v("putString() called with: key = $key, value = $value")
|
||||
sharedPreferences.edit {
|
||||
value?.let { putString(key, value) } ?: remove(key)
|
||||
}
|
||||
sharedPreferences.edit(commit = true) { putString(key, value) }
|
||||
}
|
||||
|
||||
private suspend fun getString(key: String) = withContext(singleThreadDispatcher) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package gq.kirmanak.mealient.ui.activity
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.asLiveData
|
||||
import androidx.lifecycle.viewModelScope
|
||||
@@ -25,7 +26,8 @@ class MainActivityViewModel @Inject constructor(
|
||||
authRepo.isAuthorizedFlow,
|
||||
AuthenticationState::determineState
|
||||
)
|
||||
val authenticationStateLive = authenticationStateFlow.asLiveData()
|
||||
val authenticationStateLive: LiveData<AuthenticationState>
|
||||
get() = authenticationStateFlow.asLiveData()
|
||||
|
||||
fun logout() {
|
||||
Timber.v("logout() called")
|
||||
|
||||
Reference in New Issue
Block a user