mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
don't keep re-prompting the user to migrate if they get spontaneously logged out. (#5844)
This commit is contained in:
@@ -504,6 +504,11 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
appSettings.hasSeenNewSoundBanner = false
|
||||
}
|
||||
|
||||
if oldVersion < Version(26, 07, 3) {
|
||||
MXLog.info("Migrating to version 26.07.3, marking the app as previously signed in.")
|
||||
appSettings.hasSignedInBefore = true
|
||||
}
|
||||
|
||||
userSessionMigrationsOldVersion = nil
|
||||
}
|
||||
|
||||
|
||||
@@ -293,6 +293,12 @@ final nonisolated class AppSettings: @unchecked Sendable {
|
||||
@UserPreference(defaultValue: AnalyticsConsentState.unknown)
|
||||
var analyticsConsentState: AnalyticsConsentState
|
||||
|
||||
/// Whether a user session has ever been set up on this device. Deliberately not cleared on
|
||||
/// logout: it stops the Classic app migration prompt from reappearing when an Element X
|
||||
/// user is signed out unexpectedly (invalidated token, corrupted storage, etc).
|
||||
@UserPreference(defaultValue: false)
|
||||
var hasSignedInBefore: Bool
|
||||
|
||||
@UserPreference(defaultValue: false)
|
||||
var hasRunNotificationPermissionsOnboarding: Bool
|
||||
|
||||
|
||||
@@ -225,6 +225,7 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol {
|
||||
presentNotificationPermissionsScreen()
|
||||
case (_, _, .finished):
|
||||
isNewLogin = false
|
||||
appSettings.hasSignedInBefore = true
|
||||
actionsSubject.send(.dismiss)
|
||||
stateMachine.tryState(.initial)
|
||||
case (.finished, _, .initial):
|
||||
|
||||
@@ -46,7 +46,12 @@ class AuthenticationService: AuthenticationServiceProtocol {
|
||||
self.appHooks = appHooks
|
||||
|
||||
do {
|
||||
if let classicAppManager {
|
||||
if appSettings.hasSignedInBefore {
|
||||
// Element X has already been used on this device, so an account left behind by the
|
||||
// Classic app is stale — don't offer to migrate it again after a logout.
|
||||
MXLog.info("Already signed in to Element X before, skipping loadAccounts.")
|
||||
classicAppAccount = nil
|
||||
} else if let classicAppManager {
|
||||
classicAppAccount = try classicAppManager.loadAccounts().first
|
||||
} else {
|
||||
MXLog.info("Classic App not configured, skipping loadAccounts.")
|
||||
|
||||
Reference in New Issue
Block a user