Skip to content

Commit

Permalink
fix: app lock dialog blinking (WPB-5610) (#2464)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandreferris committed Nov 24, 2023
1 parent 7ef3db4 commit 18552c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/src/main/kotlin/com/wire/android/ui/WireActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ import com.wire.android.util.debug.FeatureVisibilityFlags
import com.wire.android.util.debug.LocalFeatureVisibilityFlags
import com.wire.android.util.deeplink.DeepLinkResult
import com.wire.android.util.ui.updateScreenSettings
import com.wire.kalium.logic.data.user.UserId
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.collectLatest
Expand Down Expand Up @@ -201,7 +202,10 @@ class WireActivity : AppCompatActivity() {
setUpNavigation(navigator.navController, onComplete)
isLoaded = true
handleScreenshotCensoring()
handleDialogs(navigator::navigate)
handleDialogs(
navigator::navigate,
viewModel.currentUserId.value
)
}
}
}
Expand Down Expand Up @@ -255,8 +259,10 @@ class WireActivity : AppCompatActivity() {
}

@Composable
private fun handleDialogs(navigate: (NavigationCommand) -> Unit) {
featureFlagNotificationViewModel.loadInitialSync()
private fun handleDialogs(navigate: (NavigationCommand) -> Unit, userId: UserId?) {
LaunchedEffect(userId) {
featureFlagNotificationViewModel.loadInitialSync()
}
with(featureFlagNotificationViewModel.featureFlagState) {
if (shouldShowTeamAppLockDialog) {
TeamAppLockFeatureFlagDialog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package com.wire.android.ui

import android.content.Intent
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
Expand Down Expand Up @@ -120,6 +121,7 @@ class WireActivityViewModel @Inject constructor(
if (it.accountInfo.isValid().not()) {
handleInvalidSession((it.accountInfo as AccountInfo.Invalid).logoutReason)
}
currentUserId.value = it.accountInfo.userId
}
}
.map { result ->
Expand All @@ -137,6 +139,8 @@ class WireActivityViewModel @Inject constructor(
private val _observeSyncFlowState: MutableStateFlow<SyncState?> = MutableStateFlow(null)
val observeSyncFlowState: StateFlow<SyncState?> = _observeSyncFlowState

val currentUserId: MutableState<UserId?> = mutableStateOf(null)

init {
observeSyncState()
observeUpdateAppState()
Expand Down

0 comments on commit 18552c4

Please sign in to comment.