mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 08:15:24 +00:00
fix(healthchat): keep legacy accounts on the typed account provider
This commit is contained in:
@@ -15,7 +15,7 @@ import Foundation
|
||||
/// - Legacy `element.io` help/encryption/copyright URLs are passed through unchanged for now.
|
||||
struct HealthChatAppSettingsHook: AppSettingsHookProtocol {
|
||||
func configure(_ appSettings: AppSettings) -> AppSettings {
|
||||
appSettings.override(accountProviders: ["healthchat.ch"],
|
||||
appSettings.override(accountProviders: [.generic("healthchat.ch")],
|
||||
allowOtherAccountProviders: false,
|
||||
hideBrandChrome: false,
|
||||
pushGatewayBaseURL: "https://sygnal.healthchat.ch",
|
||||
|
||||
@@ -225,6 +225,23 @@ final class AuthenticationStartScreenViewModelTests {
|
||||
#expect(account == classicAppAccount)
|
||||
}
|
||||
|
||||
@Test
|
||||
func healthChatProviderAllowsLegacyAccount() async {
|
||||
// Given the account providers HealthChat ships with and an account from the legacy HealthChat app.
|
||||
let classicAppAccount = makeClassicAppAccount(serverName: "healthchat.ch",
|
||||
homeserverURL: "https://matrix.healthchat.ch")
|
||||
appSettings = HealthChatAppSettingsHook().configure(appSettings)
|
||||
await setupViewModel(classicAppAccount: classicAppAccount)
|
||||
|
||||
// Then the legacy account must still be offered for migration. A silent failure here logs every
|
||||
// updating user out of the migration path, so the real hook values are tested, not a stand-in.
|
||||
guard case .welcomeBack(let account) = context.viewState.classicAppMode else {
|
||||
Issue.record("Expected classicAppMode to be .welcomeBack")
|
||||
return
|
||||
}
|
||||
#expect(account == classicAppAccount)
|
||||
}
|
||||
|
||||
@Test
|
||||
func singleProviderWithDisallowedClassicAppAccount() async {
|
||||
// Given a view model for an app that only allows a single provider that does NOT match the Classic account's server.
|
||||
|
||||
Reference in New Issue
Block a user