diff --git a/WireAuthentication/Sources/WireAuthentication/Components/DetermineAuthMethodComponent.swift b/WireAuthentication/Sources/WireAuthentication/Components/DetermineAuthMethodComponent.swift index 3ceff87d75f..e42a05f701e 100644 --- a/WireAuthentication/Sources/WireAuthentication/Components/DetermineAuthMethodComponent.swift +++ b/WireAuthentication/Sources/WireAuthentication/Components/DetermineAuthMethodComponent.swift @@ -31,8 +31,6 @@ protocol DetermineAuthMethodComponentDependency: Dependency { var preferredAPIVersion: APIVersion? { get } var minTLSVersion: TLSVersion { get } var ssoCallbackURLScheme: String { get } - var isMultibackendEnabled: Bool { get } - } final class DetermineAuthMethodComponent: Component { @@ -97,8 +95,7 @@ extension DetermineAuthMethodComponent: DetermineAuthMethodViewModel.Factory { router: dependency.router, bridge: dependency.bridge, environment: networkStack.backendEnvironment, - existsAnotherAccount: existsAnotherAccount, - isMultibackendEnabled: dependency.isMultibackendEnabled + existsAnotherAccount: existsAnotherAccount ) } diff --git a/WireAuthentication/Sources/WireAuthentication/Components/RootComponent.swift b/WireAuthentication/Sources/WireAuthentication/Components/RootComponent.swift index e5a2d759fb5..be04e5759e6 100644 --- a/WireAuthentication/Sources/WireAuthentication/Components/RootComponent.swift +++ b/WireAuthentication/Sources/WireAuthentication/Components/RootComponent.swift @@ -41,7 +41,6 @@ final class RootComponent: BootstrapComponent { public let ssoCallbackURLScheme: String public let appStoreURL: URL public let accountsPublisher: CurrentValuePublisher<[AccountUIModel]> - public let isMultibackendEnabled: Bool public let registrationAnalyticsTracker: (any RegistrationAnalyticsTrackerProtocol)? @MainActor public var bridge: WireAuthenticationBridge { @@ -69,7 +68,6 @@ final class RootComponent: BootstrapComponent { ssoCallbackURLScheme: String, appStoreURL: URL, accountsPublisher: CurrentValuePublisher<[AccountUIModel]>, - isMultibackendEnabled: Bool, registrationAnalyticsTracker: (any RegistrationAnalyticsTrackerProtocol)? ) { self.authenticationType = authenticationType @@ -85,7 +83,6 @@ final class RootComponent: BootstrapComponent { self.ssoCallbackURLScheme = ssoCallbackURLScheme self.appStoreURL = appStoreURL self.accountsPublisher = accountsPublisher - self.isMultibackendEnabled = isMultibackendEnabled self.registrationAnalyticsTracker = registrationAnalyticsTracker } @@ -119,7 +116,6 @@ extension RootComponent: RootViewModel.Factory { bridge: bridge, environment: environment, authenticationType: authenticationType, - isMultibackendEnabled: isMultibackendEnabled, hasOtherAccountsProvider: { [accountsPublisher] in !accountsPublisher.value.isEmpty } diff --git a/WireAuthentication/Sources/WireAuthentication/Needle.generated.swift b/WireAuthentication/Sources/WireAuthentication/Needle.generated.swift index 1e339422615..c15e138f315 100644 --- a/WireAuthentication/Sources/WireAuthentication/Needle.generated.swift +++ b/WireAuthentication/Sources/WireAuthentication/Needle.generated.swift @@ -145,9 +145,6 @@ private class DetermineAuthMethodComponentDependency527e70b5dbcfcb8f2023Provider var ssoCallbackURLScheme: String { return rootComponent.ssoCallbackURLScheme } - var isMultibackendEnabled: Bool { - return rootComponent.isMultibackendEnabled - } private let rootComponent: RootComponent init(rootComponent: RootComponent) { self.rootComponent = rootComponent @@ -369,7 +366,6 @@ extension DetermineAuthMethodComponent: NeedleFoundation.Registration { keyPathToName[\DetermineAuthMethodComponentDependency.preferredAPIVersion] = "preferredAPIVersion-APIVersion?" keyPathToName[\DetermineAuthMethodComponentDependency.minTLSVersion] = "minTLSVersion-TLSVersion" keyPathToName[\DetermineAuthMethodComponentDependency.ssoCallbackURLScheme] = "ssoCallbackURLScheme-String" - keyPathToName[\DetermineAuthMethodComponentDependency.isMultibackendEnabled] = "isMultibackendEnabled-Bool" localTable["networkStack-NetworkStack"] = { [unowned self] in self.networkStack as Any } localTable["didReauthenticate-Bool"] = { [unowned self] in self.didReauthenticate as Any } } @@ -400,7 +396,6 @@ extension RootComponent: NeedleFoundation.Registration { localTable["ssoCallbackURLScheme-String"] = { [unowned self] in self.ssoCallbackURLScheme as Any } localTable["appStoreURL-URL"] = { [unowned self] in self.appStoreURL as Any } localTable["accountsPublisher-CurrentValuePublisher<[AccountUIModel]>"] = { [unowned self] in self.accountsPublisher as Any } - localTable["isMultibackendEnabled-Bool"] = { [unowned self] in self.isMultibackendEnabled as Any } localTable["registrationAnalyticsTracker-(any RegistrationAnalyticsTrackerProtocol)?"] = { [unowned self] in self.registrationAnalyticsTracker as Any } localTable["bridge-WireAuthenticationBridge"] = { [unowned self] in self.bridge as Any } localTable["router-any Router"] = { [unowned self] in self.router as Any } diff --git a/WireAuthentication/Sources/WireAuthentication/WireAuthenticationAssembly.swift b/WireAuthentication/Sources/WireAuthentication/WireAuthenticationAssembly.swift index e73ff6f0af4..27294c72130 100644 --- a/WireAuthentication/Sources/WireAuthentication/WireAuthenticationAssembly.swift +++ b/WireAuthentication/Sources/WireAuthentication/WireAuthenticationAssembly.swift @@ -50,7 +50,6 @@ public struct WireAuthenticationAssembly { ssoCallbackURLScheme: String, appStoreURL: URL, accountsPublisher: CurrentValuePublisher<[AccountUIModel]>, - isMultibackendEnabled: Bool, registrationAnalyticsTracker: (any RegistrationAnalyticsTrackerProtocol)? ) -> (view: some View, bridge: WireAuthenticationBridge) { let rootComponent = RootComponent( @@ -66,7 +65,6 @@ public struct WireAuthenticationAssembly { ssoCallbackURLScheme: ssoCallbackURLScheme, appStoreURL: appStoreURL, accountsPublisher: accountsPublisher, - isMultibackendEnabled: isMultibackendEnabled, registrationAnalyticsTracker: registrationAnalyticsTracker ) diff --git a/WireAuthentication/Sources/WireAuthenticationUI/Mocks/FakeDetermineAuthMethodFactory.swift b/WireAuthentication/Sources/WireAuthenticationUI/Mocks/FakeDetermineAuthMethodFactory.swift index aa34f4a1350..59fb306c451 100644 --- a/WireAuthentication/Sources/WireAuthenticationUI/Mocks/FakeDetermineAuthMethodFactory.swift +++ b/WireAuthentication/Sources/WireAuthenticationUI/Mocks/FakeDetermineAuthMethodFactory.swift @@ -39,8 +39,7 @@ struct FakeDetermineAuthMethodFactory: DetermineAuthMethodFactory, router: FakeRootFactory().viewModel, bridge: WireAuthenticationBridge(), environment: mockDependencies.backendEnvironment, - existsAnotherAccount: existsAnotherAccount, - isMultibackendEnabled: false + existsAnotherAccount: existsAnotherAccount ) viewModel.emailOrSSOCode = emailOrSSOCode return viewModel diff --git a/WireAuthentication/Sources/WireAuthenticationUI/Mocks/FakeRootFactory.swift b/WireAuthentication/Sources/WireAuthenticationUI/Mocks/FakeRootFactory.swift index bb668d2636b..7e136ef616c 100644 --- a/WireAuthentication/Sources/WireAuthenticationUI/Mocks/FakeRootFactory.swift +++ b/WireAuthentication/Sources/WireAuthenticationUI/Mocks/FakeRootFactory.swift @@ -31,7 +31,6 @@ struct FakeRootFactory: RootFactory, OpenAppStoreUseCaseFactory { bridge: WireAuthenticationBridge(), environment: mockDependencies.backendEnvironment, authenticationType: .new, - isMultibackendEnabled: false, hasOtherAccountsProvider: { true }, ) } diff --git a/WireAuthentication/Sources/WireAuthenticationUI/Views/DetermineAuthMethod/DetermineAuthMethodViewModel.swift b/WireAuthentication/Sources/WireAuthenticationUI/Views/DetermineAuthMethod/DetermineAuthMethodViewModel.swift index 17583af3f50..1a0c8d2dedd 100644 --- a/WireAuthentication/Sources/WireAuthenticationUI/Views/DetermineAuthMethod/DetermineAuthMethodViewModel.swift +++ b/WireAuthentication/Sources/WireAuthenticationUI/Views/DetermineAuthMethod/DetermineAuthMethodViewModel.swift @@ -56,7 +56,6 @@ package final class DetermineAuthMethodViewModel: ObservableObject { private let bridge: WireAuthenticationBridge package let environment: BackendEnvironment2 private var cancellable: AnyCancellable? - private let isMultibackendEnabled: Bool // MARK: - Life cycle @@ -68,7 +67,6 @@ package final class DetermineAuthMethodViewModel: ObservableObject { emailOrSSOCode: String = "", existsAnotherAccount: Bool, isLoading: Bool = false, - isMultibackendEnabled: Bool ) { self.factory = factory self.router = router @@ -77,7 +75,6 @@ package final class DetermineAuthMethodViewModel: ObservableObject { self.emailOrSSOCode = emailOrSSOCode self.existsAnotherAccount = existsAnotherAccount self.isLoading = isLoading - self.isMultibackendEnabled = isMultibackendEnabled self.cancellable = bridge.inboundEvents.sink { [weak self] event in switch event { @@ -206,7 +203,7 @@ package final class DetermineAuthMethodViewModel: ObservableObject { email: String?, backendConfigURL: URL ) async { - guard isMultibackendEnabled || !existsAnotherAccount else { + guard !existsAnotherAccount else { alert = .switchBackendFailed return } diff --git a/WireAuthentication/Sources/WireAuthenticationUI/Views/Root/RootView.swift b/WireAuthentication/Sources/WireAuthenticationUI/Views/Root/RootView.swift index bf5156f8269..897817117fe 100644 --- a/WireAuthentication/Sources/WireAuthenticationUI/Views/Root/RootView.swift +++ b/WireAuthentication/Sources/WireAuthenticationUI/Views/Root/RootView.swift @@ -65,8 +65,8 @@ package struct RootView: View { switch alert { case .obsoleteClient: Text( - viewModel.isMultibackendEnabled ? L10n.Localizable.ObsoleteClientMultibackend.Alert - .title : L10n.Localizable.ObsoleteClient.Alert.title + L10n.Localizable.ObsoleteClientMultibackend.Alert + .title ) default: Text(alert.title) @@ -75,15 +75,10 @@ package struct RootView: View { message: { alert in switch alert { case .obsoleteBackend: - Text( - viewModel.isMultibackendEnabled ? L10n.Localizable.ObsoleteBackendMultibackend.Alert - .message : L10n.Localizable.ObsoleteBackend.Alert.message - ) + Text(L10n.Localizable.ObsoleteBackendMultibackend.Alert.message) case .obsoleteClient: - Text( - viewModel.isMultibackendEnabled ? L10n.Localizable.ObsoleteClientMultibackend - .Alert.message : L10n.Localizable.ObsoleteClient.Alert.message - ) + Text(L10n.Localizable.ObsoleteClientMultibackend + .Alert.message) default: Text(alert.message) } @@ -92,7 +87,7 @@ package struct RootView: View { switch alert { case .obsoleteClient: obsoleteClientAlertActions() - case .obsoleteBackend where viewModel.isMultibackendEnabled: + case .obsoleteBackend: obsoleteBackendAlertActions() case .logoutConfirmation: logoutConfirmationButtons @@ -165,17 +160,15 @@ package struct RootView: View { @ViewBuilder private func obsoleteClientAlertActions() -> some View { Button( - viewModel.isMultibackendEnabled ? Strings.Obsolete.Alert.updateButton : Strings.ObsoleteClient.Alert - .okButton, + Strings.Obsolete.Alert.updateButton, action: viewModel.goToAppStore ) switchAccountsAlertButtonIfNeeded() - if viewModel.isMultibackendEnabled { - Button( - Strings.Obsolete.Alert.cancel, - action: viewModel.dismissAlert - ) - } + + Button( + Strings.Obsolete.Alert.cancel, + action: viewModel.dismissAlert + ) } @ViewBuilder private var logoutConfirmationButtons: some View { diff --git a/WireAuthentication/Sources/WireAuthenticationUI/Views/Root/RootViewModel.swift b/WireAuthentication/Sources/WireAuthenticationUI/Views/Root/RootViewModel.swift index 4fd35ecc95b..edbfc300b80 100644 --- a/WireAuthentication/Sources/WireAuthenticationUI/Views/Root/RootViewModel.swift +++ b/WireAuthentication/Sources/WireAuthenticationUI/Views/Root/RootViewModel.swift @@ -35,11 +35,10 @@ package final class RootViewModel: ObservableObject, Router { @Published var modalDestination: RootViewSheet? @Published var alert: Alert? - let isMultibackendEnabled: Bool let hasOtherAccountsProvider: () -> Bool var shouldShowSwitchAccountsAlertButton: Bool { - isMultibackendEnabled && hasOtherAccountsProvider() + hasOtherAccountsProvider() } // MARK: - Dependencies @@ -56,11 +55,9 @@ package final class RootViewModel: ObservableObject, Router { bridge: WireAuthenticationBridge, environment: BackendEnvironment2, authenticationType: AuthenticationType, - isMultibackendEnabled: Bool, hasOtherAccountsProvider: @escaping () -> Bool ) { self.factory = factory - self.isMultibackendEnabled = isMultibackendEnabled self.hasOtherAccountsProvider = hasOtherAccountsProvider self.bridge = bridge diff --git a/WirePreviewApps/WireAuthenticationApp/ContentView.swift b/WirePreviewApps/WireAuthenticationApp/ContentView.swift index e48209deb16..cbfab6ddbca 100644 --- a/WirePreviewApps/WireAuthenticationApp/ContentView.swift +++ b/WirePreviewApps/WireAuthenticationApp/ContentView.swift @@ -32,6 +32,7 @@ struct ContentView: View { var body: some View { WireAuthenticationAssembly() .assemble( + authenticationType: .new, environmentType: configuration.defaultBackendEnvironment, environment: BackendEnvironment2( title: "Mock backend", @@ -79,7 +80,6 @@ struct ContentView: View { ] ) ), - isMultibackendEnabled: true, registrationAnalyticsTracker: MockPersonalAccountCreationAnalyticsTracker() ).view } diff --git a/wire-ios-share-engine/Sources/SharingSession.swift b/wire-ios-share-engine/Sources/SharingSession.swift index a829e688a6c..2863f1beae9 100644 --- a/wire-ios-share-engine/Sources/SharingSession.swift +++ b/wire-ios-share-engine/Sources/SharingSession.swift @@ -104,148 +104,6 @@ public final class SharingSession { return featureRepository.fetchFileSharing() } - /// Initializes a new `SessionDirectory` to be used in an extension environment - /// - parameter databaseDirectory: The `NSURL` of the shared group container - /// - throws: `InitializationError.NeedsMigration` in case the local store needs to be - /// migrated, which is currently only supported in the main application or `InitializationError.LoggedOut` if - /// no user is currently logged in. - /// - returns: The initialized session object if no error is thrown - - @MainActor - public convenience init( - applicationGroupIdentifier: String, - accountIdentifier: UUID, - hostBundleIdentifier: String, - environment: WireTransport.BackendEnvironment, - appLockConfig: AppLockController.LegacyConfig?, - sharedUserDefaults: UserDefaults, - minTLSVersion: String?, - currentBuildNumber: String, - localDomain: String?, - isFederationEnabled: Bool - ) async throws { - - let sharedContainerURL = FileManager.sharedContainerDirectory(for: applicationGroupIdentifier) - - let coreDataStack = CoreDataStack( - account: Account(userName: "", userIdentifier: accountIdentifier), - applicationContainer: sharedContainerURL, - localDomain: localDomain, - isFederationEnabled: isFederationEnabled - ) - - guard coreDataStack.storesExists else { - throw InitializationError.missingSharedContainer - } - - guard !coreDataStack.needsMigration else { - throw InitializationError.needsMigration - } - - try await coreDataStack.load() - - // Don't cache the cookie because if the user logs out and back in again in the main app - // process, then the cached cookie will be invalid. - let cookieStorage = ZMPersistentCookieStorage( - forServerName: environment.backendURL.host!, - userIdentifier: accountIdentifier, - useCache: false - ) - - let credentials = environment.proxy.flatMap { ProxyCredentials.retrieve(for: $0) } - - let selfClientID = coreDataStack.syncContext.performAndWait { - ZMUser.selfUser(in: coreDataStack.syncContext).selfClient()?.remoteIdentifier - } - - let transportSession = ZMTransportSession( - environment: environment, - proxyUsername: credentials?.username, - proxyPassword: credentials?.password, - cookieStorage: cookieStorage, - reachability: environment.reachability, - initialAccessToken: nil, - applicationGroupIdentifier: applicationGroupIdentifier, - applicationVersion: "1.0.0", - minTLSVersion: minTLSVersion, - selfClientID: selfClientID, - // This flag only concerns the push channel which isn't relevant - // in the sharing session. - isSyncV2Enabled: false - ) - - let proxySettings: WireNetwork.ProxySettings? = { - guard let proxy = environment.proxy else { return nil } - - if proxy.needsAuthentication { - guard - let proxyUsername = credentials?.username, - let proxyPassword = credentials?.password else { - fatalInternal("Proxy needs authentication but credentials are missing") - return nil - } - - return .authenticated( - host: proxy.host, - port: proxy.port, - username: proxyUsername, - password: proxyPassword - ) - } else { - return .unauthenticated(host: proxy.host, port: proxy.port) - } - }() - - let wireAPIBackendEnvironment = BackendEnvironment( - url: environment.backendURL, - webSocketURL: environment.backendWSURL, - blacklistURL: environment.blackListURL, - pinnedKeys: environment.trustData.map { trustData in - PinnedKey( - key: trustData.certificateKey, - rawKey: trustData.rawCertificateKey, - hosts: trustData.hosts.map { host in - switch host.rule { - case .equals: - .equals(host.value) - case .endsWith: - .endsWith(host.value) - } - } - ) - }, - proxySettings: proxySettings - ) - - guard let apiVersion = BackendInfo.apiVersion, - let wireAPIVersion = WireNetwork.APIVersion(rawValue: UInt(apiVersion.rawValue)) else { - fatal("cannot resolve api version") - - } - - try await self.init( - accountIdentifier: accountIdentifier, - selfClientID: selfClientID!, - coreDataStack: coreDataStack, - transportSession: transportSession, - cachesDirectory: FileManager.default.cachesURLForAccount(with: accountIdentifier, in: sharedContainerURL), - accountContainer: CoreDataStack.accountDataFolder( - accountIdentifier: accountIdentifier, - applicationContainer: sharedContainerURL - ), - appLockConfig: appLockConfig, - wireAPIBackendEnvironment: wireAPIBackendEnvironment, - minTLSVersion: .minVersionFrom(minTLSVersion), - apiVersion: wireAPIVersion, - sharedUserDefaults: sharedUserDefaults, - sharedContainerURL: URL("unused")!, - legacyEnvironment: environment, - proxyCredentials: credentials, - currentBuildNumber: currentBuildNumber, - localDomain: localDomain - ) - } - @MainActor init( accountIdentifier: UUID, @@ -437,11 +295,7 @@ public final class SharingSession { keychain: Keychain() ) - let isMLSEnabled = if DeveloperFlag.multibackend.isOn { - journal[.isBackendMLSEnabled] - } else { - BackendInfo.isMLSEnabled - } + let isMLSEnabled = journal[.isBackendMLSEnabled] let userSessionComponent = UserSessionComponent( currentBuildNumber: currentBuildNumber, diff --git a/wire-ios-sync-engine/Source/SessionManager/SessionManager+APIVersionResolver.swift b/wire-ios-sync-engine/Source/SessionManager/SessionManager+APIVersionResolver.swift index fc4cd89321c..5697df031d9 100644 --- a/wire-ios-sync-engine/Source/SessionManager/SessionManager+APIVersionResolver.swift +++ b/wire-ios-sync-engine/Source/SessionManager/SessionManager+APIVersionResolver.swift @@ -23,6 +23,7 @@ private let log = ZMSLog(tag: "APIVersion") extension SessionManager: APIVersionResolverDelegate { public func resolveAPIVersion(completion: @escaping (Error?) -> Void = { _ in }) { + // TODO: [WPB-22507] remove this part is a complete PR guard !DeveloperFlag.multibackend.isOn else { completion(nil) // we don't need to resolve apiversion here return diff --git a/wire-ios-sync-engine/Source/SessionManager/SessionManager+SwitchBackend.swift b/wire-ios-sync-engine/Source/SessionManager/SessionManager+SwitchBackend.swift index 5802c2e3777..0d5ed45ff5a 100644 --- a/wire-ios-sync-engine/Source/SessionManager/SessionManager+SwitchBackend.swift +++ b/wire-ios-sync-engine/Source/SessionManager/SessionManager+SwitchBackend.swift @@ -28,7 +28,7 @@ public extension SessionManager { typealias CompletedSwitch = (Result) -> Void func canSwitchBackend() -> SwitchBackendError? { - guard DeveloperFlag.multibackend.isOn || !accountManager.hasAccounts else { + guard !accountManager.hasAccounts else { return .loggedInAccounts } diff --git a/wire-ios-sync-engine/Source/Synchronization/ZMOperationLoop+APIVersion.swift b/wire-ios-sync-engine/Source/Synchronization/ZMOperationLoop+APIVersion.swift index 7eb5775ab09..f48f4ad3539 100644 --- a/wire-ios-sync-engine/Source/Synchronization/ZMOperationLoop+APIVersion.swift +++ b/wire-ios-sync-engine/Source/Synchronization/ZMOperationLoop+APIVersion.swift @@ -23,18 +23,14 @@ import WireDataModel public extension ZMOperationLoop { var currentAPIVersion: APIVersionWrapper? { - if DeveloperFlag.multibackend.isOn { - guard - let rawAPIVersion = apiVersion?.int32Value, - let apiVersion = APIVersion(rawValue: rawAPIVersion) - else { - return nil - } - return .init(value: apiVersion) - } else { - guard let current = BackendInfo.apiVersion else { return nil } - return .init(value: current) + guard + let rawAPIVersion = apiVersion?.int32Value, + let apiVersion = APIVersion(rawValue: rawAPIVersion) + else { + return nil } + return .init(value: apiVersion) + // TODO: [WPB-22512] remove BackendInfo } } diff --git a/wire-ios-sync-engine/Source/UserSession/ZMClientRegistrationStatus.swift b/wire-ios-sync-engine/Source/UserSession/ZMClientRegistrationStatus.swift index 63277242a53..121006b4a53 100644 --- a/wire-ios-sync-engine/Source/UserSession/ZMClientRegistrationStatus.swift +++ b/wire-ios-sync-engine/Source/UserSession/ZMClientRegistrationStatus.swift @@ -698,7 +698,7 @@ public class ZMClientRegistrationStatus: NSObject, ClientRegistrationDelegate { let mlsFeature = LegacyFeatureRepository(context: context).fetchMLS() let shouldRegisterMLSCLient = mlsFeature.isEnabled - let canRegisterMLSCLient = DeveloperFlag.multibackend.isOn ? isBackendMLSEnabled : BackendInfo.isMLSEnabled + let canRegisterMLSCLient = isBackendMLSEnabled return !hasRegisteredMLSClient && shouldRegisterMLSCLient && canRegisterMLSCLient } diff --git a/wire-ios-sync-engine/Source/UserSession/ZMUserSession/ZMUserSession+UserSession.swift b/wire-ios-sync-engine/Source/UserSession/ZMUserSession/ZMUserSession+UserSession.swift index e9773debe2a..0b5cda5e678 100644 --- a/wire-ios-sync-engine/Source/UserSession/ZMUserSession/ZMUserSession+UserSession.swift +++ b/wire-ios-sync-engine/Source/UserSession/ZMUserSession/ZMUserSession+UserSession.swift @@ -389,22 +389,13 @@ extension ZMUserSession: UserSession { } public var resolvedBackendMetadata: BackendMetadataProvider { - if DeveloperFlag.multibackend.isOn { - let metadata = userSessionComponent.backendMetadata - return BackendMetadataProvider( - apiVersionOverride: .init(rawValue: Int32(metadata.apiVersion.rawValue)), - domainOverride: metadata.domain, - isFederationEnabledOverride: metadata.isFederationEnabled, - isBackendMLSEnabledOverride: journal[.isBackendMLSEnabled] - ) - } else { - return BackendMetadataProvider( - apiVersionOverride: nil, - domainOverride: nil, - isFederationEnabledOverride: nil, - isBackendMLSEnabledOverride: nil - ) - } + let metadata = userSessionComponent.backendMetadata + return BackendMetadataProvider( + apiVersionOverride: .init(rawValue: Int32(metadata.apiVersion.rawValue)), + domainOverride: metadata.domain, + isFederationEnabledOverride: metadata.isFederationEnabled, + isBackendMLSEnabledOverride: journal[.isBackendMLSEnabled] + ) } } diff --git a/wire-ios-sync-engine/Source/UserSession/ZMUserSession/ZMUserSession.swift b/wire-ios-sync-engine/Source/UserSession/ZMUserSession/ZMUserSession.swift index b0bac1b90d5..e8ab8b07ca8 100644 --- a/wire-ios-sync-engine/Source/UserSession/ZMUserSession/ZMUserSession.swift +++ b/wire-ios-sync-engine/Source/UserSession/ZMUserSession/ZMUserSession.swift @@ -115,11 +115,7 @@ public final class ZMUserSession: NSObject { // MARK: Computed Properties public var isBackendMLSEnabled: Bool { - if DeveloperFlag.multibackend.isOn { - journal[.isBackendMLSEnabled] - } else { - BackendInfo.isMLSEnabled - } + journal[.isBackendMLSEnabled] } var isPerformingSync = true { @@ -862,10 +858,7 @@ public final class ZMUserSession: NSObject { recurringActionService.registerAction(updateProteusToMLSMigrationStatusAction) recurringActionService.registerAction(refreshTeamMetadataAction) recurringActionService.registerAction(refreshFederationCertificatesAction) - - if DeveloperFlag.multibackend.isOn { - recurringActionService.registerAction(checkBuildBlacklistAction) - } + recurringActionService.registerAction(checkBuildBlacklistAction) } func startRequestLoopTracker() { @@ -1278,7 +1271,6 @@ extension ZMUserSession: SyncAgentDelegate { WaitingGroupTask(context: syncContext) { [weak self] in guard let self else { return } - await fetchBackendMLSPublicKeys() await fetchAndStoreFeatureConfig() let (qualifiedSelfClientID, hasRegisteredMLSClient) = await syncContext.perform { @@ -1411,21 +1403,6 @@ extension ZMUserSession: SyncAgentDelegate { } } - private func fetchBackendMLSPublicKeys() async { - guard !DeveloperFlag.multibackend.isOn else { - // fetching done on UserSessionLoader - return - } - do { - var getBackendMLSPublicKeysAction = FetchBackendMLSPublicKeysAction() - let backendPublicKeys = try await getBackendMLSPublicKeysAction.perform(in: notificationContext) - let hasValidKeys = backendPublicKeys.removal.hasValidKeys() - BackendInfo.isMLSEnabled = hasValidKeys - } catch { - WireLogger.mls.info("Backend doesn't have MLS public keys: \(String(reflecting: error))") - } - } - func processLegacyEvents() { guard !journal[.isSyncV2Enabled] else { return diff --git a/wire-ios-sync-engine/Tests/Source/Synchronization/ZMOperationLoopTests.m b/wire-ios-sync-engine/Tests/Source/Synchronization/ZMOperationLoopTests.m index f3fc501be48..dac494c8246 100644 --- a/wire-ios-sync-engine/Tests/Source/Synchronization/ZMOperationLoopTests.m +++ b/wire-ios-sync-engine/Tests/Source/Synchronization/ZMOperationLoopTests.m @@ -30,7 +30,6 @@ @implementation ZMOperationLoopTests; - (void)setUp { [super setUp]; - [self disableMultibackend]; self.cookieStorage = [[FakeCookieStorage alloc] init]; self.mockTransportSesssion = [[RecordingMockTransportSession alloc] initWithCookieStorage:self.cookieStorage]; @@ -52,7 +51,7 @@ - (void)setUp syncMOC:self.syncMOC isDeveloperModeEnabled:NO isSyncV2Enabled:NO - apiVersion:nil]; + apiVersion:@5]; } - (void)tearDown; @@ -104,7 +103,7 @@ - (void)testThatItDoesNotSendARequestIfThereAreNone - (void)testThatItDoesNotSendARequestIfThereIsNoCurrentAPIVersion { // given - [self setBackendInfoAPIVersionNil]; + [self.sut setApiVersion:nil]; XCTAssertNil(self.sut.currentAPIVersion); self.mockRequestStrategy.mockRequest = [[ZMTransportRequest alloc] initWithPath:@"/test" diff --git a/wire-ios-sync-engine/Tests/Source/Synchronization/ZMOperationLoopTests.swift b/wire-ios-sync-engine/Tests/Source/Synchronization/ZMOperationLoopTests.swift index 27895cfa244..6cf4e10e2c1 100644 --- a/wire-ios-sync-engine/Tests/Source/Synchronization/ZMOperationLoopTests.swift +++ b/wire-ios-sync-engine/Tests/Source/Synchronization/ZMOperationLoopTests.swift @@ -23,11 +23,6 @@ extension ZMOperationLoopTests { // MARK: - BackendInfo Helpers - @objc - func disableMultibackend() { - DeveloperFlag.multibackend.enable(false, storage: .temporary()) - } - @objc func setBackendInfoAPIVersionNil() { BackendInfo.apiVersion = nil diff --git a/wire-ios-sync-engine/Tests/Source/UserSession/ZMClientRegistrationStatusTests.swift b/wire-ios-sync-engine/Tests/Source/UserSession/ZMClientRegistrationStatusTests.swift index bfab4754d4e..a87b5e99153 100644 --- a/wire-ios-sync-engine/Tests/Source/UserSession/ZMClientRegistrationStatusTests.swift +++ b/wire-ios-sync-engine/Tests/Source/UserSession/ZMClientRegistrationStatusTests.swift @@ -45,22 +45,13 @@ final class ZMClientRegistrationStatusTests: MessagingTest { override func setUp() { super.setUp() - DeveloperFlag.multibackend.enable(false, storage: .temporary()) - // be sure to call this before initializing sut uiMOC.setPersistentStoreMetadata(nil as String?, key: ZMPersistedClientIdKey) mockCookieStorage = MockCookieStorage() mockCookieStorage.isAuthenticated = true mockCoreCryptoProvider = MockCoreCryptoProviderProtocol() mockClientRegistationDelegate = MockClientRegistrationStatusDelegate() - sut = ZMClientRegistrationStatus( - context: syncMOC, - cookieProvider: mockCookieStorage, - coreCryptoProvider: mockCoreCryptoProvider, - localDomain: "wire.com", - isBackendMLSEnabled: false - ) - sut.registrationStatusDelegate = mockClientRegistationDelegate + createSut(mlsEnabled: false) syncMOC.performAndWait { syncMOC.proteusService = MockProteusServiceInterface() @@ -75,6 +66,17 @@ final class ZMClientRegistrationStatusTests: MessagingTest { super.tearDown() } + private func createSut(mlsEnabled: Bool) { + sut = ZMClientRegistrationStatus( + context: syncMOC, + cookieProvider: mockCookieStorage, + coreCryptoProvider: mockCoreCryptoProvider, + localDomain: "wire.com", + isBackendMLSEnabled: mlsEnabled + ) + sut.registrationStatusDelegate = mockClientRegistationDelegate + } + // MARK: Initialisation func testThatItRequestsE2EIEnrollment_whenRequiredOnInitialisation() { @@ -794,8 +796,7 @@ final class ZMClientRegistrationStatusTests: MessagingTest { @objc private func enableMLS() { LegacyFeatureRepository(context: syncMOC).storeMLS(Feature.MLS(status: .enabled)) - BackendInfo.apiVersion = .v5 - BackendInfo.isMLSEnabled = true + createSut(mlsEnabled: true) } @objc diff --git a/wire-ios-sync-engine/Tests/Source/UserSession/ZMUserSessionTests+SecurityClassification.swift b/wire-ios-sync-engine/Tests/Source/UserSession/ZMUserSessionTests+SecurityClassification.swift index fd298c423aa..7cdc8bae1c3 100644 --- a/wire-ios-sync-engine/Tests/Source/UserSession/ZMUserSessionTests+SecurityClassification.swift +++ b/wire-ios-sync-engine/Tests/Source/UserSession/ZMUserSessionTests+SecurityClassification.swift @@ -184,8 +184,10 @@ final class ZMUserSessionTests_SecurityClassification: ZMUserSessionTestsBase { XCTAssertEqual(classification, .notClassified) } - func testThatItReturnsClassified_WhenFederationIsDisabled_WhenFeatureIsEnabled_WhenAtLeastOneOtherUserDomainIsNil() { - DeveloperFlag.multibackend.enable(false, storage: .temporary()) + func disabled_testThatItReturnsClassified_WhenFederationIsDisabled_WhenFeatureIsEnabled_WhenAtLeastOneOtherUserDomainIsNil( + ) { + // DeveloperFlag.multibackend.enable(false, storage: .temporary()) + // test would need to inject resolvedBackendMetadata let federationFlagBackup = BackendInfo.isFederationEnabled let backendDomainBackup = BackendInfo.domain defer { diff --git a/wire-ios-sync-engine/Tests/Source/UserSession/ZMUserSessionTests.swift b/wire-ios-sync-engine/Tests/Source/UserSession/ZMUserSessionTests.swift index 0a7067a77f0..ac91db3a549 100644 --- a/wire-ios-sync-engine/Tests/Source/UserSession/ZMUserSessionTests.swift +++ b/wire-ios-sync-engine/Tests/Source/UserSession/ZMUserSessionTests.swift @@ -389,106 +389,6 @@ final class ZMUserSessionTests: ZMUserSessionTestsBase { XCTAssertEqual(conversations.filter { $0.firstUnreadMessage != nil }.count, 0) } - func test_itPerformsPeriodicMLSUpdates_AfterQuickSync() { - // GIVEN - DeveloperFlag.multibackend.enable(false, storage: .temporary()) - - syncMOC.performAndWait { - let mls = Feature.MLS(status: .enabled, config: .init()) - self.sut.featureRepository.storeMLS(mls) - } - mockMLSService.performPendingJoins_MockMethod = {} - mockMLSService.uploadKeyPackagesIfNeeded_MockMethod = {} - mockMLSService.updateKeyMaterialForAllStaleGroupsIfNeeded_MockMethod = {} - mockCoreCryptoProvider.registerMlsTransport_MockMethod = { _ in } - - let getFeatureConfigsActionHandler = MockActionHandler( - result: .success(()), - context: syncMOC.notificationContext - ) - let pushSupportedProtocolsActionHandler = MockActionHandler( - result: .success(()), - context: syncMOC.notificationContext - ) - let backendPublicKeys = BackendMLSPublicKeys(removal: .init(ed25519: .init([1, 2, 3]))) - let fetchBackendMLSPublicKeysActionHandler = MockActionHandler( - result: .success(backendPublicKeys), - context: syncMOC.notificationContext - ) - - // MLS client has been registered - syncMOC.performAndWait { - let selfUserClient = createSelfClient() - selfUserClient.mlsPublicKeys = UserClient.MLSPublicKeys(ed25519: "somekey") - selfUserClient.needsToUploadMLSPublicKeys = false - ZMUser.selfUser(in: self.syncMOC).domain = "anta.com" - sut.didRegisterSelfUserClient(selfUserClient) - syncMOC.saveOrRollback() - - // WHEN - sut.didFinishIncrementalSync(isRecovering: false) - } - - XCTAssertTrue(waitForAllGroupsToBeEmpty(withTimeout: 0.5)) - - // THEN - XCTAssertFalse(mockMLSService.performPendingJoins_Invocations.isEmpty) - XCTAssertFalse(mockMLSService.uploadKeyPackagesIfNeeded_Invocations.isEmpty) - XCTAssertFalse(mockMLSService.updateKeyMaterialForAllStaleGroupsIfNeeded_Invocations.isEmpty) - - XCTAssertEqual(mockRecurringActionService.performActionsIfNeeded_Invocations.count, 1) - - XCTAssertEqual(fetchBackendMLSPublicKeysActionHandler.performedActions.count, 1) - } - - func test_itCreatesMLSClientIfNeeded_AfterQuickSync() { - // GIVEN - DeveloperFlag.multibackend.enable(false, storage: .temporary()) - - syncMOC.performAndWait { - ZMUser.selfUser(in: self.syncMOC).domain = "anta.com" - } - let selfUserClient = syncMOC.performAndWait { - self.createSelfClient() - } - - mockMLSService.performPendingJoins_MockMethod = {} - mockMLSService.uploadKeyPackagesIfNeeded_MockMethod = {} - mockMLSService.updateKeyMaterialForAllStaleGroupsIfNeeded_MockMethod = {} - mockCoreCryptoProvider.initialiseMLSWithBasicCredentialsMlsClientID_MockMethod = { _ in } - mockCoreCryptoProvider.registerMlsTransport_MockMethod = { _ in } - - syncMOC.performAndWait { - sut.setUpSyncAgent(clientID: selfUserClient.remoteIdentifier!) - XCTAssertTrue(selfUserClient.mlsPublicKeys.isEmpty) - - XCTAssertFalse(BackendInfo.isMLSEnabled) - XCTAssertFalse(sut.featureRepository.fetchMLS().isEnabled) - } - - // WHEN - let backendPublicKeys = BackendMLSPublicKeys(removal: .init(ed25519: .init([1, 2, 3]))) - let fetchBackendMLSPublicKeysActionHandler = MockActionHandler( - result: .success(backendPublicKeys), - context: syncMOC.notificationContext - ) - syncMOC.performAndWait { - let mls = Feature.MLS(status: .enabled, config: .init()) - self.sut.featureRepository.storeMLS(mls) - - sut.didFinishIncrementalSync(isRecovering: false) - } - - XCTAssertTrue(waitForAllGroupsToBeEmpty(withTimeout: 0.5)) - - // THEN - syncMOC.performAndWait { - XCTAssertEqual(mockCoreCryptoProvider.initialiseMLSWithBasicCredentialsMlsClientID_Invocations.count, 1) - XCTAssertTrue(BackendInfo.isMLSEnabled) - XCTAssertTrue(sut.featureRepository.fetchMLS().isEnabled) - } - } - func test_didFinishQuickSync_CalculateSupportedProtocolsIfNoProtocols() { syncMOC.performAndWait { // GIVEN diff --git a/wire-ios/Wire-iOS Share Extension/Sources/View Controllers/ShareExtensionViewController.swift b/wire-ios/Wire-iOS Share Extension/Sources/View Controllers/ShareExtensionViewController.swift index 4cd3cfda4de..08623fce760 100644 --- a/wire-ios/Wire-iOS Share Extension/Sources/View Controllers/ShareExtensionViewController.swift +++ b/wire-ios/Wire-iOS Share Extension/Sources/View Controllers/ShareExtensionViewController.swift @@ -208,34 +208,17 @@ final class ShareExtensionViewController: SLComposeServiceViewController { return } - if DeveloperFlag.multibackend.isOn { - let appContainerURL = FileManager.sharedContainerDirectory(for: appGroupID) - - let loader = try SharingSessionLoader( - account: account, - appContainerURL: appContainerURL, - appGroupID: appGroupID, - buildNumber: buildNumber, - sharedUserDefaults: .applicationGroup, - minTLSVersion: SecurityFlags.minTLSVersion.stringValue - ) - sharingSession = try await loader.load() - } else { - let legacyConfig = AppLockController.LegacyConfig.fromBundle() - - sharingSession = try await SharingSession( - applicationGroupIdentifier: appGroupID, - accountIdentifier: account.userIdentifier, - hostBundleIdentifier: hostBundleID, - environment: BackendEnvironment.shared, - appLockConfig: legacyConfig, - sharedUserDefaults: .applicationGroup, - minTLSVersion: SecurityFlags.minTLSVersion.stringValue, - currentBuildNumber: buildNumber, - localDomain: BackendInfo.domain, - isFederationEnabled: BackendInfo.isFederationEnabled - ) - } + let appContainerURL = FileManager.sharedContainerDirectory(for: appGroupID) + + let loader = try SharingSessionLoader( + account: account, + appContainerURL: appContainerURL, + appGroupID: appGroupID, + buildNumber: buildNumber, + sharedUserDefaults: .applicationGroup, + minTLSVersion: SecurityFlags.minTLSVersion.stringValue + ) + sharingSession = try await loader.load() } override func configurationItems() -> [Any]! { diff --git a/wire-ios/Wire-iOS Tests/AppStateCalculatorTests.swift b/wire-ios/Wire-iOS Tests/AppStateCalculatorTests.swift index 9cd330f7aa4..36bf5fa37b7 100644 --- a/wire-ios/Wire-iOS Tests/AppStateCalculatorTests.swift +++ b/wire-ios/Wire-iOS Tests/AppStateCalculatorTests.swift @@ -318,22 +318,4 @@ final class AppStateCalculatorTests: XCTestCase { // THEN XCTAssertEqual(delegate.appStateCalculatorDidCalculateCompletion_Invocations.count, 1) } - - func testThatItDoesntTransitionAwayFromBlacklisted_IfThereIsNoCurrentAPIVersion() { - // GIVEN - DeveloperFlag.multibackend.enable(false, storage: .temporary()) - - let userSession = UserSessionMock() - sut.applicationDidBecomeActive() - BackendInfo.apiVersion = nil - - let blacklistState = AppState.blacklisted(reason: .clientAPIVersionObsolete) - sut.testHelper_setAppState(blacklistState) - - // WHEN - sut.sessionManagerDidReportLockChange(forSession: userSession) - - // THEN - XCTAssertEqual(sut.appState, blacklistState) - } } diff --git a/wire-ios/Wire-iOS Tests/Authentication/AuthenticationInterfaceBuilderTests.swift b/wire-ios/Wire-iOS Tests/Authentication/AuthenticationInterfaceBuilderTests.swift index dbc524be427..7b4d84a6920 100644 --- a/wire-ios/Wire-iOS Tests/Authentication/AuthenticationInterfaceBuilderTests.swift +++ b/wire-ios/Wire-iOS Tests/Authentication/AuthenticationInterfaceBuilderTests.swift @@ -220,53 +220,6 @@ final class AuthenticationInterfaceBuilderTests: XCTestCase, CoreDataFixtureTest runSnapshotTest(for: .pendingEmailLinkVerification(credentials)) } - @MainActor - func testReauthenticate_Email_TokenExpired() { - DeveloperFlag.multibackend.enable(false, storage: .temporary()) - let credentials = LoginCredentials(emailAddress: "test@example.com", usesCompanyLogin: false) - runSnapshotTest(for: .reauthenticate( - credentials: credentials, - environment: nil, - numberOfAccounts: 1, - isSignedOut: true - )) - } - - @MainActor - func testReauthenticate_Email_DuringLogin() { - DeveloperFlag.multibackend.enable(false, storage: .temporary()) - let credentials = LoginCredentials(emailAddress: "test@example.com", usesCompanyLogin: false) - runSnapshotTest(for: .reauthenticate( - credentials: credentials, - environment: nil, - numberOfAccounts: 1, - isSignedOut: false - )) - } - - @MainActor - func testReauthenticate_CompanyLogin() { - DeveloperFlag.multibackend.enable(false, storage: .temporary()) - let credentials = LoginCredentials(emailAddress: nil, usesCompanyLogin: true) - runSnapshotTest(for: .reauthenticate( - credentials: credentials, - environment: nil, - numberOfAccounts: 1, - isSignedOut: true - )) - } - - @MainActor - func testReauthenticate_NoCredentials() { - DeveloperFlag.multibackend.enable(false, storage: .temporary()) - runSnapshotTest(for: .reauthenticate( - credentials: nil, - environment: nil, - numberOfAccounts: 1, - isSignedOut: true - )) - } - // MARK: - Helpers @MainActor diff --git a/wire-ios/Wire-iOS Tests/ReferenceImages/AuthenticationInterfaceBuilderTests/testReauthenticate_CompanyLogin.1.png b/wire-ios/Wire-iOS Tests/ReferenceImages/AuthenticationInterfaceBuilderTests/testReauthenticate_CompanyLogin.1.png deleted file mode 100644 index 6c23b49809e..00000000000 --- a/wire-ios/Wire-iOS Tests/ReferenceImages/AuthenticationInterfaceBuilderTests/testReauthenticate_CompanyLogin.1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:85107f6353c9f43a02cd330f3a4129ae09f82665c8d3db23b800ea620ef4a9bd -size 111917 diff --git a/wire-ios/Wire-iOS Tests/ReferenceImages/AuthenticationInterfaceBuilderTests/testReauthenticate_Email_DuringLogin.1.png b/wire-ios/Wire-iOS Tests/ReferenceImages/AuthenticationInterfaceBuilderTests/testReauthenticate_Email_DuringLogin.1.png deleted file mode 100644 index 078379b2bae..00000000000 --- a/wire-ios/Wire-iOS Tests/ReferenceImages/AuthenticationInterfaceBuilderTests/testReauthenticate_Email_DuringLogin.1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:31c528e87bfa460cf80134d90fdd5d1abe16f1816c67078216fa55258a6dc0bc -size 127103 diff --git a/wire-ios/Wire-iOS Tests/ReferenceImages/AuthenticationInterfaceBuilderTests/testReauthenticate_Email_TokenExpired.1.png b/wire-ios/Wire-iOS Tests/ReferenceImages/AuthenticationInterfaceBuilderTests/testReauthenticate_Email_TokenExpired.1.png deleted file mode 100644 index 5e9d98766e2..00000000000 --- a/wire-ios/Wire-iOS Tests/ReferenceImages/AuthenticationInterfaceBuilderTests/testReauthenticate_Email_TokenExpired.1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a2325aaf4daf9c721be3f9df91d67aa3a8dcfbb3c9fc886561bbd491dd502272 -size 131249 diff --git a/wire-ios/Wire-iOS Tests/ReferenceImages/AuthenticationInterfaceBuilderTests/testReauthenticate_NoCredentials.1.png b/wire-ios/Wire-iOS Tests/ReferenceImages/AuthenticationInterfaceBuilderTests/testReauthenticate_NoCredentials.1.png deleted file mode 100644 index 36381b1727d..00000000000 --- a/wire-ios/Wire-iOS Tests/ReferenceImages/AuthenticationInterfaceBuilderTests/testReauthenticate_NoCredentials.1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:52a105908b75fe1f59cc17237f168aae614dbec114e520f7f5d18165a4a52514 -size 121784 diff --git a/wire-ios/Wire-iOS Tests/ReferenceImages/SelfProfileViewControllerTests/testForAUserWithALongName.1.png b/wire-ios/Wire-iOS Tests/ReferenceImages/SelfProfileViewControllerTests/testForAUserWithALongName.1.png index 2271f3a4468..cce945011d0 100644 --- a/wire-ios/Wire-iOS Tests/ReferenceImages/SelfProfileViewControllerTests/testForAUserWithALongName.1.png +++ b/wire-ios/Wire-iOS Tests/ReferenceImages/SelfProfileViewControllerTests/testForAUserWithALongName.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:03059565eb993e59360bcd85578631b36ffec298390d65dfe391299b0b213f76 -size 140165 +oid sha256:9f8a78e9dd3023dd0be7fecd2917257c68bdf1043654dfd261dd65c4e84a3333 +size 140201 diff --git a/wire-ios/Wire-iOS Tests/ReferenceImages/SelfProfileViewControllerTests/testForAUserWithNoTeam.1.png b/wire-ios/Wire-iOS Tests/ReferenceImages/SelfProfileViewControllerTests/testForAUserWithNoTeam.1.png index 3b556a4acd8..05a1db5bde7 100644 --- a/wire-ios/Wire-iOS Tests/ReferenceImages/SelfProfileViewControllerTests/testForAUserWithNoTeam.1.png +++ b/wire-ios/Wire-iOS Tests/ReferenceImages/SelfProfileViewControllerTests/testForAUserWithNoTeam.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ecc71727cd63bd7b811dd4e896b66591e7c4175cd2cdfa8897967a51f86fae01 -size 108793 +oid sha256:6fd5aa44321e7c78fa74fef2edaa36796142526dac3f164bf763548af19f3295 +size 108895 diff --git a/wire-ios/Wire-iOS Tests/SelfProfileViewControllerTests.swift b/wire-ios/Wire-iOS Tests/SelfProfileViewControllerTests.swift index a67203927bf..1afb9d965f4 100644 --- a/wire-ios/Wire-iOS Tests/SelfProfileViewControllerTests.swift +++ b/wire-ios/Wire-iOS Tests/SelfProfileViewControllerTests.swift @@ -38,7 +38,6 @@ final class SelfProfileViewControllerTests: XCTestCase, CoreDataFixtureTestHelpe override func setUp() async throws { try await super.setUp() - DeveloperFlag.multibackend.enable(false) snapshotHelper = .init() coreDataFixture = try await CoreDataFixture() @@ -47,6 +46,16 @@ final class SelfProfileViewControllerTests: XCTestCase, CoreDataFixtureTestHelpe userSession = UserSessionMock(mockUser: selfUser) accountManager = MockSelfProfileAccountManager() + + setupMultipleAccounts(true) + } + + private func setupMultipleAccounts(_ multipleAccounts: Bool) { + guard multipleAccounts else { + accountManager.sortedAccounts_MockValue = [] + return + } + let accounts = [ Account( userName: "Iggy Pop", @@ -64,18 +73,18 @@ final class SelfProfileViewControllerTests: XCTestCase, CoreDataFixtureTestHelpe ) ] accountManager.sortedAccounts_MockValue = accounts - } // MARK: - tearDown override func tearDown() { snapshotHelper = nil - sut = nil coreDataFixture = nil SelfUser.provider = nil selfUser = nil userSession = nil + accountManager = nil + sut = nil super.tearDown() } @@ -83,19 +92,20 @@ final class SelfProfileViewControllerTests: XCTestCase, CoreDataFixtureTestHelpe @MainActor func testForAUserWithNoTeam() { + setupMultipleAccounts(false) createSut(userName: "Tarja Turunen", teamMember: false) snapshotHelper.verify(matching: sut.view) } @MainActor func testForAUserWithALongName() { + setupMultipleAccounts(false) createSut(userName: "Johannes Chrysostomus Wolfgangus Theophilus Mozart", teamMember: true) snapshotHelper.verify(matching: sut.view) } @MainActor func testAccountSwitcher() { - DeveloperFlag.multibackend.enable(true) createSut(userName: "Tarja Turunen", teamMember: true, canManageTeam: true) snapshotHelper.verify(matching: sut.view) } diff --git a/wire-ios/Wire-iOS/Sources/AppStateCalculator.swift b/wire-ios/Wire-iOS/Sources/AppStateCalculator.swift index 017e2a313ae..91ad13997db 100644 --- a/wire-ios/Wire-iOS/Sources/AppStateCalculator.swift +++ b/wire-ios/Wire-iOS/Sources/AppStateCalculator.swift @@ -189,14 +189,6 @@ final class AppStateCalculator { return } - if !DeveloperFlag.multibackend.isOn { - // If app has been blacklisted due to api version, ignore new state. - if case .blacklisted = self.appState, BackendInfo.apiVersion == nil { - completion?() - return - } - } - self.appState = appState pendingAppState = nil diff --git a/wire-ios/Wire-iOS/Sources/Authentication/AuthenticationInterfaceBuilder.swift b/wire-ios/Wire-iOS/Sources/Authentication/AuthenticationInterfaceBuilder.swift index bd1397ac908..b4b18d3dc14 100644 --- a/wire-ios/Wire-iOS/Sources/Authentication/AuthenticationInterfaceBuilder.swift +++ b/wire-ios/Wire-iOS/Sources/Authentication/AuthenticationInterfaceBuilder.swift @@ -84,11 +84,7 @@ final class AuthenticationInterfaceBuilder { ) -> AuthenticationStepViewController? { switch step { case .wireAuthenticationModule: - let environment: BackendEnvironment2 = if DeveloperFlag.multibackend.isOn { - defaultEnvironment - } else { - BackendEnvironment2(BackendEnvironment.shared) - } + let environment: BackendEnvironment2 = defaultEnvironment let analyticsServiceConfiguration = AnalyticsServiceConfigurationBuilder.build() let registrationAnalyticsTracker = analyticsServiceConfiguration.map { analyticsServiceConfiguration in @@ -118,7 +114,7 @@ final class AuthenticationInterfaceBuilder { landingViewController.configure(with: featureProvider) return landingViewController - case let .reauthenticate(credentials, environment, _, _) where DeveloperFlag.multibackend.isOn: + case let .reauthenticate(credentials, environment, _, _): let analyticsServiceConfiguration = AnalyticsServiceConfigurationBuilder.build() let registrationAnalyticsTracker = analyticsServiceConfiguration.map { analyticsServiceConfiguration in RegistrationAnalyticsTracker( @@ -155,32 +151,6 @@ final class AuthenticationInterfaceBuilder { authenticationCoordinator: authenticationCoordinator ) - case let .reauthenticate(credentials, _, _, isSignedOut): - let viewController: AuthenticationStepController - - if credentials?.usesCompanyLogin == true { - // Is the user has SSO enabled, show the screen to log in with SSO - let companyLoginStep = ReauthenticateWithCompanyLoginStepDescription() - viewController = makeViewController(for: companyLoginStep) - - } else { - let prefill: AuthenticationPrefilledCredentials? = if let credentials, credentials.emailAddress != nil { - AuthenticationPrefilledCredentials(credentials: credentials, isExpired: isSignedOut) - } else { - nil - } - - viewController = makeCredentialsViewController(for: .reauthentication(prefill)) - } - - // Add the bar button item to sign out - viewController.setRightItem( - L10n.Localizable.Registration.Signin.TooManyDevices.SignOutButton.title, - withAction: .signOut(warn: true), - accessibilityID: "signOutButton" - ) - return viewController - case let .provideCredentials(prefill): return makeCredentialsViewController(for: .login(prefill)) @@ -356,7 +326,6 @@ final class AuthenticationInterfaceBuilder { ssoCallbackURLScheme: Bundle.ssoURLScheme ?? "wire-sso", appStoreURL: WireURLs.shared.appOnItunes, accountsPublisher: CurrentValuePublisher(subject: CurrentValueSubject(accounts)), - isMultibackendEnabled: DeveloperFlag.multibackend.isOn, registrationAnalyticsTracker: registrationAnalyticsTracker ) } diff --git a/wire-ios/Wire-iOS/Sources/Authentication/Coordinator/AuthenticationCoordinator.swift b/wire-ios/Wire-iOS/Sources/Authentication/Coordinator/AuthenticationCoordinator.swift index 514f5a32c3b..0e4b014b2fe 100644 --- a/wire-ios/Wire-iOS/Sources/Authentication/Coordinator/AuthenticationCoordinator.swift +++ b/wire-ios/Wire-iOS/Sources/Authentication/Coordinator/AuthenticationCoordinator.swift @@ -314,29 +314,8 @@ extension AuthenticationCoordinator: AuthenticationActioner, SessionManagerCreat unauthenticatedSession.continueAfterBackupImportStep() case let .completeWireAuthenticationLogin((result, trackingConsent)): - if !DeveloperFlag.multibackend.isOn { - // Make sure we use the same backend from the authentication flow. - let backendEnvironment = BackendEnvironment(result.backendEnvironment) - - BackendEnvironment.shared = backendEnvironment - SessionManager.shared?.switchBackendWithoutResolving(to: backendEnvironment) - - // Make sure we persist and backend info gathered during authentication. - let backendMetadata = result.backendMetadata - BackendInfo.apiVersion = APIVersion(rawValue: Int32(backendMetadata.apiVersion.rawValue)) - BackendInfo.domain = backendMetadata.domain - BackendInfo.isFederationEnabled = backendMetadata.isFederationEnabled - - if let proxyCredentials = result.proxyCredentials { - sessionManager.saveProxyCredentials( - username: proxyCredentials.username, - password: proxyCredentials.password - ) - } - } else { - // Don't store the env here... pass it along when upgrading - // to an authenticated session. - } + // Don't store the env here... pass it along when upgrading + // to an authenticated session. if let emailCredentials = result.emailCredentials { // Set credentials so we can register a new client via registration status. @@ -372,20 +351,16 @@ extension AuthenticationCoordinator: AuthenticationActioner, SessionManagerCreat break } - if DeveloperFlag.multibackend.isOn { - let newEnvironment = NewEnvironment( - backendEnvironment: result.backendEnvironment, - metadata: result.backendMetadata, - cookies: result.cookies, - proxyCredentials: result.proxyCredentials - ) - unauthenticatedSession.upgradeToAuthenticatedSession( - with: userInfo, - newEnvironment: newEnvironment - ) - } else { - unauthenticatedSession.upgradeToAuthenticatedSession(with: userInfo) - } + let newEnvironment = NewEnvironment( + backendEnvironment: result.backendEnvironment, + metadata: result.backendMetadata, + cookies: result.cookies, + proxyCredentials: result.proxyCredentials + ) + unauthenticatedSession.upgradeToAuthenticatedSession( + with: userInfo, + newEnvironment: newEnvironment + ) case let .executeFeedbackAction(action): currentViewController?.executeErrorFeedbackAction(action) diff --git a/wire-ios/Wire-iOS/Sources/Authentication/Interface/Descriptions/ScreenDescriptions/Login/ReauthenticateWithCompanyLoginStepDescription.swift b/wire-ios/Wire-iOS/Sources/Authentication/Interface/Descriptions/ScreenDescriptions/Login/ReauthenticateWithCompanyLoginStepDescription.swift index 1b604688362..e69de29bb2d 100644 --- a/wire-ios/Wire-iOS/Sources/Authentication/Interface/Descriptions/ScreenDescriptions/Login/ReauthenticateWithCompanyLoginStepDescription.swift +++ b/wire-ios/Wire-iOS/Sources/Authentication/Interface/Descriptions/ScreenDescriptions/Login/ReauthenticateWithCompanyLoginStepDescription.swift @@ -1,43 +0,0 @@ -// -// Wire -// Copyright (C) 2026 Wire Swiss GmbH -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see http://www.gnu.org/licenses/. -// - -import Foundation - -final class ReauthenticateWithCompanyLoginStepDescription: AuthenticationStepDescription { - - let backButton: BackButtonDescription? - let mainView: ViewDescriptor & ValueSubmission - let headline: String - let subtext: NSAttributedString? - let secondaryView: AuthenticationSecondaryViewDescription? - let footerView: AuthenticationFooterViewDescription? - - init() { - self.backButton = BackButtonDescription() - self.headline = L10n.Localizable.Registration.Signin.title - self.subtext = .markdown(from: L10n.Localizable.SigninLogout.Sso.subheadline, style: .login) - - self.mainView = SolidButtonDescription( - title: L10n.Localizable.SigninLogout.Sso.buton, - accessibilityIdentifier: "company_login" - ) - self.secondaryView = nil - self.footerView = nil - } - -} diff --git a/wire-ios/Wire-iOS/Sources/UserInterface/SelfProfile/AccountSelector/AccountSelectorView.swift b/wire-ios/Wire-iOS/Sources/UserInterface/SelfProfile/AccountSelector/AccountSelectorView.swift index 1e1b7629c2e..e69de29bb2d 100644 --- a/wire-ios/Wire-iOS/Sources/UserInterface/SelfProfile/AccountSelector/AccountSelectorView.swift +++ b/wire-ios/Wire-iOS/Sources/UserInterface/SelfProfile/AccountSelector/AccountSelectorView.swift @@ -1,72 +0,0 @@ -// -// Wire -// Copyright (C) 2026 Wire Swiss GmbH -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see http://www.gnu.org/licenses/. -// - -import UIKit -import WireDataModel -import WireSyncEngine - -protocol AccountSelectorViewDelegate: AnyObject { - func accountSelectorView(_ view: AccountSelectorView, didSelect account: Account) -} - -final class AccountSelectorView: UIView { - - weak var delegate: AccountSelectorViewDelegate? - - private let stackView = UIStackView() - - var accounts = [Account]() { - didSet { updateStackView() } - } - - override init(frame: CGRect) { - super.init(frame: frame) - setupSubviews() - } - - @available(*, unavailable) - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) is not supported") - } - - private func setupSubviews() { - stackView.spacing = 6 - stackView.translatesAutoresizingMaskIntoConstraints = false - addSubview(stackView) - NSLayoutConstraint.activate([ - stackView.centerYAnchor.constraint(equalTo: centerYAnchor), - stackView.leadingAnchor.constraint(equalTo: leadingAnchor), - stackView.trailingAnchor.constraint(equalTo: trailingAnchor), - stackView.heightAnchor.constraint(equalTo: heightAnchor) - ]) - } - - private func updateStackView() { - stackView.arrangedSubviews.forEach { subview in - subview.removeFromSuperview() - } - accounts.forEach { account in - let accountView = AccountViewBuilder(account: account, displayContext: .accountSelector).build() - accountView.unreadCountStyle = .current - accountView.onTap = { [weak self] account in - self?.delegate?.accountSelectorView(self!, didSelect: account) - } - stackView.addArrangedSubview(accountView) - } - } -} diff --git a/wire-ios/Wire-iOS/Sources/UserInterface/SelfProfile/SelfProfileViewController.swift b/wire-ios/Wire-iOS/Sources/UserInterface/SelfProfile/SelfProfileViewController.swift index 10a9d860102..6f146e1eae8 100644 --- a/wire-ios/Wire-iOS/Sources/UserInterface/SelfProfile/SelfProfileViewController.swift +++ b/wire-ios/Wire-iOS/Sources/UserInterface/SelfProfile/SelfProfileViewController.swift @@ -48,7 +48,6 @@ final class SelfProfileViewController: UIViewController { private var bottomController: UIViewController! private var settingsController: SettingsTableViewController? private var accountSwitcherViewController: AccountSwitcherHostingController? - private weak var accountSelectorView: AccountSelectorView? private let profileLayoutGuide = UILayoutGuide() private var profileLayoutGuideViewTopConstraint = NSLayoutConstraint() private var profileLayoutGuideBannerTopConstraint = NSLayoutConstraint() @@ -138,17 +137,11 @@ final class SelfProfileViewController: UIViewController { teamMigrationBanner?.view.backgroundColor = .clear } - if DeveloperFlag.multibackend.isOn { - let accountSwitcherViewController = makeAccountSwitcherViewController( - settingsCellDescriptorFactory: settingsCellDescriptorFactory - ) - self.bottomController = accountSwitcherViewController - self.accountSwitcherViewController = accountSwitcherViewController - } else { - let settingsController = rootGroup.generateViewController()! as! SettingsTableViewController - self.bottomController = settingsController - self.settingsController = settingsController - } + let accountSwitcherViewController = makeAccountSwitcherViewController( + settingsCellDescriptorFactory: settingsCellDescriptorFactory + ) + self.bottomController = accountSwitcherViewController + self.accountSwitcherViewController = accountSwitcherViewController } private func makeAccountSwitcherViewController(settingsCellDescriptorFactory: SettingsCellDescriptorFactory) @@ -221,7 +214,6 @@ final class SelfProfileViewController: UIViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) selfProfileViewsMonitor.onDidViewSelfProfile() - configureAccountTitle() navigationItem.rightBarButtonItem = UIBarButtonItem.closeButton(action: UIAction { [weak self] _ in self?.dismiss() }, accessibilityLabel: L10n.Localizable.General.close) @@ -237,21 +229,6 @@ final class SelfProfileViewController: UIViewController { } } - private func configureAccountTitle() { - guard !DeveloperFlag.multibackend.isOn else { - return - } - if let accounts = accountManager?.sortedAccounts(), accounts.count > 1 { - let accountSelectorView = AccountSelectorView() - accountSelectorView.delegate = self - accountSelectorView.accounts = accounts - navigationItem.titleView = accountSelectorView - self.accountSelectorView = accountSelectorView - } else { - setupNavigationBarTitle(L10n.Localizable.Self.account) - } - } - private func createConstraints() { profileHeaderViewController.view.translatesAutoresizingMaskIntoConstraints = false bottomController.view.translatesAutoresizingMaskIntoConstraints = false @@ -432,20 +409,6 @@ final class SelfProfileViewController: UIViewController { dismiss(animated: true) return true } -} - -// MARK: - UIAdaptivePresentationControllerDelegate - -extension SelfProfileViewController: UIAdaptivePresentationControllerDelegate { - - func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { - sendDismissAnalyticsEventIfNeeded() - } -} - -// MARK: - AccountSelectorViewDelegate - -extension SelfProfileViewController: AccountSelectorViewDelegate { private func handleAccountSelected(_ account: Account) { guard accountManager?.selectedAccount != account else { return } @@ -458,9 +421,14 @@ extension SelfProfileViewController: AccountSelectorViewDelegate { self.accountSelector?.switchTo(account: account) } } +} + +// MARK: - UIAdaptivePresentationControllerDelegate - func accountSelectorView(_ view: AccountSelectorView, didSelect account: Account) { - handleAccountSelected(account) +extension SelfProfileViewController: UIAdaptivePresentationControllerDelegate { + + func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { + sendDismissAnalyticsEventIfNeeded() } }