mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 08:15:24 +00:00
Point the classic app identifiers at HealthChat rather than Element (#1)
ClassicAppManager migrates an existing user's session and encryption keys by reading the legacy app's app-group container and keychain. Those identifiers defaulted to Element's own, which this team cannot provision, so loadAccounts() threw invalidAppGroupIdentifier — caught and logged, never surfaced. Since both apps share a bundle id, the result would be every existing user silently logged out and losing local history when they update. The legacy identifiers belong to HealthChat and are provisionable under the same team, so repoint them rather than dropping them. Also stop sending accounts without key backup to a dead end. Upstream shows those users a sheet asking them to open Element Classic and set up backup first, but this update replaces that app and nothing registers its URL scheme, so the sheet's only button does nothing. Sign in directly instead: the user re-verifies the device and loses only history that by definition has no backup.
This commit is contained in:
@@ -238,8 +238,8 @@ final class AuthenticationStartScreenViewModelTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
func classicAppAccountRequiresBackup() async throws {
|
||||
// Given a view model with a Classic app account that requires backup before signing in.
|
||||
func classicAppAccountRequiresBackupFallsThroughToLogin() async throws {
|
||||
// Given a view model with a Classic app account that has no usable key backup.
|
||||
let classicAppAccount = makeClassicAppAccount()
|
||||
await setupViewModel(classicAppAccount: classicAppAccount, availableSecrets: .requiresBackup)
|
||||
guard case .welcomeBack(let account) = context.viewState.classicAppMode else {
|
||||
@@ -248,27 +248,15 @@ final class AuthenticationStartScreenViewModelTests {
|
||||
}
|
||||
#expect(account.state.availableSecrets == .requiresBackup)
|
||||
|
||||
// When continuing with the Classic account while backup is required.
|
||||
var deferred = deferFulfillment(context.observe(\.viewState.bindings.showClassicAppBackupInstructions)) { $0 }
|
||||
// When continuing with the Classic account.
|
||||
let deferred = deferFulfillment(viewModel.actions) { $0.isLoginDirectlyWithOAuth }
|
||||
context.send(viewAction: .continueWithClassic(classicAppAccount))
|
||||
|
||||
// Then the backup instructions should be shown.
|
||||
// Then the flow continues to a normal sign-in rather than the backup instructions sheet.
|
||||
// HealthChat replaces the Classic app in place, so those instructions could never be followed.
|
||||
try await deferred.fulfill()
|
||||
|
||||
// When the user completes the backup in the Classic app and the app returns to the foreground.
|
||||
classicAppManager?.availableSecretsForReturnValue = .complete
|
||||
deferred = deferFulfillment(context.observe(\.viewState.bindings.showClassicAppBackupInstructions)) { !$0 }
|
||||
notificationCenter.post(name: UIApplication.didBecomeActiveNotification, object: nil)
|
||||
|
||||
// Then the backup instructions sheet should be dismissed.
|
||||
try await deferred.fulfill()
|
||||
|
||||
// When the user continues with the Classic account again.
|
||||
let deferredAction = deferFulfillment(viewModel.actions) { $0.isLoginDirectlyWithOAuth }
|
||||
context.send(viewAction: .continueWithClassic(classicAppAccount))
|
||||
|
||||
// Then the flow should continue the login process.
|
||||
try await deferredAction.fulfill()
|
||||
#expect(context.viewState.bindings.showClassicAppBackupInstructions == false)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == "mxid:\(classicAppAccount.userID)")
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
Reference in New Issue
Block a user