diff --git a/wire-ios-sync-engine/Source/Public/WireSyncEngine.h b/wire-ios-sync-engine/Source/Public/WireSyncEngine.h index f0fa7436344..1e36650d381 100644 --- a/wire-ios-sync-engine/Source/Public/WireSyncEngine.h +++ b/wire-ios-sync-engine/Source/Public/WireSyncEngine.h @@ -20,7 +20,6 @@ #import // PRIVATE -#import #import #import #import diff --git a/wire-ios-sync-engine/Source/SessionManager/SessionManager.swift b/wire-ios-sync-engine/Source/SessionManager/SessionManager.swift index 7949da3efce..8c5cc431917 100644 --- a/wire-ios-sync-engine/Source/SessionManager/SessionManager.swift +++ b/wire-ios-sync-engine/Source/SessionManager/SessionManager.swift @@ -314,7 +314,6 @@ public final class SessionManager: NSObject, SessionManagerType { let application: ZMApplication var deleteAccountToken: Any? var callCenterObserverToken: Any? - var blacklistVerificator: ZMBlacklistVerificator? let configuration: SessionManagerConfiguration var pendingURLAction: URLAction? let apiMigrationManager: APIMigrationManager @@ -475,8 +474,6 @@ public final class SessionManager: NSObject, SessionManagerType { logFilesProvider: logFilesProvider ) - configureBlacklistDownload() - self.memoryWarningObserver = NotificationCenter.default.addObserver( forName: UIApplication.didReceiveMemoryWarningNotification, object: nil, @@ -660,38 +657,6 @@ public final class SessionManager: NSObject, SessionManagerType { } } - private func configureBlacklistDownload() { - guard !DeveloperFlag.multibackend.isOn else { - return - } - if configuration.blacklistDownloadInterval > 0 { - blacklistVerificator?.tearDown() - blacklistVerificator = ZMBlacklistVerificator( - checkInterval: configuration.blacklistDownloadInterval, - version: currentBuildNumber, - environment: environment, - proxyUsername: proxyCredentials?.username, - proxyPassword: proxyCredentials?.password, - readyForRequests: isUnauthenticatedTransportSessionReady, - working: nil, - application: application, - minTLSVersion: minTLSVersion, - blacklistCallback: { [weak self] blacklisted in - guard let self, !self.isAppVersionBlacklisted else { return } - - if blacklisted { - isAppVersionBlacklisted = true - delegate?.sessionManagerDidBlacklistCurrentVersion(reason: .appVersionBlacklisted) - // When the application version is blacklisted we don't want have a - // transition to any other state in the UI, so we won't inform it - // anymore by setting the delegate to nil. - delegate = nil - } - } - ) - } - } - public func removeProxyCredentials() { guard let proxy = environment.proxy else { return } _ = ProxyCredentials.destroy(for: proxy) @@ -721,9 +686,6 @@ public final class SessionManager: NSObject, SessionManagerType { isUnauthenticatedTransportSessionReady = ready apiVersionResolver = createAPIVersionResolver() - if blacklistVerificator != nil { - configureBlacklistDownload() - } // force creation of unauthenticatedSession unauthenticatedSessionFactory.readyForRequests = ready } @@ -1390,11 +1352,10 @@ public final class SessionManager: NSObject, SessionManagerType { deinit { DispatchQueue .main - .async { [backgroundUserSessions, blacklistVerificator, unauthenticatedSession, reachability] in + .async { [backgroundUserSessions, unauthenticatedSession, reachability] in backgroundUserSessions.values.forEach { session in session.tearDown() } - blacklistVerificator?.tearDown() unauthenticatedSession?.tearDown() reachability.tearDown() } diff --git a/wire-ios-sync-engine/Source/Synchronization/ZMOperationLoop.h b/wire-ios-sync-engine/Source/Synchronization/ZMOperationLoop.h index b86d1f1861c..31f3fc96696 100644 --- a/wire-ios-sync-engine/Source/Synchronization/ZMOperationLoop.h +++ b/wire-ios-sync-engine/Source/Synchronization/ZMOperationLoop.h @@ -17,6 +17,7 @@ // @import Foundation; +@import WireUtilities; @protocol ZMApplication; @protocol FlowManagerType; diff --git a/wire-ios-sync-engine/Source/UnauthenticatedSession/ZMAuthenticationStatus.h b/wire-ios-sync-engine/Source/UnauthenticatedSession/ZMAuthenticationStatus.h index c33b6ab7a7e..4445c48773d 100644 --- a/wire-ios-sync-engine/Source/UnauthenticatedSession/ZMAuthenticationStatus.h +++ b/wire-ios-sync-engine/Source/UnauthenticatedSession/ZMAuthenticationStatus.h @@ -29,6 +29,7 @@ @class ZMTransportResponse; @protocol UserInfoParser; @protocol NotificationContext; +@protocol ZMSGroupQueue; FOUNDATION_EXPORT NSTimeInterval DebugLoginFailureTimerOverride; diff --git a/wire-ios-sync-engine/Source/UserSession/Blacklist.swift b/wire-ios-sync-engine/Source/UserSession/Blacklist.swift deleted file mode 100644 index a91021099c5..00000000000 --- a/wire-ios-sync-engine/Source/UserSession/Blacklist.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// Wire -// Copyright (C) 2025 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 - -@objcMembers -public class Blacklist: NSObject { - public let minVersion: String - public let excludedVersions: [String] - - public init?(json: [AnyHashable: Any]) { - guard let minVersion = json["min_version"] as? String, - let excludedVersions = json["exclude"] as? [String] else { - return nil - } - self.minVersion = minVersion - self.excludedVersions = excludedVersions - } -} diff --git a/wire-ios-sync-engine/Source/UserSession/ZMBlacklistDownloader+Testing.h b/wire-ios-sync-engine/Source/UserSession/ZMBlacklistDownloader+Testing.h deleted file mode 100644 index 3ad8e7f947c..00000000000 --- a/wire-ios-sync-engine/Source/UserSession/ZMBlacklistDownloader+Testing.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// Wire -// Copyright (C) 2025 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 "ZMBlacklistDownloader.h" - -@protocol BackendEnvironmentProvider; - -@interface ZMBlacklistDownloader (Testing) - -- (instancetype)initWithURLSession:(NSURLSession *)session - environment:(id)environment - proxyUsername:(NSString *)proxyUsername - proxyPassword:(NSString *)proxyPassword - readyForRequests:(BOOL)readyForRequests - successCheckInterval:(NSTimeInterval)successCheckInterval - failureCheckInterval:(NSTimeInterval)failureCheckInterval - userDefaults:(NSUserDefaults *)userDefaults - application:(id)application - workingGroup:(ZMSDispatchGroup *)workingGroup - minTLSVersion:(NSString *)minTLSVersion - completionHandler:(void (^)(NSString *, NSArray *))completionHandler; - -@end diff --git a/wire-ios-sync-engine/Source/UserSession/ZMBlacklistDownloader.h b/wire-ios-sync-engine/Source/UserSession/ZMBlacklistDownloader.h deleted file mode 100644 index 34d3411ff83..00000000000 --- a/wire-ios-sync-engine/Source/UserSession/ZMBlacklistDownloader.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// Wire -// Copyright (C) 2025 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; -@import WireUtilities; - -@protocol ZMApplication; -@protocol BackendEnvironmentProvider; - -@interface ZMBlacklistDownloader : NSObject - -/// Creates a downloader that will download the blacklist file at regular intervals and invokes the completion handler on the main queue when a blacklist is available -- (instancetype)initWithDownloadInterval:(NSTimeInterval)downloadInterval - environment:(id)environment - proxyUsername:(NSString *)proxyUsername - proxyPassword:(NSString *)proxyPassword - readyForRequests:(BOOL)readyForRequests - workingGroup:(ZMSDispatchGroup *)workingGroup - application:(id)application - minTLSVersion:(NSString *)minTLSVersion - completionHandler:(void (^)(NSString *minVersion, NSArray *excludedVersions))completionHandler; - -@end diff --git a/wire-ios-sync-engine/Source/UserSession/ZMBlacklistDownloader.m b/wire-ios-sync-engine/Source/UserSession/ZMBlacklistDownloader.m deleted file mode 100644 index a4796457704..00000000000 --- a/wire-ios-sync-engine/Source/UserSession/ZMBlacklistDownloader.m +++ /dev/null @@ -1,477 +0,0 @@ -// -// Wire -// Copyright (C) 2025 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 WireSystem; -@import WireUtilities; -@import WireTransport; -@import UIKit; - -#import "ZMBlacklistDownloader+Testing.h" -#import - -static NSString *ZMLogTag ZM_UNUSED = @"Blacklist"; - -/// When to retry if the requests are failing -static NSTimeInterval UnsuccessfulDownloadRetryInterval = 30 * 60; // 30 minutes - -static NSString * const MinVersionKey = @"min_version"; -static NSString * const ExcludeVersionsKey = @"exclude"; - - -@interface ZMBlacklistDownloader () -@property (nonatomic) NSURLSession *urlSession; - -/// Current data task -@property (nonatomic) NSURLSessionDataTask *dataTask; - -/// How often to check, if the last attempt was a success -@property (nonatomic) NSTimeInterval successCheckInterval; - -/// How ofter to check, it the last attempt was a failure -@property (nonatomic) NSTimeInterval failureCheckInterval; - -/// Where to load/save cached values from -@property (nonatomic) NSUserDefaults *userDefaults; - -/// Current cached min version -@property (nonatomic) NSString *minVersion; - -/// Current cached excluded version -@property (nonatomic) NSArray *excludedVersions; - -/// Isolation queue -@property (nonatomic) dispatch_queue_t queue; - -/// Backend environment to use -@property (nonatomic) id environment; - -/// Callback to be called when the blacklisted versions change -@property (nonatomic, copy) void(^completionHandler)(NSString *, NSArray *); - -/// Date of last successful download. If nil, there was no successful download -@property (nonatomic) NSDate *dateOfLastSuccessfulDownload; - -/// Date of last failed download. If nil, there was no failed download -@property (nonatomic) NSDate *dateOfLastUnsuccessfulDownload; - -/// Current timer -@property (nonatomic) NSTimer *currentTimer; - -/// In background -@property (nonatomic) BOOL inBackground; - -/// Group used to do work on. Will be entered when starting a request and exit when the response is received -@property (nonatomic) ZMSDispatchGroup *workingGroup; - -/// Application -@property (nonatomic) id application; - -@property (nonatomic) BOOL tornDown; - -/// wait for the network config (proxy) being setup -@property (nonatomic) BOOL readyForRequests; - -@end - - - -/** - Black list format: - - { - "min_version": "123", - "exclude": ["345", "346"] - } - - Version string is just a build version number. - All version that are lower than `min_version` or that are listed in `exclude` are not legal. - - Use of timers: - A timer is used to download at periodic intervals. The interval depends on whether the last - download was a success or a failure. The timer is stopped when moving to the background - and restarted when coming to the foreground. - - */ -@implementation ZMBlacklistDownloader - -- (instancetype)initWithDownloadInterval:(NSTimeInterval)downloadInterval - environment:(id)environment - proxyUsername:(NSString *)proxyUsername - proxyPassword:(NSString *)proxyPassword - readyForRequests: (BOOL)readyForRequests - workingGroup:(ZMSDispatchGroup *)workingGroup - application:(id)application - minTLSVersion:(NSString * _Nullable)minTLSVersion - completionHandler:(void (^)(NSString *, NSArray *))completionHandler { - return [self initWithURLSession:nil - environment:environment - proxyUsername:proxyUsername - proxyPassword:proxyPassword - readyForRequests:readyForRequests - successCheckInterval:downloadInterval - failureCheckInterval:UnsuccessfulDownloadRetryInterval - userDefaults:[NSUserDefaults standardUserDefaults] - application:application - workingGroup:workingGroup - minTLSVersion:minTLSVersion - completionHandler:completionHandler]; -} - - - -- (instancetype)initWithURLSession:(NSURLSession *)session - environment:(id)environment - proxyUsername:(NSString *)proxyUsername - proxyPassword:(NSString *)proxyPassword - readyForRequests:(BOOL)readyForRequests - successCheckInterval:(NSTimeInterval)successCheckInterval - failureCheckInterval:(NSTimeInterval)failureCheckInterval - userDefaults:(NSUserDefaults *)userDefaults - application:(id)application - workingGroup:(ZMSDispatchGroup *)workingGroup - minTLSVersion:(NSString * _Nullable)minTLSVersion - completionHandler:(void (^)(NSString *, NSArray *))completionHandler -{ - self = [super init]; - if (self != nil) { - self.application = application; - self.readyForRequests = readyForRequests; - NSDictionary* proxyDictionary = nil; - if (environment.proxy != nil) { - proxyDictionary = [environment.proxy socks5SettingsWithProxyUsername:proxyUsername proxyPassword:proxyPassword]; - } - if (session != nil) { - self.urlSession = session; - if (proxyDictionary != nil) { - self.urlSession.configuration.connectionProxyDictionary = proxyDictionary; - self.urlSession.configuration.HTTPShouldUsePipelining = true; - } - } else { - self.urlSession = [self defaultSessionWithProxyDictionary:proxyDictionary]; - } - - [self.urlSession setMinTLSVersionIfNeeded:minTLSVersion]; - - self.successCheckInterval = successCheckInterval; - self.failureCheckInterval = MIN(failureCheckInterval,successCheckInterval); // Make sure we don't download slower when unsuccessful - self.userDefaults = userDefaults; - self.environment = environment; - self.inBackground = NO; - self.queue = dispatch_queue_create("ZMBlacklistDownloader", DISPATCH_QUEUE_SERIAL); - id excludedVersions = [userDefaults objectForKey:ExcludeVersionsKey]; - if ([excludedVersions isKindOfClass:[NSArray class]]) { - self.excludedVersions = excludedVersions; - } - id minVersion = [self.userDefaults objectForKey:MinVersionKey]; - if ([minVersion isKindOfClass:[NSString class]]) { - self.minVersion = minVersion; - } - self.completionHandler = completionHandler; - self.dateOfLastSuccessfulDownload = nil; - self.dateOfLastUnsuccessfulDownload = nil; - self.workingGroup = workingGroup; - - [application registerObserverForDidBecomeActive:self selector:@selector(didBecomeActive:)]; - [application registerObserverForWillResignActive:self selector:@selector(willResignActive:)]; - - [self startTimerIfNeeded]; - } - return self; -} - -- (void)tearDown -{ - if (self.tornDown) { - return; - } - self.tornDown = YES; - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [self.application unregisterObserverForStateChange:self]; - self.inBackground = YES; - self.readyForRequests = NO; - - [self.workingGroup enter]; - dispatch_sync(self.queue, ^{ - [self.currentTimer invalidate]; - self.currentTimer = nil; - }); - [self.workingGroup leave]; - - self.queue = nil; - self.completionHandler = nil; - // self.workingGroup = nil; --> NOTE! Do not nil out workingGroup otherwise we might not leave all groups when an async dispatch is performed -} - -- (void)dealloc -{ - RequireString(self.tornDown, "ZMBlacklistDownloader needs to be torn down before deallocating."); -} - -- (NSURLSession *)defaultSessionWithProxyDictionary: (NSDictionary * _Nullable) proxyDictionary -{ - NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; - configuration.requestCachePolicy = NSURLRequestReloadIgnoringCacheData; - if (proxyDictionary != nil) { - configuration.connectionProxyDictionary = proxyDictionary; - configuration.HTTPShouldUsePipelining = true; - } - return [NSURLSession sessionWithConfiguration:configuration]; -} - -- (void)willResignActive:(NSNotification * __unused)note -{ - if (self.tornDown) { - return; - } - ZM_WEAK(self); - [self.workingGroup enter]; - dispatch_async(self.queue, ^{ - ZM_STRONG(self); - if (self == nil || self.tornDown) { - [self.workingGroup leave]; - return; - } - self.inBackground = YES; - [self.currentTimer invalidate]; - self.currentTimer = nil; - [self.workingGroup leave]; - }); -} - -- (void)didBecomeActive:(NSNotification * __unused)note -{ - if (self.tornDown) { - return; - } - ZM_WEAK(self); - [self.workingGroup enter]; - dispatch_async(self.queue, ^{ - ZM_STRONG(self); - if (self == nil || self.tornDown) { - [self.workingGroup leave]; - return; - } - self.inBackground = NO; - [self startTimerIfNeeded]; - [self.workingGroup leave]; - }); -} - -- (void)startTimerIfNeeded -{ - if (self.tornDown || self.inBackground || self.currentTimer != nil) { - return; - } - - ZM_WEAK(self); - [self.workingGroup enter]; - dispatch_async(self.queue, ^{ - ZM_STRONG(self); - if (self == nil || self.tornDown) { - [self.workingGroup leave]; - return; - } - - NSTimeInterval timeLeftSinceNextDownload = [self timeToNextDownload]; - if(timeLeftSinceNextDownload == 0) { - [self fetchBlackList]; - } - else { - NSTimer *timer = [NSTimer timerWithTimeInterval:timeLeftSinceNextDownload target:self selector:@selector(timerDidFire) userInfo:nil repeats:NO]; - self.currentTimer = timer; - [self.workingGroup enter]; - dispatch_async(dispatch_get_main_queue(), ^{ - ZM_STRONG(self); - if (self == nil || self.tornDown) { - [self.workingGroup leave]; - return; - } - if(self) { - [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes]; - } - [self.workingGroup leave]; - }); - } - [self.workingGroup leave]; - - }); -} - -- (void)timerDidFire -{ - if (self.tornDown) { - return; - } - - ZM_WEAK(self); - [self.workingGroup enter]; - dispatch_async(self.queue, ^{ - ZM_STRONG(self); - if (self == nil || self.tornDown) { - [self.workingGroup leave]; - return; - } - self.currentTimer = nil; - if(!self.inBackground) { - [self fetchBlackList]; - } - [self.workingGroup leave]; - }); -} - -- (NSTimeInterval)timeToNextDownload -{ - if(self.dateOfLastUnsuccessfulDownload == nil && self.dateOfLastSuccessfulDownload == nil) { - return 0; - } - - NSTimeInterval timeLeft = 0; - - BOOL isFailureMoreRecent = - self.dateOfLastUnsuccessfulDownload != nil && // there was a failure - (self.dateOfLastSuccessfulDownload == nil // never downloaded successfully - || [self.dateOfLastUnsuccessfulDownload compare:self.dateOfLastSuccessfulDownload] == NSOrderedAscending // or failure is more recent that success - ); - if(isFailureMoreRecent) { - timeLeft = MAX(0, self.failureCheckInterval + [self.dateOfLastUnsuccessfulDownload timeIntervalSinceNow]); - } - else { - timeLeft = MAX(0, self.successCheckInterval + [self.dateOfLastSuccessfulDownload timeIntervalSinceNow]); - } - return timeLeft; -} - -- (void)storeMinVersion:(NSString *)minVersion excludedVersions:(NSArray *)excludedVersions -{ - NSParameterAssert([minVersion isKindOfClass:[NSString class]]); - NSParameterAssert([excludedVersions isKindOfClass:[NSArray class]]); - - if(self.minVersion != minVersion || ![self.minVersion isEqualToString:minVersion]) { - self.minVersion = minVersion; - [self.userDefaults setObject:self.minVersion forKey:MinVersionKey]; - } - - if(self.excludedVersions != excludedVersions || ![self.excludedVersions isEqualToArray:excludedVersions]) { - self.excludedVersions = excludedVersions; - [self.userDefaults setObject:self.excludedVersions forKey:ExcludeVersionsKey]; - } -} - -- (void)didReceiveResponseForBlacklistWithData:(NSData *)data response:(NSURLResponse * __unused)response error:(NSError *)error { - - if (self.tornDown) { - return; - } - BOOL isSuccess = NO; - NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; - if (error != nil) { - ZMLogError(@"Failed to download black list: %@", error); - } - else if (data == nil) { - ZMLogError(@"Black list data is nil"); - } - else if(httpResponse.statusCode >= 400) { - ZMLogError(@"Blacklist download returned status code %ld", (long)httpResponse.statusCode); - } - else { - NSDictionary *blackListJSON = [self responseObjectWithData:data]; - if ([blackListJSON isKindOfClass:[NSDictionary class]]) { - Blacklist *blacklist = [[Blacklist alloc] initWithJson:blackListJSON]; - - if (nil != blacklist) { - ZMLogInfo(@"Blacklist minimum version: %@, excluded versions: %@", blacklist.minVersion, blacklist.excludedVersions); - - [self didDownloadBlacklistWithMinVersion:blacklist.minVersion - exclude:blacklist.excludedVersions]; - isSuccess = YES; - } - } - } - - if(isSuccess) { - self.dateOfLastSuccessfulDownload = [NSDate date]; - self.dateOfLastUnsuccessfulDownload = nil; - } - else { - self.dateOfLastSuccessfulDownload = nil; - self.dateOfLastUnsuccessfulDownload = [NSDate date]; - } - [self startTimerIfNeeded]; -} - -- (void)didDownloadBlacklistWithMinVersion:(NSString *)minVersion exclude:(NSArray *)exclude -{ - if(self.minVersion != minVersion || ![self.minVersion isEqualToString:minVersion] - || self.excludedVersions != exclude || ![self.excludedVersions isEqualToArray:exclude]) { - [self storeMinVersion:minVersion excludedVersions:exclude]; - - if (self.completionHandler) { - void(^completionHandler)(NSString *, NSArray *) = self.completionHandler; - [self.workingGroup enter]; - ZM_WEAK(self); - dispatch_async(dispatch_get_main_queue(), ^ void () { - ZM_STRONG(self); - completionHandler(minVersion, exclude); - [self.workingGroup leave]; - }); - } - } -} - -- (void)fetchBlackList -{ - if (!self.readyForRequests) { - return; - } - NSURL *backendURL = [self.environment.blackListURL URLByAppendingPathComponent:@"ios"]; - NSURLRequest *urlRequest = [[NSURLRequest alloc] initWithURL:backendURL]; - ZMLogInfo(@"Blacklist URL: %@", backendURL.absoluteString); - - //If we have something cached - pass it back - if (self.minVersion != nil && self.excludedVersions != nil) { - [self didDownloadBlacklistWithMinVersion:self.minVersion exclude:self.excludedVersions]; - } - // But also redownload because it might change - ZM_WEAK(self); - [self.workingGroup enter]; - self.dataTask = [self.urlSession dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse * __unused response, NSError *error) { - ZM_STRONG(self); - [self didReceiveResponseForBlacklistWithData:data response:response error:error]; - [self.workingGroup leave]; - }]; - [self.dataTask resume]; -} - -- (NSDictionary *)responseObjectWithData:(NSData *)data -{ - NSError *error; - NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; - if (error) { - ZMLogError(@"Black list json could not be parsed"); - return nil; - } - if (json == nil || ![json isKindOfClass:[NSDictionary class]]) { - ZMLogError(@"Black list is empty or has invalid format"); - return nil; - } - return json; -} - - -@end - diff --git a/wire-ios-sync-engine/Source/UserSession/ZMBlacklistVerificator+Testing.h b/wire-ios-sync-engine/Source/UserSession/ZMBlacklistVerificator+Testing.h deleted file mode 100644 index f5d7b3d503f..00000000000 --- a/wire-ios-sync-engine/Source/UserSession/ZMBlacklistVerificator+Testing.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// Wire -// Copyright (C) 2025 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 "ZMBlacklistVerificator.h" - -@interface ZMBlacklistVerificator (Testing) - - -- (instancetype)initWithCheckInterval:(NSTimeInterval)checkInterval - version:(NSString *)version - environment:(id)environment - proxyUsername:(NSString *)proxyUsername - proxyPassword:(NSString *)proxyPassword - readyForRequests:(BOOL)readyForRequests - workingGroup:(ZMSDispatchGroup *)workingGroup - application:(id)application - minTLSVersion:(NSString *)minTLSVersion - blacklistCallback:(void (^)(BOOL))blacklistCallback - blacklistClass:(Class)blacklistClass; - - -@end diff --git a/wire-ios-sync-engine/Source/UserSession/ZMBlacklistVerificator.h b/wire-ios-sync-engine/Source/UserSession/ZMBlacklistVerificator.h deleted file mode 100644 index d8f5319d609..00000000000 --- a/wire-ios-sync-engine/Source/UserSession/ZMBlacklistVerificator.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// Wire -// Copyright (C) 2025 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 - -@protocol ZMApplication; -@protocol BackendEnvironmentProvider; -@import WireUtilities; - -@interface ZMBlacklistVerificator : NSObject - -NS_ASSUME_NONNULL_BEGIN - -- (instancetype)initWithCheckInterval:(NSTimeInterval)checkInterval - version:(NSString *)version - environment:(id)environment - proxyUsername:(nullable NSString *)proxyUsername - proxyPassword:(nullable NSString *)proxyPassword - readyForRequests:(BOOL)readyForRequests - workingGroup:(ZMSDispatchGroup * _Nullable)workingGroup - application:(id)application - minTLSVersion:(NSString * _Nullable)minTLSVersion - blacklistCallback:(void (^)(BOOL))blacklistCallback; - -- (void)tearDown; - -@end - -NS_ASSUME_NONNULL_END diff --git a/wire-ios-sync-engine/Source/UserSession/ZMBlacklistVerificator.m b/wire-ios-sync-engine/Source/UserSession/ZMBlacklistVerificator.m deleted file mode 100644 index 7c9b966910a..00000000000 --- a/wire-ios-sync-engine/Source/UserSession/ZMBlacklistVerificator.m +++ /dev/null @@ -1,105 +0,0 @@ -// -// Wire -// Copyright (C) 2025 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 WireSystem; -@import WireTransport; - -#import "ZMBlacklistVerificator+Testing.h" -#import "ZMBlacklistDownloader.h" - -@interface ZMBlacklistVerificator () -@property (nonatomic) ZMBlacklistDownloader *downloader; -@end - -@implementation ZMBlacklistVerificator - -- (instancetype)initWithCheckInterval:(NSTimeInterval)checkInterval - version:(NSString *)version - environment:(id)environment - proxyUsername:(NSString *)proxyUsername - proxyPassword:(NSString *)proxyPassword - readyForRequests:(BOOL)readyForRequests - workingGroup:(ZMSDispatchGroup * _Nullable)workingGroup - application:(id)application - minTLSVersion:(NSString * _Nullable)minTLSVersion - blacklistCallback:(void (^)(BOOL))blacklistCallback -{ - return [self initWithCheckInterval:checkInterval - version:version - environment:environment - proxyUsername:proxyUsername - proxyPassword:proxyPassword - readyForRequests:readyForRequests - workingGroup:workingGroup - application:application - minTLSVersion:minTLSVersion - blacklistCallback:blacklistCallback - blacklistClass:ZMBlacklistDownloader.class]; -} - -- (instancetype)initWithCheckInterval:(NSTimeInterval)checkInterval - version:(NSString *)version - environment:(id)environment - proxyUsername:(NSString *)proxyUsername - proxyPassword:(NSString *)proxyPassword - readyForRequests:(BOOL)readyForRequests - workingGroup:(ZMSDispatchGroup *)workingGroup - application:(id)application - minTLSVersion:(NSString * _Nullable)minTLSVersion - blacklistCallback:(void (^)(BOOL))blacklistCallback - blacklistClass:(Class)blacklistClass -{ - self = [super init]; - if(self) { - self.downloader = [[blacklistClass alloc] initWithDownloadInterval:checkInterval - environment:environment - proxyUsername:proxyUsername - proxyPassword:proxyPassword - readyForRequests:readyForRequests - workingGroup:workingGroup - application:application - minTLSVersion:minTLSVersion - completionHandler:^(NSString *minVersion, NSArray *excludedVersions) { - [ZMBlacklistVerificator checkIfVersionIsBlacklisted:version completion:blacklistCallback minVersion:minVersion excludedVersions:excludedVersions]; - }]; - } - return self; -} - -+ (void)checkIfVersionIsBlacklisted:(NSString *)version completion:(void (^)(BOOL))completion minVersion:(NSString *)minVersion excludedVersions:(NSArray *)excludedVersions -{ - if (completion) { - if ([version compare:minVersion - options:NSNumericSearch - range:NSMakeRange(0, version.length) - locale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]] == NSOrderedAscending || - [excludedVersions containsObject:version]) { - completion(YES); - } - else { - completion(NO); - } - } -} - -- (void)tearDown -{ - [self.downloader tearDown]; -} - -@end diff --git a/wire-ios-sync-engine/Tests/Source/UserSession/ZMBlacklistDownloaderTest.m b/wire-ios-sync-engine/Tests/Source/UserSession/ZMBlacklistDownloaderTest.m deleted file mode 100644 index 2b69da519a6..00000000000 --- a/wire-ios-sync-engine/Tests/Source/UserSession/ZMBlacklistDownloaderTest.m +++ /dev/null @@ -1,296 +0,0 @@ -// -// Wire -// Copyright (C) 2025 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 OCMock; -@import WireTransport; -@import UIKit; - -#import "MessagingTest.h" -#import "ZMBlacklistDownloader+Testing.h" -#import "Tests-Swift.h" - -@interface ZMBlacklistDownloaderTest : MessagingTest - -@property (nonatomic) id URLSession; -@property (nonatomic) NSTimeInterval successCheckTimeInterval; -@property (nonatomic) NSTimeInterval failureCheckTimeInterval; -@property (nonatomic) ZMBlacklistDownloader *sut; - -@end - -@implementation ZMBlacklistDownloaderTest - -- (void)setUp { - - [super setUp]; - - [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"min_version"]; - [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"exclude"]; - [[NSUserDefaults standardUserDefaults] synchronize]; - self.successCheckTimeInterval = 30000; - self.failureCheckTimeInterval = 4000; - - self.URLSession = [OCMockObject niceMockForClass:[NSURLSession class]]; -} - -- (void)createSUTWithCompletionHandler:(void (^)(NSString *minVersion, NSArray *excludedVersions))completionHandler - -{ - self.sut = [[ZMBlacklistDownloader alloc] initWithURLSession:self.URLSession - environment:[[MockEnvironment alloc] init] - proxyUsername:nil - proxyPassword:nil - readyForRequests:true - successCheckInterval:self.successCheckTimeInterval failureCheckInterval:self.failureCheckTimeInterval - userDefaults:[NSUserDefaults standardUserDefaults] - application:self.application - workingGroup:self.syncMOC.dispatchGroup - minTLSVersion:nil - completionHandler:completionHandler - ]; -} - -- (void)stopTimers -{ - [self.sut tearDown]; - WaitForAllGroupsToBeEmpty(0.5); -} - -- (void)tearDown -{ - self.sut = nil; - [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"min_version"]; - [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"exclude"]; - [[NSUserDefaults standardUserDefaults] synchronize]; - WaitForAllGroupsToBeEmpty(0.5); - [super tearDown]; -} - -- (void)simulateCachedValuesForMinVersion:(NSString *)minVersion excluded:(NSArray *)excluded -{ - [[NSUserDefaults standardUserDefaults] setObject:minVersion forKey:@"min_version"]; - [[NSUserDefaults standardUserDefaults] setObject:excluded forKey:@"exclude"]; - [[NSUserDefaults standardUserDefaults] synchronize]; -} - -- (NSData *)blackListDataForObject:(id)object -{ - NSError *error; - NSData *data = [NSJSONSerialization dataWithJSONObject:object options:0 error:&error]; - if (error != nil) { - NSLog(@"%@", error); - } - return data; -} - -- (id)validBlackListWithMinimumVersion:(NSString *)minVersion exclude:(NSArray *)exclude -{ - return @{@"min_version": minVersion, @"exclude": exclude}; -} - -- (id)invalidBlackList -{ - return @{@"a": @[@1, @2], @"b": @3 }; -} - -- (id)invalidTypeBlackList -{ - return @{@"min_version": @1234, @"exclude": @[@1, @2, @3] }; -} - -- (void)stubRequest:(NSURLRequest *)request withResponseData:(NSData *)responseData responseError:(NSError *)responseError HTTPStatusCode:(NSUInteger)statusCode; -{ - __block void (^completionHandler)(NSData *data, NSURLResponse *response, NSError *error); - - NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:request.URL statusCode:(int)statusCode HTTPVersion:@"1.1" headerFields:@{}]; - id taskMock = [OCMockObject niceMockForClass:NSURLSessionDataTask.class]; - [[[(id) self.URLSession stub] andReturn:taskMock] dataTaskWithRequest:request completionHandler:[OCMArg checkWithBlock:^BOOL(id obj) { - completionHandler = [obj copy]; - return YES; - }]]; - - void(^resume)(NSInvocation *) = ^(NSInvocation * ZM_UNUSED i){ - completionHandler(responseData, response, responseError); - }; - - [(NSURLSessionDataTask *)[[taskMock stub] andDo:resume] resume]; -} - -- (void)stubRequestWithResponseObject:(id)object responseError:(NSError *)responseError statusCode:(NSUInteger)statusCode; -{ - NSData *data; - if ([object isKindOfClass:[NSDictionary class]]) { - data = [self blackListDataForObject:object]; - } - else { - data = object; - } - - id env = [[MockEnvironment alloc] init]; - NSURL *url = [env.blackListURL URLByAppendingPathComponent:@"ios"]; - [self stubRequest:[NSURLRequest requestWithURL:url] withResponseData:data responseError:responseError HTTPStatusCode:statusCode]; -} - -- (void)stubRequestWithSuccessfulResponseObject:(id)object -{ - [self stubRequestWithResponseObject:object responseError:nil statusCode:200]; -} - -- (void)testItReturnsBlackListWhenThereIsNoError; -{ - [self performIgnoringZMLogError:^{ - // given - NSString *expectedMinVersion = @"1"; - NSArray *expectedExclude = @[@"123", @"124"]; - id blackList = [self validBlackListWithMinimumVersion:expectedMinVersion exclude:expectedExclude]; - [self stubRequestWithSuccessfulResponseObject:blackList]; - - XCTestExpectation *didComplete = [self customExpectationWithDescription:@"did complete"]; - - // when - [self createSUTWithCompletionHandler:^(NSString *minVersion, NSArray *excludeVersions) { - XCTAssertEqualObjects(minVersion, expectedMinVersion); - XCTAssertEqualObjects(excludeVersions, expectedExclude); - [didComplete fulfill]; - }]; - - // then - XCTAssert([self waitForCustomExpectationsWithTimeout:0.5]); - [self stopTimers]; - }]; -} - -- (void)testItReturnsNilWhenThePropertyListHasTheWrongFormat -{ - // given - id json = [self invalidBlackList]; - // when - Blacklist *blacklist = [[Blacklist alloc] initWithJson:json]; - // then - XCTAssertNil(blacklist); -} - -- (void)testItReturnsNilWhenThePropertyListHasTheWrongFormat_WrongType -{ - // given - id json = [self invalidTypeBlackList]; - // when - Blacklist *blacklist = [[Blacklist alloc] initWithJson:json]; - // then - XCTAssertNil(blacklist); -} - -- (void)testThatItDownloadsAgainAfterCheckInterval -{ - [self performIgnoringZMLogError:^{ - - // given - self.successCheckTimeInterval = 0.1f; - NSString *expectedMinVersion = @"1"; - NSArray *expectedExclude = @[@"123", @"124"]; - id blackList = [self validBlackListWithMinimumVersion:expectedMinVersion exclude:expectedExclude]; - [self stubRequestWithSuccessfulResponseObject:blackList]; - - //expect that method will be called for second time after check interval - XCTestExpectation *exp = [self customExpectationWithDescription:@"download called again"]; - __block NSUInteger timesCalled = 0; - ZM_WEAK(self); - dispatch_block_t didDownload = ^{ - ZM_STRONG(self); - [self stubRequestWithSuccessfulResponseObject:blackList]; - ++timesCalled; - if (timesCalled == 3) { - [exp fulfill]; - } - }; - - // when - [self createSUTWithCompletionHandler:^(__unused NSString *minVersion, __unused NSArray *excludeVersions) { - didDownload(); - }]; - - // then - XCTAssert([self waitForCustomExpectationsWithTimeout:0.5]); - [self stopTimers]; - }]; -} - -typedef NS_ENUM(int, TestPhase) { - WaitForFirstCall, - Suspended, - Resumed -}; - -- (void)testThatItSuspendsWhenInTheBackgroundThenResumes -{ - [self performIgnoringZMLogError:^{ - // given - __block TestPhase phase = WaitForFirstCall; - self.successCheckTimeInterval = 0.1f; - NSString *expectedMinVersion = @"1"; - NSArray *expectedExclude = @[@"123", @"124"]; - id blackList = [self validBlackListWithMinimumVersion:expectedMinVersion exclude:expectedExclude]; - [self stubRequestWithSuccessfulResponseObject:blackList]; - - //expect that method will be called for second time after check interval - XCTestExpectation *doneExp = [self customExpectationWithDescription:@"download called again"]; - - __block NSUInteger downloadWhileSuspendedCount = 0; - __block NSUInteger downloadWhileResumedCount = 0; - dispatch_block_t didDownload = ^{ - [self stubRequestWithSuccessfulResponseObject:blackList]; - - // suspend after first call - if(phase == WaitForFirstCall) { - phase = Suspended; - [self.application simulateApplicationWillResignActive]; - - // make it restart after a while - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - phase = Resumed; - [self.application simulateApplicationDidBecomeActive]; - }); - } - // because of a race condition, might be called a couple of times even when suspended - else if(phase == Suspended) { - ++downloadWhileSuspendedCount; - XCTAssertLessThan(downloadWhileSuspendedCount, 3u); - } - // when resuming, and it is firing a few more times, test is done - else if(phase == Resumed) { - ++downloadWhileResumedCount; - if(downloadWhileResumedCount > 2) { - [doneExp fulfill]; - self.successCheckTimeInterval = 1.0f; - } - } - }; - - // when - [self createSUTWithCompletionHandler:^(__unused NSString *minVersion, __unused NSArray *excludeVersions) { - didDownload(); - }]; - - // then - XCTAssert([self waitForCustomExpectationsWithTimeout:1]); - [self stopTimers]; - }]; -} - - -@end diff --git a/wire-ios-sync-engine/Tests/Source/UserSession/ZMBlacklistVerificatorTest.m b/wire-ios-sync-engine/Tests/Source/UserSession/ZMBlacklistVerificatorTest.m deleted file mode 100644 index 21abeb45341..00000000000 --- a/wire-ios-sync-engine/Tests/Source/UserSession/ZMBlacklistVerificatorTest.m +++ /dev/null @@ -1,146 +0,0 @@ -// -// Wire -// Copyright (C) 2025 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 "MessagingTest.h" -#import "ZMBlacklistDownloader.h" -#import "ZMBlacklistVerificator+Testing.h" -#import "Tests-Swift.h" - -@import WireTransport; - -@class MockBlacklistDownloader; -static MockBlacklistDownloader *generatedDownloader; - -@interface ZMBlacklistVerificatorTest : MessagingTest -@end - - -@interface MockBlacklistDownloader : NSObject - -@property (nonatomic) NSTimeInterval downloadInterval; -@property (nonatomic, copy) void (^completionHandler)(NSString *, NSArray *); - -@end - - -@implementation MockBlacklistDownloader - -- (instancetype)initWithDownloadInterval:(NSTimeInterval)downloadInterval - environment:(id)environment - proxyUsername:(NSString *)proxyUsername - proxyPassword:(NSString *)proxyPassword - readyForRequests:(BOOL)readyForRequests - workingGroup:(ZMSDispatchGroup * __unused)group - application:(id)application - minTLSVersion:(NSString * _Nullable)minTLSVersion - completionHandler:(void (^)(NSString *minVersion, NSArray *excludedVersions))completionHandler { - self = [super init]; - if(self) { - NOT_USED(application); - NOT_USED(environment); - NOT_USED(proxyUsername); - NOT_USED(proxyPassword); - NOT_USED(readyForRequests); - NOT_USED(minTLSVersion); - generatedDownloader = self; - self.downloadInterval = downloadInterval; - self.completionHandler = completionHandler; - } - return self; -} - -@end - - -@implementation ZMBlacklistVerificatorTest - -- (void)setUp -{ - [super setUp]; - generatedDownloader = nil; -} - -- (void)tearDown -{ - generatedDownloader = nil; - [super tearDown]; -} - -- (BOOL)checkVersion:(NSString *)version againstMinVersion:(NSString *)minVersion andExcludedVersions:(NSArray *)excludedVersions -{ - __block BOOL verificationResult = NO; - XCTestExpectation *expectation = [self customExpectationWithDescription:@"Completion handler called"]; - ZMBlacklistVerificator * sut = [[ZMBlacklistVerificator alloc] initWithCheckInterval:1000 - version:version - environment:[[MockEnvironment alloc] init] - proxyUsername:nil - proxyPassword:nil - readyForRequests:YES - workingGroup:self.syncMOC.dispatchGroup - application:self.application - minTLSVersion:nil - blacklistCallback:^(BOOL result) { - verificationResult = result; - [expectation fulfill]; - } blacklistClass:MockBlacklistDownloader.class]; - - XCTAssertNotNil(sut); - XCTAssertNotNil(generatedDownloader.completionHandler); - if(generatedDownloader.completionHandler == nil) { - return NO; - } - generatedDownloader.completionHandler(minVersion, excludedVersions); - XCTAssertTrue([self waitForCustomExpectationsWithTimeout:0.2]); - generatedDownloader = nil; - return verificationResult; -} - -- (void)testVersionStringsAreComparedInNumericOrder -{ - XCTAssertTrue([self checkVersion:@"11" againstMinVersion:@"111" andExcludedVersions:nil]); - XCTAssertFalse([self checkVersion:@"111" againstMinVersion:@"111" andExcludedVersions:nil]); - XCTAssertFalse([self checkVersion:@"112" againstMinVersion:@"111" andExcludedVersions:nil]); - XCTAssertFalse([self checkVersion:@"1111" againstMinVersion:@"111" andExcludedVersions:nil]); - XCTAssertTrue([self checkVersion:@"1.1" againstMinVersion:@"1.1.1" andExcludedVersions:nil]); - XCTAssertTrue([self checkVersion:@"1.1.0" againstMinVersion:@"1.1.1" andExcludedVersions:nil]); - XCTAssertFalse([self checkVersion:@"1.1.1" againstMinVersion:@"1.1.1" andExcludedVersions:nil]); - XCTAssertFalse([self checkVersion:@"1.1.2" againstMinVersion:@"1.1.1" andExcludedVersions:nil]); - - XCTAssertTrue([self checkVersion:@"1.0.1" againstMinVersion:@"1.1.1" andExcludedVersions:nil]); - XCTAssertFalse([self checkVersion:@"1.2.1" againstMinVersion:@"1.1.1" andExcludedVersions:nil]); - - NSArray *versionsWith11 = @[@"abc",@"11",@"fg"]; - NSArray *versionsWithout11 = @[@"111",@"1"]; - NSArray *versionWith11 = @[@"11"]; - NSArray *empty = @[]; - // excluded versions - XCTAssertFalse([self checkVersion:@"11" againstMinVersion:nil andExcludedVersions:versionsWithout11]); - XCTAssertTrue([self checkVersion:@"11" againstMinVersion:nil andExcludedVersions:versionsWith11]); - XCTAssertTrue([self checkVersion:@"11" againstMinVersion:nil andExcludedVersions:versionWith11]); - XCTAssertFalse([self checkVersion:@"11" againstMinVersion:nil andExcludedVersions:empty]); - - // excluded version and min version - XCTAssertFalse([self checkVersion:@"11" againstMinVersion:@"1" andExcludedVersions:versionsWithout11]); - XCTAssertTrue([self checkVersion:@"11" againstMinVersion:@"1" andExcludedVersions:versionsWith11]); - XCTAssertTrue([self checkVersion:@"11" againstMinVersion:@"1" andExcludedVersions:versionWith11]); - XCTAssertFalse([self checkVersion:@"11" againstMinVersion:@"1" andExcludedVersions:empty]); - XCTAssertTrue([self checkVersion:@"11" againstMinVersion:@"20" andExcludedVersions:versionsWithout11]); -} - - -@end diff --git a/wire-ios-sync-engine/WireSyncEngine.xcodeproj/project.pbxproj b/wire-ios-sync-engine/WireSyncEngine.xcodeproj/project.pbxproj index ad7e8d1b0ca..efcb43d9df9 100644 --- a/wire-ios-sync-engine/WireSyncEngine.xcodeproj/project.pbxproj +++ b/wire-ios-sync-engine/WireSyncEngine.xcodeproj/project.pbxproj @@ -48,7 +48,6 @@ 09BA924C1BD55FA5000DC962 /* UserClientRequestStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0920833C1BA84F3100F82B29 /* UserClientRequestStrategyTests.swift */; }; 09C77C531BA6C77000E2163F /* UserClientRequestStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09C77C521BA6C77000E2163F /* UserClientRequestStrategy.swift */; }; 160195611E30C9CF00ACBFAC /* LocalNotificationDispatcherCallingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 160195601E30C9CF00ACBFAC /* LocalNotificationDispatcherCallingTests.swift */; }; - 1602B4611F3B04150061C135 /* ZMBlacklistVerificator.h in Headers */ = {isa = PBXBuildFile; fileRef = F9FD798B19EE9B9A00D70FCD /* ZMBlacklistVerificator.h */; settings = {ATTRIBUTES = (Public, ); }; }; 16030DC921B01B7500F8032E /* Conversation+ReadReceiptMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16030DC821B01B7500F8032E /* Conversation+ReadReceiptMode.swift */; }; 16085B331F71811A000B9F22 /* UserChangeInfo+UserSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16085B321F71811A000B9F22 /* UserChangeInfo+UserSession.swift */; }; 160C31271E6434500012E4BC /* OperationStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 160C31261E6434500012E4BC /* OperationStatus.swift */; }; @@ -183,9 +182,7 @@ 3E2713211A8A68BF008EE50F /* Push.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 3E27131C1A8A68BF008EE50F /* Push.stringsdict */; }; 3E288A6C19C859210031CFCE /* NotificationObservers.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E288A6A19C859210031CFCE /* NotificationObservers.m */; }; 3E9848BD1A65253000F7B050 /* Hack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E9848BC1A65253000F7B050 /* Hack.swift */; }; - 3ED972FB1A0A65D800BAFC61 /* ZMBlacklistVerificatorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F9F11A061A0A630900F1DCEE /* ZMBlacklistVerificatorTest.m */; }; 54034F381BB1A6D900F4ED62 /* ZMUserSession+Logs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54034F371BB1A6D900F4ED62 /* ZMUserSession+Logs.swift */; }; - 540818A61BCA647D00257CA7 /* ZMBlacklistVerificator+Testing.h in Headers */ = {isa = PBXBuildFile; fileRef = 540818A51BCA647D00257CA7 /* ZMBlacklistVerificator+Testing.h */; }; 540A0BA51954859E00FB7D61 /* ZMSyncStrategyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 85D85104C6D06FA902E3253C /* ZMSyncStrategyTests.m */; }; 541228451AEE422C00D9ED1C /* ZMAuthenticationStatusTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 541228431AEE422C00D9ED1C /* ZMAuthenticationStatusTests.m */; }; 54131BC625C7F71400CE2CA2 /* LoginDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54131BC525C7F71400CE2CA2 /* LoginDelegate.swift */; }; @@ -221,8 +218,6 @@ 549710081F6FF5C100026EDD /* NotificationInContext+UserSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 549710071F6FF5C100026EDD /* NotificationInContext+UserSession.swift */; }; 5497100A1F6FFE9900026EDD /* ClientUpdateNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 549710091F6FFE9900026EDD /* ClientUpdateNotification.swift */; }; 54973A361DD48CAB007F8702 /* NSManagedObject+CryptoStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54973A351DD48CAB007F8702 /* NSManagedObject+CryptoStack.swift */; }; - 549815CD1A432BC700A7CE2E /* ZMBlacklistDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = F9FD798619EE742600D70FCD /* ZMBlacklistDownloader.m */; }; - 549815CE1A432BC700A7CE2E /* ZMBlacklistVerificator.m in Sources */ = {isa = PBXBuildFile; fileRef = F9FD798C19EE9B9A00D70FCD /* ZMBlacklistVerificator.m */; }; 549815DC1A432BC700A7CE2E /* NSError+ZMUserSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E05F253192A50CC00F22D80 /* NSError+ZMUserSession.m */; }; 5498162D1A432BC800A7CE2E /* ZMMissingUpdateEventsTranscoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 54F8D6E519AB535700146664 /* ZMMissingUpdateEventsTranscoder.m */; }; 5498162E1A432BC800A7CE2E /* ZMLastUpdateEventIDTranscoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 5427B34E19D195A100CC18DC /* ZMLastUpdateEventIDTranscoder.m */; }; @@ -244,7 +239,6 @@ 54E2C1E01E682DC400536569 /* LocalNotificationDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54E2C1DF1E682DC400536569 /* LocalNotificationDispatcher.swift */; }; 54F0A0951B3018D7003386BC /* ProxiedRequestsStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54F0A0931B3018D7003386BC /* ProxiedRequestsStatus.swift */; }; 54F4DC5A1A4438B300FDB6EA /* WireSyncEngine.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 549815931A43232400A7CE2E /* WireSyncEngine.framework */; }; - 54FEAAA91BC7BB9C002DE521 /* ZMBlacklistDownloader+Testing.h in Headers */ = {isa = PBXBuildFile; fileRef = 54FEAAA81BC7BB9C002DE521 /* ZMBlacklistDownloader+Testing.h */; }; 54FF64291F73D00C00787EF2 /* NSManagedObjectContext+AuthenticationStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54FF64281F73D00C00787EF2 /* NSManagedObjectContext+AuthenticationStatus.swift */; }; 554FEE2122AFF20600B1A8A1 /* ZMUserSession+LegalHold.swift in Sources */ = {isa = PBXBuildFile; fileRef = 554FEE2022AFF20600B1A8A1 /* ZMUserSession+LegalHold.swift */; }; 591B6E102C8B0926009F8A7B /* WireMockTransport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE668BB92954AA9300D939E7 /* WireMockTransport.framework */; }; @@ -352,7 +346,6 @@ 8754B84A1F73C25400EC02AD /* ConversationListChangeInfo+UserSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8754B8491F73C25400EC02AD /* ConversationListChangeInfo+UserSession.swift */; }; 8754B84C1F73C38900EC02AD /* MessageChangeInfo+UserSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8754B84B1F73C38900EC02AD /* MessageChangeInfo+UserSession.swift */; }; 8766853C1F2A1AA00031081B /* UnauthenticatedSessionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8766853A1F2A1A860031081B /* UnauthenticatedSessionTests.swift */; }; - 878ACB4620ADBBAA0016E68A /* Blacklist.swift in Sources */ = {isa = PBXBuildFile; fileRef = 878ACB4520ADBBAA0016E68A /* Blacklist.swift */; }; 879634401F7BEA4700FC79BA /* DispatchQueue+SerialAsync.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8796343F1F7BEA4700FC79BA /* DispatchQueue+SerialAsync.swift */; }; 879634421F7BEC5100FC79BA /* DispatchQueueSerialAsyncTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 879634411F7BEC5100FC79BA /* DispatchQueueSerialAsyncTests.swift */; }; 8798607B1C3D48A400218A3E /* DeleteAccountRequestStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8798607A1C3D48A400218A3E /* DeleteAccountRequestStrategy.swift */; }; @@ -426,7 +419,6 @@ EE01E0371F90DD67001AA33C /* audio.m4a in Resources */ = {isa = PBXBuildFile; fileRef = EE01E0361F90DABC001AA33C /* audio.m4a */; }; EE01E0391F90FEC1001AA33C /* ZMLocalNotificationTests_ExpiredMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE01E0381F90FEC1001AA33C /* ZMLocalNotificationTests_ExpiredMessage.swift */; }; EE0CAEAF2AAF2E8E00BD2DB7 /* URLSession+MinTLSVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0CAEAE2AAF2E8E00BD2DB7 /* URLSession+MinTLSVersion.swift */; }; - EE0CAEB12AAF306000BD2DB7 /* ZMBlacklistDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = F9FD798519EE742600D70FCD /* ZMBlacklistDownloader.h */; }; EE1108F923D1F945005DC663 /* TypingUsersTimeout.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE1108F823D1F945005DC663 /* TypingUsersTimeout.swift */; }; EE1108FB23D2087F005DC663 /* Typing.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE1108FA23D2087F005DC663 /* Typing.swift */; }; EE13BD8B2BC948FC006561F8 /* ZMUserSession+APIAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE13BD8A2BC948FC006561F8 /* ZMUserSession+APIAdapter.swift */; }; @@ -541,7 +533,6 @@ F9B171F61C0EF21100E6EEC6 /* ClientUpdateStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9B171F51C0EF21100E6EEC6 /* ClientUpdateStatus.swift */; }; F9B171F81C0F00E700E6EEC6 /* ClientUpdateStatusTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9B171F71C0F00E700E6EEC6 /* ClientUpdateStatusTests.swift */; }; F9B71F4C1CB2B841001DB03F /* NSManagedObjectContext+TestHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = F9B71F4B1CB2B841001DB03F /* NSManagedObjectContext+TestHelpers.m */; }; - F9C598AD1A0947B300B1F760 /* ZMBlacklistDownloaderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F9FD798919EE962F00D70FCD /* ZMBlacklistDownloaderTest.m */; }; F9C9A4F01CAD29190039E10C /* store128.wiredatabase in Resources */ = {isa = PBXBuildFile; fileRef = F9C9A4ED1CAD290B0039E10C /* store128.wiredatabase */; }; F9D1CD141DF6C131002F6E80 /* SyncStatusTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9D1CD131DF6C131002F6E80 /* SyncStatusTests.swift */; }; F9E577211E77EC6D0065EFE4 /* WireCallCenterV3+Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9E577201E77EC6D0065EFE4 /* WireCallCenterV3+Notifications.swift */; }; @@ -775,7 +766,6 @@ 3E799CF2192140300020A438 /* WireSyncEngine-Tests.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WireSyncEngine-Tests.pch"; sourceTree = ""; }; 3E9848BC1A65253000F7B050 /* Hack.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Hack.swift; sourceTree = ""; }; 54034F371BB1A6D900F4ED62 /* ZMUserSession+Logs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ZMUserSession+Logs.swift"; sourceTree = ""; }; - 540818A51BCA647D00257CA7 /* ZMBlacklistVerificator+Testing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ZMBlacklistVerificator+Testing.h"; sourceTree = ""; }; 541228431AEE422C00D9ED1C /* ZMAuthenticationStatusTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZMAuthenticationStatusTests.m; sourceTree = ""; }; 54131BC525C7F71400CE2CA2 /* LoginDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginDelegate.swift; sourceTree = ""; }; 54131BCD25C7FFCA00CE2CA2 /* SessionManager+AuthenticationStatusDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SessionManager+AuthenticationStatusDelegate.swift"; sourceTree = ""; }; @@ -837,7 +827,6 @@ 54F8D6E519AB535700146664 /* ZMMissingUpdateEventsTranscoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ZMMissingUpdateEventsTranscoder.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 54F8D6E819AB535700146664 /* ZMSelfStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZMSelfStrategy.h; sourceTree = ""; }; 54F8D6E919AB535700146664 /* ZMSelfStrategy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZMSelfStrategy.m; sourceTree = ""; }; - 54FEAAA81BC7BB9C002DE521 /* ZMBlacklistDownloader+Testing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ZMBlacklistDownloader+Testing.h"; sourceTree = ""; }; 54FF64281F73D00C00787EF2 /* NSManagedObjectContext+AuthenticationStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+AuthenticationStatus.swift"; sourceTree = ""; }; 554FEE2022AFF20600B1A8A1 /* ZMUserSession+LegalHold.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ZMUserSession+LegalHold.swift"; sourceTree = ""; }; 59271BE72B908DAC0019B726 /* SecurityClassificationProviding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecurityClassificationProviding.swift; sourceTree = ""; }; @@ -936,7 +925,6 @@ 8754B8491F73C25400EC02AD /* ConversationListChangeInfo+UserSession.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ConversationListChangeInfo+UserSession.swift"; sourceTree = ""; }; 8754B84B1F73C38900EC02AD /* MessageChangeInfo+UserSession.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MessageChangeInfo+UserSession.swift"; sourceTree = ""; }; 8766853A1F2A1A860031081B /* UnauthenticatedSessionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnauthenticatedSessionTests.swift; sourceTree = ""; }; - 878ACB4520ADBBAA0016E68A /* Blacklist.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Blacklist.swift; sourceTree = ""; }; 8796343F1F7BEA4700FC79BA /* DispatchQueue+SerialAsync.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DispatchQueue+SerialAsync.swift"; sourceTree = ""; }; 879634411F7BEC5100FC79BA /* DispatchQueueSerialAsyncTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DispatchQueueSerialAsyncTests.swift; sourceTree = ""; }; 8798607A1C3D48A400218A3E /* DeleteAccountRequestStrategy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeleteAccountRequestStrategy.swift; sourceTree = ""; }; @@ -1200,15 +1188,9 @@ F9D1CD131DF6C131002F6E80 /* SyncStatusTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = SyncStatusTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; F9E3AB511BEA017300C1A6AA /* ZMSelfStrategy+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ZMSelfStrategy+Internal.h"; sourceTree = ""; }; F9E577201E77EC6D0065EFE4 /* WireCallCenterV3+Notifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "WireCallCenterV3+Notifications.swift"; sourceTree = ""; }; - F9F11A061A0A630900F1DCEE /* ZMBlacklistVerificatorTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZMBlacklistVerificatorTest.m; sourceTree = ""; }; F9F631411DE3524100416938 /* TypingStrategy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TypingStrategy.swift; sourceTree = ""; }; F9F846331ED307F10087C1A4 /* CallParticipantsSnapshotTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallParticipantsSnapshotTests.swift; sourceTree = ""; }; F9F9F5611D75D62100AE6499 /* RequestStrategyTestBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestStrategyTestBase.swift; sourceTree = ""; }; - F9FD798519EE742600D70FCD /* ZMBlacklistDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZMBlacklistDownloader.h; sourceTree = ""; }; - F9FD798619EE742600D70FCD /* ZMBlacklistDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZMBlacklistDownloader.m; sourceTree = ""; }; - F9FD798919EE962F00D70FCD /* ZMBlacklistDownloaderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZMBlacklistDownloaderTest.m; sourceTree = ""; }; - F9FD798B19EE9B9A00D70FCD /* ZMBlacklistVerificator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZMBlacklistVerificator.h; sourceTree = ""; }; - F9FD798C19EE9B9A00D70FCD /* ZMBlacklistVerificator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZMBlacklistVerificator.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ @@ -1770,8 +1752,6 @@ F19F4F4C1E646C3C00F4D8FF /* UserProfileImageUpdateStatusTests.swift */, 3E05F250192A4FBD00F22D80 /* UserSessionErrorTests.m */, A9692F881986476900849241 /* NSString_NormalizationTests.m */, - F9FD798919EE962F00D70FCD /* ZMBlacklistDownloaderTest.m */, - F9F11A061A0A630900F1DCEE /* ZMBlacklistVerificatorTest.m */, 54D784FD1A37248000F47798 /* ZMEncodedNSUUIDWithTimestampTests.m */, F9D1CD131DF6C131002F6E80 /* SyncStatusTests.swift */, 160C31491E82AC170012E4BC /* OperationStatusTests.swift */, @@ -1872,7 +1852,6 @@ children = ( 161ACB2B23F5B9E900ABFF33 /* URLActionProcessors */, 874A168E2052BE32001C6760 /* OpenConversationObserver */, - F9FD798019EE73C500D70FCD /* VersionBlacklist */, A9BABE5E19BA1EF300E9E5A3 /* Search */, 59271BE62B908D8C0019B726 /* SecurityClassification */, E6C983EF2B986B2900D55177 /* ZMUserSession */, @@ -2430,20 +2409,6 @@ name = "DB Ficture 1.28"; sourceTree = ""; }; - F9FD798019EE73C500D70FCD /* VersionBlacklist */ = { - isa = PBXGroup; - children = ( - F9FD798519EE742600D70FCD /* ZMBlacklistDownloader.h */, - 54FEAAA81BC7BB9C002DE521 /* ZMBlacklistDownloader+Testing.h */, - F9FD798619EE742600D70FCD /* ZMBlacklistDownloader.m */, - 878ACB4520ADBBAA0016E68A /* Blacklist.swift */, - F9FD798B19EE9B9A00D70FCD /* ZMBlacklistVerificator.h */, - 540818A51BCA647D00257CA7 /* ZMBlacklistVerificator+Testing.h */, - F9FD798C19EE9B9A00D70FCD /* ZMBlacklistVerificator.m */, - ); - name = VersionBlacklist; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -2465,16 +2430,12 @@ 872A2EFE2004B86D00900B22 /* ZMSyncStrategy.h in Headers */, 166E47D1255EC03E00C161C8 /* ZMSelfStrategy.h in Headers */, F19F1D311EFBCBD300275E27 /* ZMLoginTranscoder.h in Headers */, - 1602B4611F3B04150061C135 /* ZMBlacklistVerificator.h in Headers */, 5430E9251BAA0D9F00395E05 /* WireSyncEngineLogs.h in Headers */, 06DE14CF24B85CA0006CB6B3 /* ZMClientRegistrationStatusDelegate.h in Headers */, 09531F161AE960E300B8556A /* ZMLoginCodeRequestTranscoder.h in Headers */, - EE0CAEB12AAF306000BD2DB7 /* ZMBlacklistDownloader.h in Headers */, 544BA1271A433DE400D3B852 /* NSError+ZMUserSession.h in Headers */, 16ED865B23E2EE3C00CB1766 /* ZMMissingUpdateEventsTranscoder.h in Headers */, - 540818A61BCA647D00257CA7 /* ZMBlacklistVerificator+Testing.h in Headers */, 54A3F24F1C08523500FE3A6B /* ZMOperationLoop.h in Headers */, - 54FEAAA91BC7BB9C002DE521 /* ZMBlacklistDownloader+Testing.h in Headers */, 166E47CF255E8B2200C161C8 /* ZMLastUpdateEventIDTranscoder.h in Headers */, F19F1D1D1EFBC2F000275E27 /* ZMAuthenticationStatus_Internal.h in Headers */, F96DBEEA1DF9A570008FE832 /* ZMSyncStrategy+ManagedObjectChanges.h in Headers */, @@ -2890,7 +2851,6 @@ F9F846351ED307F70087C1A4 /* CallParticipantsSnapshotTests.swift in Sources */, 1673C35324CB36D800AE2714 /* ZMUserSessionTests+EncryptionAtRest.swift in Sources */, 54DE9BEF1DE760A900EFFB9C /* RandomHandleGeneratorTests.swift in Sources */, - F9C598AD1A0947B300B1F760 /* ZMBlacklistDownloaderTest.m in Sources */, 1672A653234784B500380537 /* LabelDownstreamRequestStrategyTests.swift in Sources */, 874A16942052C64B001C6760 /* UserExpirationObserverTests.swift in Sources */, 16A702D01E92998100B8410D /* ApplicationStatusDirectoryTests.swift in Sources */, @@ -2919,7 +2879,6 @@ EFC828221FB356CE00E27E21 /* RegistrationStatusTests.swift in Sources */, 163FB9942052EA4C00E74F83 /* OperationLoopNewRequestObserver.swift in Sources */, F9B171F81C0F00E700E6EEC6 /* ClientUpdateStatusTests.swift in Sources */, - 3ED972FB1A0A65D800BAFC61 /* ZMBlacklistVerificatorTest.m in Sources */, EECE27C6294362F100419A8B /* MockPushTokenService.swift in Sources */, 167BCB942603CC5B00E9D7E3 /* EventProcessorTests.swift in Sources */, 5463C897193F3C74006799DE /* ZMTimingTests.m in Sources */, @@ -2963,7 +2922,6 @@ 1660AA0B1ECCAF4E0056D403 /* SearchRequest.swift in Sources */, E6C983EE2B986ABA00D55177 /* ZMUserSession+UserSession.swift in Sources */, 0664F2E62A0E25C200E5C34E /* RecurringActionService.swift in Sources */, - 878ACB4620ADBBAA0016E68A /* Blacklist.swift in Sources */, 06ADE9E32BBFDF26008BA0B3 /* CertificateRevocationListsChecker.swift in Sources */, 166507812459D7CA005300C1 /* UserClientEventConsumer.swift in Sources */, F9E577211E77EC6D0065EFE4 /* WireCallCenterV3+Notifications.swift in Sources */, @@ -2993,8 +2951,6 @@ F1C1F3EE1FCF0C85007273E3 /* ZMUserSessionErrorCode+Localized.swift in Sources */, 63C5321F27FDB283009DFFF4 /* SyncStatus.swift in Sources */, E6425FE52BD005C0003EC8CF /* SessionManager+UserSessionLogoutDelegate.swift in Sources */, - 549815CD1A432BC700A7CE2E /* ZMBlacklistDownloader.m in Sources */, - 549815CE1A432BC700A7CE2E /* ZMBlacklistVerificator.m in Sources */, 16D9E8BA22BCD39200FA463F /* LegalHoldRequestStrategy.swift in Sources */, 164C29A71ED2D7B00026562A /* SearchResult.swift in Sources */, 1660AA091ECCAC900056D403 /* SearchDirectory.swift in Sources */, diff --git a/wire-ios/Wire-iOS/Generated/Strings+Generated.swift b/wire-ios/Wire-iOS/Generated/Strings+Generated.swift index c8e589e231f..b509a0d1b5a 100644 --- a/wire-ios/Wire-iOS/Generated/Strings+Generated.swift +++ b/wire-ios/Wire-iOS/Generated/Strings+Generated.swift @@ -1347,14 +1347,6 @@ internal enum L10n { } } } - internal enum BackendNotSupported { - internal enum Alert { - /// The server version is not supported by this app. Please contact your system administrator. - internal static let message = L10n.tr("Localizable", "backend_not_supported.alert.message", fallback: "The server version is not supported by this app. Please contact your system administrator.") - /// Server version not supported - internal static let title = L10n.tr("Localizable", "backend_not_supported.alert.title", fallback: "Server version not supported") - } - } internal enum ButtonMessageCell { /// Your answer can't be sent, please retry. internal static let genericError = L10n.tr("Localizable", "button_message_cell.generic_error", fallback: "Your answer can't be sent, please retry.") diff --git a/wire-ios/Wire-iOS/Resources/Localization/Base.lproj/Localizable.strings b/wire-ios/Wire-iOS/Resources/Localization/Base.lproj/Localizable.strings index d7dd5a430a4..207ed41ebb6 100644 --- a/wire-ios/Wire-iOS/Resources/Localization/Base.lproj/Localizable.strings +++ b/wire-ios/Wire-iOS/Resources/Localization/Base.lproj/Localizable.strings @@ -1841,10 +1841,6 @@ Enter your identity provider’s credentials in the next step to update the cert "databaseloadingfailure.alert.delete_database.continue" = "Continue"; "databaseloadingfailure.alert.retry" = "Retry"; -// Backend not supported alert -"backend_not_supported.alert.title" = "Server version not supported"; -"backend_not_supported.alert.message" = "The server version is not supported by this app. Please contact your system administrator."; - // Third Party "giphy.conversation.message" = "%@ · via giphy.com"; "giphy.conversation.random_message" = "via giphy.com"; diff --git a/wire-ios/Wire-iOS/Sources/UserInterface/Blacklist/BlockerViewController.swift b/wire-ios/Wire-iOS/Sources/UserInterface/Blacklist/BlockerViewController.swift index 56c6470ea63..8b6273182e5 100644 --- a/wire-ios/Wire-iOS/Sources/UserInterface/Blacklist/BlockerViewController.swift +++ b/wire-ios/Wire-iOS/Sources/UserInterface/Blacklist/BlockerViewController.swift @@ -64,14 +64,12 @@ final class BlockerViewController: LaunchImageViewController { func showAlert() { switch context { - case .blacklist where DeveloperFlag.multibackend.isOn: + case .blacklist: showClientObsoleteMessage() case .backendObsolete: showBackendObsoleteMessage() case .clientObsolete: showClientObsoleteMessage() - case .blacklist: - showBlacklistMessage() case .jailbroken: showJailbrokenMessage() case .databaseFailure: @@ -174,54 +172,22 @@ final class BlockerViewController: LaunchImageViewController { } private func showBackendObsoleteMessage() { - if DeveloperFlag.multibackend.isOn { - let alert = MultibackendAlertMainApp.obsoleteServer( - switchAccountAction: switchAccountAction, - logoutAction: handleLogout - ) - - present(alert, animated: true) - } else { - typealias BackendNotSupported = L10n.Localizable.BackendNotSupported.Alert + let alert = MultibackendAlertMainApp.obsoleteServer( + switchAccountAction: switchAccountAction, + logoutAction: handleLogout + ) - presentOKAlert( - title: BackendNotSupported.title, - message: BackendNotSupported.message - ) - } + present(alert, animated: true) } private func showClientObsoleteMessage() { - if DeveloperFlag.multibackend.isOn { - let alert = MultibackendAlertMainApp.obsoleteClient( - updateAction: { UIApplication.shared.open(WireURLs.shared.appOnItunes) }, - switchAccountAction: switchAccountAction, - logoutAction: handleLogout - ) - - present(alert, animated: true) - } else { - showBlacklistMessage() - } - } - - private func showBlacklistMessage() { - if DeveloperFlag.multibackend.isOn { - let alert = MultibackendAlertMainApp.obsoleteClient( - updateAction: { UIApplication.shared.open(WireURLs.shared.appOnItunes) }, - switchAccountAction: switchAccountAction, - logoutAction: handleLogout - ) + let alert = MultibackendAlertMainApp.obsoleteClient( + updateAction: { UIApplication.shared.open(WireURLs.shared.appOnItunes) }, + switchAccountAction: switchAccountAction, + logoutAction: handleLogout + ) - present(alert, animated: true) - } else { - presentOKAlert( - title: L10n.Localizable.Force.Update.title, - message: L10n.Localizable.Force.Update.message - ) { _ in - UIApplication.shared.open(WireURLs.shared.appOnItunes) - } - } + present(alert, animated: true) } private func showJailbrokenMessage() {