Skip to content

Commit

Permalink
fix: app lock dialog blinking (WPB-5610) (#2470)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alexandre Ferris <[email protected]>
  • Loading branch information
3 people authored Nov 27, 2023
1 parent 36fd8d6 commit 471f583
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 @@ -96,6 +96,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 @@ -206,7 +207,10 @@ class WireActivity : AppCompatActivity() {
setUpNavigation(navigator.navController, onComplete)
isLoaded = true
handleScreenshotCensoring()
handleDialogs(navigator::navigate)
handleDialogs(
navigator::navigate,
viewModel.currentUserId.value
)
}
}
}
Expand Down Expand Up @@ -261,8 +265,10 @@ class WireActivity : AppCompatActivity() {

@Suppress("ComplexMethod")
@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 471f583

Please sign in to comment.