Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Handle app dialogs with team applock (WPB -2388) #2390

Merged
merged 39 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
37434b6
fix: app crash when user fails to unlock app with fingerprint
ohassine Oct 19, 2023
96ac249
Merge remote-tracking branch 'origin/develop' into develop
ohassine Oct 19, 2023
8f3e6eb
feat(appLock): adjust appLock to be handled correctly with other feat…
ohassine Oct 23, 2023
f70de8d
Merge remote-tracking branch 'origin/develop' into notifications_when…
ohassine Oct 23, 2023
198aa81
chore: detekt
ohassine Oct 23, 2023
8fd6940
chore: kalium reference
ohassine Oct 23, 2023
983f37a
Merge remote-tracking branch 'origin/develop' into notifications_when…
ohassine Oct 23, 2023
22e0127
Merge branch 'develop' into notifications_when_App_lock_is_on
ohassine Oct 24, 2023
a1958dd
feat: observe team app lock config
ohassine Oct 27, 2023
ad673ca
Merge remote-tracking branch 'origin/develop' into team_applock
ohassine Oct 27, 2023
8c1e0a3
chore: kalium reference
ohassine Oct 27, 2023
9c1e823
chore: pass timeout to app lock disabled status
ohassine Oct 27, 2023
640de6d
chore: detekt :)
ohassine Oct 27, 2023
9012111
feat: show team app lock change dialog
ohassine Oct 31, 2023
581306a
Merge remote-tracking branch 'origin/develop' into notifications_when…
ohassine Oct 31, 2023
8173e85
chore: kalium reference
ohassine Oct 31, 2023
5c25ae3
Merge branch 'notifications_when_App_lock_is_on' into show_team_applo…
ohassine Oct 31, 2023
acd4d3d
feat: show set app lock screen
ohassine Nov 1, 2023
d00cf29
Merge remote-tracking branch 'origin/develop' into show_team_applock_…
ohassine Nov 2, 2023
1a77eda
chore: detekt
ohassine Nov 2, 2023
feef673
chore: unit test
ohassine Nov 2, 2023
4471c33
Merge remote-tracking branch 'origin/develop' into show_team_applock_…
ohassine Nov 2, 2023
df749e7
fix: check session before using usecase
ohassine Nov 2, 2023
6aab2f4
chore: make context private
ohassine Nov 2, 2023
82fba4c
chore: cleanup
ohassine Nov 2, 2023
f706db1
chore: detekt
ohassine Nov 2, 2023
72ab412
feat: handle app lock with team applock
ohassine Nov 2, 2023
d4ace4e
feat: cleanup
ohassine Nov 2, 2023
ebc5f0f
feat: detekt
ohassine Nov 2, 2023
9ac94ea
Merge remote-tracking branch 'origin/develop' into show_team_applock_…
ohassine Nov 2, 2023
023b5ba
feat: kalium reference
ohassine Nov 2, 2023
362f3b2
Merge branch 'show_team_applock_change_dialog' into handle_dialong_wi…
ohassine Nov 2, 2023
ec57ca3
feat: detekt
ohassine Nov 2, 2023
158569e
Merge remote-tracking branch 'origin/develop' into handle_dialong_wit…
ohassine Nov 8, 2023
5c8d34c
Merge branch 'develop' into handle_dialong_with_team_applock
ohassine Nov 8, 2023
9b76be0
chore: detekt
ohassine Nov 8, 2023
701add1
chore: duplicate strings
ohassine Nov 8, 2023
06400fd
chore: resolve conflicts
ohassine Nov 8, 2023
54002ef
Merge branch 'develop' into handle_dialong_with_team_applock
ohassine Nov 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class GlobalDataStore @Inject constructor(@ApplicationContext private val contex
private val IS_LOGGING_ENABLED = booleanPreferencesKey("is_logging_enabled")
private val IS_ENCRYPTED_PROTEUS_STORAGE_ENABLED =
booleanPreferencesKey("is_encrypted_proteus_storage_enabled")
private val IS_APP_LOCKED_BY_USER = booleanPreferencesKey("is_app_locked_by_user")
private val APP_LOCK_PASSCODE = stringPreferencesKey("app_lock_passcode")
private val TEAM_APP_LOCK_PASSCODE = stringPreferencesKey("team_app_lock_passcode")
val APP_THEME_OPTION = stringPreferencesKey("app_theme_option")
Expand Down
29 changes: 14 additions & 15 deletions app/src/main/kotlin/com/wire/android/ui/AppLockActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,22 @@
WireTheme {
val navigator = rememberNavigator(this@AppLockActivity::finish)

val startDestination =
if (intent.getBooleanExtra(SET_TEAM_APP_LOCK, false)) {
appLogger.i("appLock: requesting set team app lock")
SetLockCodeScreenDestination
} else {
val canAuthenticateWithBiometrics = BiometricManager
.from(this)
.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG)
if (canAuthenticateWithBiometrics == BiometricManager.BIOMETRIC_SUCCESS) {
appLogger.i("appLock: requesting app Unlock with biometrics")
AppUnlockWithBiometricsScreenDestination
val startDestination =

Check warning on line 52 in app/src/main/kotlin/com/wire/android/ui/AppLockActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/AppLockActivity.kt#L52

Added line #L52 was not covered by tests
if (intent.getBooleanExtra(SET_TEAM_APP_LOCK, false)) {
appLogger.i("appLock: requesting set team app lock")
SetLockCodeScreenDestination

Check warning on line 55 in app/src/main/kotlin/com/wire/android/ui/AppLockActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/AppLockActivity.kt#L54-L55

Added lines #L54 - L55 were not covered by tests
} else {
appLogger.i("appLock: requesting app Unlock with passcode")
EnterLockCodeScreenDestination
val canAuthenticateWithBiometrics = BiometricManager
.from(this)
.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG)

Check warning on line 59 in app/src/main/kotlin/com/wire/android/ui/AppLockActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/AppLockActivity.kt#L57-L59

Added lines #L57 - L59 were not covered by tests
if (canAuthenticateWithBiometrics == BiometricManager.BIOMETRIC_SUCCESS) {
appLogger.i("appLock: requesting app Unlock with biometrics")
AppUnlockWithBiometricsScreenDestination

Check warning on line 62 in app/src/main/kotlin/com/wire/android/ui/AppLockActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/AppLockActivity.kt#L61-L62

Added lines #L61 - L62 were not covered by tests
} else {
appLogger.i("appLock: requesting app Unlock with passcode")
EnterLockCodeScreenDestination

Check warning on line 65 in app/src/main/kotlin/com/wire/android/ui/AppLockActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/AppLockActivity.kt#L64-L65

Added lines #L64 - L65 were not covered by tests
}
}
}

NavigationGraph(
navigator = navigator,
Expand All @@ -74,7 +74,6 @@
}
}
}

companion object {
const val SET_TEAM_APP_LOCK = "set_team_app_lock"
}
Expand Down
139 changes: 74 additions & 65 deletions app/src/main/kotlin/com/wire/android/ui/WireActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -249,20 +249,6 @@
private fun handleDialogs(navigate: (NavigationCommand) -> Unit) {
featureFlagNotificationViewModel.loadInitialSync()
with(featureFlagNotificationViewModel.featureFlagState) {
if (showFileSharingDialog) {
FileRestrictionDialog(
isFileSharingEnabled = isFileSharingEnabledState,
hideDialogStatus = featureFlagNotificationViewModel::dismissFileSharingDialog
)
}

if (shouldShowGuestRoomLinkDialog) {
GuestRoomLinkFeatureFlagDialog(
isGuestRoomLinkEnabled = isGuestRoomLinkEnabled,
onDismiss = featureFlagNotificationViewModel::dismissGuestRoomLinkDialog
)
}

if (shouldShowTeamAppLockDialog) {
TeamAppLockFeatureFlagDialog(
isTeamAppLockEnabled = isTeamAppLockEnabled,
Expand Down Expand Up @@ -290,28 +276,83 @@
}
}
)
}
} else {

Check warning on line 279 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L279

Added line #L279 was not covered by tests
if (showFileSharingDialog) {
FileRestrictionDialog(
isFileSharingEnabled = isFileSharingEnabledState,
hideDialogStatus = featureFlagNotificationViewModel::dismissFileSharingDialog

Check warning on line 283 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L281-L283

Added lines #L281 - L283 were not covered by tests
)
}

if (shouldShowSelfDeletingMessagesDialog) {
SelfDeletingMessagesDialog(
areSelfDeletingMessagesEnabled = areSelfDeletedMessagesEnabled,
enforcedTimeout = enforcedTimeoutDuration,
hideDialogStatus = featureFlagNotificationViewModel::dismissSelfDeletingMessagesDialog
)
}
if (shouldShowGuestRoomLinkDialog) {
GuestRoomLinkFeatureFlagDialog(
isGuestRoomLinkEnabled = isGuestRoomLinkEnabled,
onDismiss = featureFlagNotificationViewModel::dismissGuestRoomLinkDialog

Check warning on line 290 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L288-L290

Added lines #L288 - L290 were not covered by tests
)
}

e2EIRequired?.let {
E2EIRequiredDialog(
result = e2EIRequired,
getCertificate = featureFlagNotificationViewModel::getE2EICertificate,
snoozeDialog = featureFlagNotificationViewModel::snoozeE2EIdRequiredDialog
)
}
if (shouldShowSelfDeletingMessagesDialog) {
SelfDeletingMessagesDialog(
areSelfDeletingMessagesEnabled = areSelfDeletedMessagesEnabled,
enforcedTimeout = enforcedTimeoutDuration,
hideDialogStatus = featureFlagNotificationViewModel::dismissSelfDeletingMessagesDialog

Check warning on line 298 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L295-L298

Added lines #L295 - L298 were not covered by tests
)
}

e2EIRequired?.let {
E2EIRequiredDialog(
result = e2EIRequired,
getCertificate = featureFlagNotificationViewModel::getE2EICertificate,
snoozeDialog = featureFlagNotificationViewModel::snoozeE2EIdRequiredDialog

Check warning on line 306 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L303-L306

Added lines #L303 - L306 were not covered by tests
)
}

Check warning on line 308 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L308

Added line #L308 was not covered by tests

e2EISnoozeInfo?.let {
E2EISnoozeDialog(
timeLeft = e2EISnoozeInfo.timeLeft,
dismissDialog = featureFlagNotificationViewModel::dismissSnoozeE2EIdRequiredDialog

Check warning on line 313 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L311-L313

Added lines #L311 - L313 were not covered by tests
)
}

Check warning on line 315 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L315

Added line #L315 was not covered by tests

e2EISnoozeInfo?.let {
E2EISnoozeDialog(
timeLeft = e2EISnoozeInfo.timeLeft,
dismissDialog = featureFlagNotificationViewModel::dismissSnoozeE2EIdRequiredDialog
UpdateAppDialog(viewModel.globalAppState.updateAppDialog, ::updateTheApp)
JoinConversationDialog(
viewModel.globalAppState.conversationJoinedDialog,
navigate,
viewModel::onJoinConversationFlowCompleted

Check warning on line 321 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L317-L321

Added lines #L317 - L321 were not covered by tests
)
CustomBackendDialog(
viewModel.globalAppState,
viewModel::dismissCustomBackendDialog

Check warning on line 325 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L323-L325

Added lines #L323 - L325 were not covered by tests
) {
viewModel.customBackendDialogProceedButtonClicked {
navigate(
NavigationCommand(
WelcomeScreenDestination

Check warning on line 330 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L327-L330

Added lines #L327 - L330 were not covered by tests
)
)
}
}
MaxAccountDialog(
shouldShow = viewModel.globalAppState.maxAccountDialog,

Check warning on line 336 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L333-L336

Added lines #L333 - L336 were not covered by tests
onConfirm = {
viewModel.dismissMaxAccountDialog()
navigate(NavigationCommand(SelfUserProfileScreenDestination))
},
onDismiss = viewModel::dismissMaxAccountDialog

Check warning on line 341 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L338-L341

Added lines #L338 - L341 were not covered by tests
)
AccountLoggedOutDialog(
viewModel.globalAppState.blockUserUI
) { viewModel.tryToSwitchAccount(NavigationSwitchAccountActions(navigate)) }
NewClientDialog(
viewModel.globalAppState.newClientDialog,
{ navigate(NavigationCommand(SelfDevicesScreenDestination)) },

Check warning on line 348 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L343-L348

Added lines #L343 - L348 were not covered by tests
{
viewModel.switchAccount(
userId = it,
actions = NavigationSwitchAccountActions(navigate),
onComplete = { navigate(NavigationCommand(SelfDevicesScreenDestination)) })
},
viewModel::dismissNewClientsDialog

Check warning on line 355 in app/src/main/kotlin/com/wire/android/ui/WireActivity.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivity.kt#L350-L355

Added lines #L350 - L355 were not covered by tests
)
}
if (showCallEndedBecauseOfConversationDegraded) {
Expand All @@ -320,38 +361,6 @@
)
}
}
UpdateAppDialog(viewModel.globalAppState.updateAppDialog, ::updateTheApp)
JoinConversationDialog(
viewModel.globalAppState.conversationJoinedDialog,
navigate,
viewModel::onJoinConversationFlowCompleted
)
CustomBackendDialog(
viewModel.globalAppState,
viewModel::dismissCustomBackendDialog
) { viewModel.customBackendDialogProceedButtonClicked { navigate(NavigationCommand(WelcomeScreenDestination)) } }
MaxAccountDialog(
shouldShow = viewModel.globalAppState.maxAccountDialog,
onConfirm = {
viewModel.dismissMaxAccountDialog()
navigate(NavigationCommand(SelfUserProfileScreenDestination))
},
onDismiss = viewModel::dismissMaxAccountDialog
)
AccountLoggedOutDialog(
viewModel.globalAppState.blockUserUI
) { viewModel.tryToSwitchAccount(NavigationSwitchAccountActions(navigate)) }
NewClientDialog(
viewModel.globalAppState.newClientDialog,
{ navigate(NavigationCommand(SelfDevicesScreenDestination)) },
{
viewModel.switchAccount(
userId = it,
actions = NavigationSwitchAccountActions(navigate),
onComplete = { navigate(NavigationCommand(SelfDevicesScreenDestination)) })
},
viewModel::dismissNewClientsDialog
)
}

private fun updateTheApp() {
Expand Down