don't keep re-prompting the user to migrate if they get spontaneously logged out. (#5844)

This commit is contained in:
Matthew Hodgson
2026-07-07 14:28:40 +01:00
committed by GitHub
parent 9234060fb6
commit 834938f585
6 changed files with 21 additions and 4 deletions
+2 -2
View File
@@ -9878,7 +9878,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 18.5;
KEYCHAIN_ACCESS_GROUP_IDENTIFIER = "$(DEVELOPMENT_TEAM).$(BASE_BUNDLE_IDENTIFIER)";
MACOSX_DEPLOYMENT_TARGET = 14.5;
MARKETING_VERSION = 26.07.2;
MARKETING_VERSION = 26.07.3;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCTION_APP_NAME = Element;
@@ -9958,7 +9958,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 18.5;
KEYCHAIN_ACCESS_GROUP_IDENTIFIER = "$(DEVELOPMENT_TEAM).$(BASE_BUNDLE_IDENTIFIER)";
MACOSX_DEPLOYMENT_TARGET = 14.5;
MARKETING_VERSION = 26.07.2;
MARKETING_VERSION = 26.07.3;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
@@ -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.")
+1 -1
View File
@@ -53,7 +53,7 @@ settings:
ENABLE_BITCODE: false
APP_NAME: ElementX
KEYCHAIN_ACCESS_GROUP_IDENTIFIER: "$(DEVELOPMENT_TEAM).$(BASE_BUNDLE_IDENTIFIER)"
MARKETING_VERSION: 26.07.2
MARKETING_VERSION: 26.07.3
CURRENT_PROJECT_VERSION: 1
SUPPORTS_MACCATALYST: false