From b2503efcbbd32bad335fcc8ea02501c5619e4f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franc=CC=A7ois=20Benaiteau?= Date: Thu, 28 Nov 2024 08:49:13 +0100 Subject: [PATCH 1/4] chore: remove unused files --- .../Source/Model/User/ZMAddressBookContact.m | 98 ----------------- .../Source/Public/ZMAddressBookContact.h | 55 ---------- .../WireDataModel.xcodeproj/project.pbxproj | 9 -- .../Source/E2EE/ZMAPSMessageDecoder.h | 27 ----- .../Source/E2EE/ZMAPSMessageDecoder.m | 101 ----------------- .../WireSyncEngine.xcodeproj/project.pbxproj | 8 -- .../Source/Public/NSData+WireTesting.h | 35 ------ .../Source/Public/NSData+WireTesting.m | 103 ------------------ .../WireTesting.xcodeproj/project.pbxproj | 8 -- 9 files changed, 444 deletions(-) delete mode 100644 wire-ios-data-model/Source/Model/User/ZMAddressBookContact.m delete mode 100644 wire-ios-data-model/Source/Public/ZMAddressBookContact.h delete mode 100644 wire-ios-sync-engine/Source/E2EE/ZMAPSMessageDecoder.h delete mode 100644 wire-ios-sync-engine/Source/E2EE/ZMAPSMessageDecoder.m delete mode 100644 wire-ios-testing/Source/Public/NSData+WireTesting.h delete mode 100644 wire-ios-testing/Source/Public/NSData+WireTesting.m diff --git a/wire-ios-data-model/Source/Model/User/ZMAddressBookContact.m b/wire-ios-data-model/Source/Model/User/ZMAddressBookContact.m deleted file mode 100644 index ebb8149c4f6..00000000000 --- a/wire-ios-data-model/Source/Model/User/ZMAddressBookContact.m +++ /dev/null @@ -1,98 +0,0 @@ -// -// Wire -// Copyright (C) 2024 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 "ZMAddressBookContact.h" -#import "ZMUser.h" - -@implementation ZMAddressBookContact - -- (instancetype)init -{ - self = [super init]; - if (self) { - self.emailAddresses = @[]; - self.phoneNumbers = @[]; - } - return self; -} - -- (NSString *)name -{ - NSMutableArray *names = [NSMutableArray array]; - - if (self.firstName.length > 0) { - [names addObject:self.firstName]; - } - - if (self.middleName.length > 0) { - [names addObject:self.middleName]; - } - - if (self.lastName.length > 0) { - [names addObject:self.lastName]; - } - - if (names.count > 0) { - return [names componentsJoinedByString:@" "]; - } else if (self.organization) { - return self.organization; - } else if (self.nickname) { - return self.nickname; - } else if (self.emailAddresses.count > 0) { - return self.emailAddresses.firstObject; - } else if (self.phoneNumbers.count > 0) { - return self.phoneNumbers.firstObject; - } - return @""; -} - -- (NSString *)description; -{ - return [NSString stringWithFormat:@"<%@: %p> email: {%@}, phone: {%@}", - self.class, self, - [self.emailAddresses componentsJoinedByString:@"; "], - [self.phoneNumbers componentsJoinedByString:@"; "]]; -} - -- (NSArray *)contactDetails -{ - NSMutableArray *details = [NSMutableArray array]; - [details addObjectsFromArray:self.emailAddresses]; - [details addObjectsFromArray:self.phoneNumbers]; - return details; -} - -- (BOOL)isEqual:(id)object -{ - if(![object isKindOfClass:ZMAddressBookContact.class]) { - return false; - } - return [self isEqualToAddressBookContact:object]; -} - -- (BOOL)isEqualToAddressBookContact:(ZMAddressBookContact *)addressBookContact { - return [self.emailAddresses isEqualToArray:addressBookContact.emailAddresses] - && [self.phoneNumbers isEqualToArray:addressBookContact.phoneNumbers] - && [self.name isEqualToString:addressBookContact.name]; -} - -- (NSUInteger)hash { - return self.emailAddresses.hash ^ self.phoneNumbers.hash ^ self.name.hash; -} - -@end diff --git a/wire-ios-data-model/Source/Public/ZMAddressBookContact.h b/wire-ios-data-model/Source/Public/ZMAddressBookContact.h deleted file mode 100644 index a099b97d6e0..00000000000 --- a/wire-ios-data-model/Source/Public/ZMAddressBookContact.h +++ /dev/null @@ -1,55 +0,0 @@ -// -// Wire -// Copyright (C) 2024 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; - - -@class ZMConversation; - - -typedef NS_ENUM(int64_t, ZMInvitationStatus) { - ZMInvitationStatusNone = 0, - ZMInvitationStatusPending, // is being sent by BE - ZMInvitationStatusConnectionRequestSent, - ZMInvitationStatusSent, // is already sent by BE - ZMInvitationStatusFailed, // sending failed -}; - - -NS_ASSUME_NONNULL_BEGIN -@interface ZMAddressBookContact : NSObject - -@property (nonatomic, readonly) NSString *name; - -@property (nonatomic, copy, nullable) NSString *firstName; -@property (nonatomic, copy, nullable) NSString *middleName; -@property (nonatomic, copy, nullable) NSString *lastName; -@property (nonatomic, copy, nullable) NSString *nickname; -@property (nonatomic, copy, nullable) NSString *organization; -@property (nonatomic, copy, nullable) NSString *localIdentifier; - -@property (nonatomic, copy) NSArray *emailAddresses; -@property (nonatomic, copy) NSArray *rawPhoneNumbers; -@property (nonatomic, copy) NSArray *phoneNumbers; - -/// a list of contact field to send invitation to (currently its both phone numbers and emails) -@property (nonatomic, readonly) NSArray *contactDetails; - -@end - -NS_ASSUME_NONNULL_END diff --git a/wire-ios-data-model/WireDataModel.xcodeproj/project.pbxproj b/wire-ios-data-model/WireDataModel.xcodeproj/project.pbxproj index 7f6626af46e..55fb8038a27 100644 --- a/wire-ios-data-model/WireDataModel.xcodeproj/project.pbxproj +++ b/wire-ios-data-model/WireDataModel.xcodeproj/project.pbxproj @@ -753,7 +753,6 @@ F963E9861D9D485900098AD3 /* ZMClientMessageTests+Ephemeral.swift in Sources */ = {isa = PBXBuildFile; fileRef = F963E9841D9D47D100098AD3 /* ZMClientMessageTests+Ephemeral.swift */; }; F963E9931D9E9D1800098AD3 /* ZMAssetClientMessageTests+Ephemeral.swift in Sources */ = {isa = PBXBuildFile; fileRef = F963E9921D9E9D1800098AD3 /* ZMAssetClientMessageTests+Ephemeral.swift */; }; F991CE191CB55E95004D8465 /* ZMSearchUserTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F991CE181CB55E95004D8465 /* ZMSearchUserTests.m */; }; - F991CE1B1CB561B0004D8465 /* ZMAddressBookContact.m in Sources */ = {isa = PBXBuildFile; fileRef = F991CE1A1CB561B0004D8465 /* ZMAddressBookContact.m */; }; F99C5B8A1ED460E20049CCD7 /* TeamChangeInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = F99C5B891ED460E20049CCD7 /* TeamChangeInfo.swift */; }; F99C5B8C1ED466760049CCD7 /* TeamObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F99C5B8B1ED466760049CCD7 /* TeamObserverTests.swift */; }; F9A706501CAEE01D00C2F5FE /* NSManagedObjectContext+tests.h in Headers */ = {isa = PBXBuildFile; fileRef = F9A705CA1CAEE01D00C2F5FE /* NSManagedObjectContext+tests.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -861,7 +860,6 @@ F9C9A6AD1CAD7C7F0039E10C /* ZMMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = F9C9A6A61CAD7C7F0039E10C /* ZMMessage.h */; settings = {ATTRIBUTES = (Public, ); }; }; F9C9A6AE1CAD7C7F0039E10C /* ZMUser.h in Headers */ = {isa = PBXBuildFile; fileRef = F9C9A6A71CAD7C7F0039E10C /* ZMUser.h */; settings = {ATTRIBUTES = (Public, ); }; }; F9C9A6B01CAD7D1F0039E10C /* ZMManagedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = F9C9A6AF1CAD7D1F0039E10C /* ZMManagedObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F9C9A7661CAE8DFC0039E10C /* ZMAddressBookContact.h in Headers */ = {isa = PBXBuildFile; fileRef = F9C9A7641CAE8DFC0039E10C /* ZMAddressBookContact.h */; settings = {ATTRIBUTES = (Public, ); }; }; F9DBA5201E28EA8B00BE23C0 /* DependencyKeyStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9DBA51F1E28EA8B00BE23C0 /* DependencyKeyStore.swift */; }; F9DBA5221E28EB4000BE23C0 /* SideEffectSources.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9DBA5211E28EB4000BE23C0 /* SideEffectSources.swift */; }; F9DBA5251E28EE1500BE23C0 /* ConversationObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9DBA5231E28EE0A00BE23C0 /* ConversationObserverTests.swift */; }; @@ -1699,7 +1697,6 @@ F963E9921D9E9D1800098AD3 /* ZMAssetClientMessageTests+Ephemeral.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ZMAssetClientMessageTests+Ephemeral.swift"; sourceTree = ""; }; F991CE101CB5549D004D8465 /* ZMConversation+Testing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ZMConversation+Testing.h"; sourceTree = ""; }; F991CE181CB55E95004D8465 /* ZMSearchUserTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZMSearchUserTests.m; sourceTree = ""; }; - F991CE1A1CB561B0004D8465 /* ZMAddressBookContact.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZMAddressBookContact.m; sourceTree = ""; }; F99C5B891ED460E20049CCD7 /* TeamChangeInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TeamChangeInfo.swift; sourceTree = ""; }; F99C5B8B1ED466760049CCD7 /* TeamObserverTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TeamObserverTests.swift; sourceTree = ""; }; F9A705CA1CAEE01D00C2F5FE /* NSManagedObjectContext+tests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSManagedObjectContext+tests.h"; sourceTree = ""; }; @@ -1833,7 +1830,6 @@ F9C9A6A61CAD7C7F0039E10C /* ZMMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZMMessage.h; sourceTree = ""; }; F9C9A6A71CAD7C7F0039E10C /* ZMUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZMUser.h; sourceTree = ""; }; F9C9A6AF1CAD7D1F0039E10C /* ZMManagedObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZMManagedObject.h; sourceTree = ""; }; - F9C9A7641CAE8DFC0039E10C /* ZMAddressBookContact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZMAddressBookContact.h; sourceTree = ""; }; F9C9A7F31CAED9510039E10C /* WireDataModelTestHost.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WireDataModelTestHost.app; sourceTree = BUILT_PRODUCTS_DIR; }; F9C9A81C1CAEDA330039E10C /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; F9C9A81D1CAEDA330039E10C /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -3031,7 +3027,6 @@ BF3493F11EC3623200B0C314 /* ZMUser+Teams.swift */, 1670D01B231823DC003A143B /* ZMUser+Permissions.swift */, 16D95A411FCEF87B00C96069 /* ZMUser+Availability.swift */, - F991CE1A1CB561B0004D8465 /* ZMAddressBookContact.m */, 5E0FB214205176B400FD9867 /* Set+ServiceUser.swift */, 5EFE9C052125CD3F007932A6 /* UnregisteredUser.swift */, 7C8BFFDE22FC5E1600B3C8A5 /* UserPropertyValidator.swift */, @@ -3505,7 +3500,6 @@ F9C9A4FD1CAD5DF10039E10C /* Products */, F9C9A6701CAD779E0039E10C /* Frameworks */, 63709F622993E70A00577D4B /* Packages */, - 012F3CFE2CD0505D00A9EACB /* Recovered References */, ); indentWidth = 4; sourceTree = ""; @@ -3617,7 +3611,6 @@ BFCD502C21511D58008CD845 /* DraftMessage.swift */, 5986A08E2C6B744300299181 /* TextMessage.swift */, 5986A08C2C6B710E00299181 /* TextMessageData.swift */, - F9C9A7641CAE8DFC0039E10C /* ZMAddressBookContact.h */, F9C9A6AF1CAD7D1F0039E10C /* ZMManagedObject.h */, F9C9A6A31CAD7C7F0039E10C /* ZMConversation.h */, F9C9A6A51CAD7C7F0039E10C /* ZMEditableUserType.h */, @@ -3758,7 +3751,6 @@ F9B71F2C1CB264EF001DB03F /* ZMConversation+UnreadCount.h in Headers */, F963E9701D9ADD5A00098AD3 /* ZMImageAssetEncryptionKeys.h in Headers */, F9A706981CAEE01D00C2F5FE /* ZMManagedObject+Internal.h in Headers */, - F9C9A7661CAE8DFC0039E10C /* ZMAddressBookContact.h in Headers */, F9C9A65F1CAD76A50039E10C /* WireDataModel.h in Headers */, F9C9A6AC1CAD7C7F0039E10C /* ZMEditableUserType.h in Headers */, F9B71F0C1CB264DF001DB03F /* ZMConversationListDirectory.h in Headers */, @@ -4480,7 +4472,6 @@ E61B3F3A2BA9C9FC005FF9F8 /* MigrateMLSOneOnOneConversationError.swift in Sources */, EEAAD75C252C6DAE00E6A44E /* ModifiedObjects.swift in Sources */, EE5E2C1526DFC31900C3928A /* MessageDestructionTimeoutType.swift in Sources */, - F991CE1B1CB561B0004D8465 /* ZMAddressBookContact.m in Sources */, 63B1335C29A503D100009D84 /* MLSService.swift in Sources */, EE19CE1F2AEBE4CB00CB8641 /* SyncMLSOneToOneConversationAction.swift in Sources */, 87EFA3AC210F52C6004DFA53 /* ZMConversation+LastMessages.swift in Sources */, diff --git a/wire-ios-sync-engine/Source/E2EE/ZMAPSMessageDecoder.h b/wire-ios-sync-engine/Source/E2EE/ZMAPSMessageDecoder.h deleted file mode 100644 index da4abd9a41c..00000000000 --- a/wire-ios-sync-engine/Source/E2EE/ZMAPSMessageDecoder.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// Wire -// Copyright (C) 2024 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 - -@interface ZMAPSMessageDecoder : NSObject - -- (instancetype)initWithEncryptionKey:(NSData *)encryptionKey macKey:(NSData *)macKey; -- (NSData *)decodeData:(NSData *)data; -- (NSDictionary *)decodeAPSPayload:(NSDictionary *)payload; - -@end diff --git a/wire-ios-sync-engine/Source/E2EE/ZMAPSMessageDecoder.m b/wire-ios-sync-engine/Source/E2EE/ZMAPSMessageDecoder.m deleted file mode 100644 index 3830a1d1965..00000000000 --- a/wire-ios-sync-engine/Source/E2EE/ZMAPSMessageDecoder.m +++ /dev/null @@ -1,101 +0,0 @@ -// -// Wire -// Copyright (C) 2024 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 CoreFoundation; -@import WireSystem; -@import WireUtilities; -@import WireTransport; - -#import -#import "ZMAPSMessageDecoder.h" - -static NSString * const DataKey = @"data"; -static NSString * const MacKey = @"mac"; - -//static const uint8_t IV_DATA_SIZE = 16; - -@interface ZMAPSMessageDecoder () - -@property (nonatomic) NSData *encryptionKey; -@property (nonatomic) NSData *macKey; - -@end - -@implementation ZMAPSMessageDecoder - -- (instancetype)initWithEncryptionKey:(NSData *)encryptionKey macKey:(NSData *)macKey; -{ - self = [super init]; - if(self) { - RequireString(encryptionKey.length == kCCKeySizeAES256, "Encryption key has wrong length (%lu vs. expected %d)", (unsigned long)encryptionKey.length, kCCKeySizeAES256); - - self.encryptionKey = encryptionKey; - self.macKey = macKey; - } - return self; -} - -- (NSDictionary *)decodeAPSPayload:(NSDictionary *)payload -{ - NSString *hashString = [payload optionalStringForKey:MacKey]; - NSString *dataString = [payload optionalStringForKey:DataKey]; - - NSData *hashData = [[NSData alloc] initWithBase64EncodedString:hashString options:0]; - NSData *encodedData = [[NSData alloc] initWithBase64EncodedString:dataString options:0]; - - if (![self isValidHash:hashData encodedData:encodedData]) { - ZMLogError(@"Provided invalid hash: %@ for data: %@ with mac key: %@ encryption key: %@", hashString, dataString, self.macKey, self.encryptionKey); - return nil; - } - - NSData *decodedData = [self decodeData:encodedData]; - if (decodedData == nil){ - ZMLogError(@"Invalid payload in APS: %@", payload); - return nil; - } - - NSError *error; - NSDictionary *eventPayload = [NSJSONSerialization JSONObjectWithData:decodedData options:0 error:&error]; - if (error != nil) { - ZMLogError(@"Unable to create JSON from payload in APS with error: %@", error); - return nil; - } - return eventPayload; -} - -- (BOOL)isValidHash:(NSData *)expectedHash encodedData:(NSData *)encodedData -{ - NSData *calculatedMac = [self hashDataForEncodedData:encodedData]; - if ([calculatedMac isEqualToData:expectedHash]) { - return YES; - } - return NO; -} - -- (NSData *)hashDataForEncodedData:(NSData *)encodedData -{ - return [encodedData zmHMACSHA256DigestWithKey:self.macKey]; -} - -- (NSData *)decodeData:(NSData *)data -{ - return [data zmDecryptPrefixedPlainTextIVWithKey:self.encryptionKey]; -} - -@end - diff --git a/wire-ios-sync-engine/WireSyncEngine.xcodeproj/project.pbxproj b/wire-ios-sync-engine/WireSyncEngine.xcodeproj/project.pbxproj index 75dfdf53591..daf64fe2e46 100644 --- a/wire-ios-sync-engine/WireSyncEngine.xcodeproj/project.pbxproj +++ b/wire-ios-sync-engine/WireSyncEngine.xcodeproj/project.pbxproj @@ -59,8 +59,6 @@ 09914E531BD6613D00C10BF8 /* ZMDecodedAPSMessageTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 09914E521BD6613D00C10BF8 /* ZMDecodedAPSMessageTest.m */; }; 09B730961B3045E400A5CCC9 /* ProxiedRequestStatusTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09B730941B3045E400A5CCC9 /* ProxiedRequestStatusTests.swift */; }; 09BA924C1BD55FA5000DC962 /* UserClientRequestStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0920833C1BA84F3100F82B29 /* UserClientRequestStrategyTests.swift */; }; - 09BCDB8E1BCE7F000020DCC7 /* ZMAPSMessageDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 09BCDB8C1BCE7F000020DCC7 /* ZMAPSMessageDecoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 09BCDB8F1BCE7F000020DCC7 /* ZMAPSMessageDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 09BCDB8D1BCE7F000020DCC7 /* ZMAPSMessageDecoder.m */; }; 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, ); }; }; @@ -724,8 +722,6 @@ 0994E1F01B835C4900A51721 /* WireSyncEngine.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WireSyncEngine.xcconfig; sourceTree = ""; }; 0994E1F11B835D1100A51721 /* version.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = version.xcconfig; sourceTree = ""; }; 09B730941B3045E400A5CCC9 /* ProxiedRequestStatusTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProxiedRequestStatusTests.swift; sourceTree = ""; }; - 09BCDB8C1BCE7F000020DCC7 /* ZMAPSMessageDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZMAPSMessageDecoder.h; sourceTree = ""; }; - 09BCDB8D1BCE7F000020DCC7 /* ZMAPSMessageDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZMAPSMessageDecoder.m; sourceTree = ""; }; 09C77C521BA6C77000E2163F /* UserClientRequestStrategy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserClientRequestStrategy.swift; sourceTree = ""; }; 160195601E30C9CF00ACBFAC /* LocalNotificationDispatcherCallingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocalNotificationDispatcherCallingTests.swift; sourceTree = ""; }; 16030DC821B01B7500F8032E /* Conversation+ReadReceiptMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Conversation+ReadReceiptMode.swift"; sourceTree = ""; }; @@ -1512,8 +1508,6 @@ isa = PBXGroup; children = ( 871667F91BB2AE9C009C6EEA /* APSSignalingKeysStore.swift */, - 09BCDB8C1BCE7F000020DCC7 /* ZMAPSMessageDecoder.h */, - 09BCDB8D1BCE7F000020DCC7 /* ZMAPSMessageDecoder.m */, ); path = E2EE; sourceTree = ""; @@ -2794,7 +2788,6 @@ EE0CAEB12AAF306000BD2DB7 /* ZMBlacklistDownloader.h in Headers */, 544BA1271A433DE400D3B852 /* NSError+ZMUserSession.h in Headers */, 16ED865B23E2EE3C00CB1766 /* ZMMissingUpdateEventsTranscoder.h in Headers */, - 09BCDB8E1BCE7F000020DCC7 /* ZMAPSMessageDecoder.h in Headers */, 540818A61BCA647D00257CA7 /* ZMBlacklistVerificator+Testing.h in Headers */, 54A3F24F1C08523500FE3A6B /* ZMOperationLoop.h in Headers */, 54FEAAA91BC7BB9C002DE521 /* ZMBlacklistDownloader+Testing.h in Headers */, @@ -3436,7 +3429,6 @@ E9816C942CC925C400D77F22 /* AnalyticsEventTrackerProvider.swift in Sources */, F148F6671FB9AA7600BD6909 /* UnregisteredTeam.swift in Sources */, 1672A64523473EA100380537 /* LabelDownstreamRequestStrategy.swift in Sources */, - 09BCDB8F1BCE7F000020DCC7 /* ZMAPSMessageDecoder.m in Sources */, E623B6382BD688D400F91B37 /* Caches.swift in Sources */, E6BB79542C36B36E003B821B /* NetworkState.swift in Sources */, 546392721D79D5210094EC66 /* Application.swift in Sources */, diff --git a/wire-ios-testing/Source/Public/NSData+WireTesting.h b/wire-ios-testing/Source/Public/NSData+WireTesting.h deleted file mode 100644 index 1c293837b64..00000000000 --- a/wire-ios-testing/Source/Public/NSData+WireTesting.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// Wire -// Copyright (C) 2024 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 - - - -@interface NSData (DispatchDataTesting) - -- (dispatch_data_t)dispatchData; - -@end - - - -@interface NSData (Test_ZMHTTPDecompression) - -- (NSData *)zm_gzipDecompressedHTTPBody; - -@end diff --git a/wire-ios-testing/Source/Public/NSData+WireTesting.m b/wire-ios-testing/Source/Public/NSData+WireTesting.m deleted file mode 100644 index 33ada0cd485..00000000000 --- a/wire-ios-testing/Source/Public/NSData+WireTesting.m +++ /dev/null @@ -1,103 +0,0 @@ -// -// Wire -// Copyright (C) 2024 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 "NSData+WireTesting.h" -#import - -@implementation NSData (ZMT_DispatchDataTesting) - -- (dispatch_data_t)dispatchData; -{ - CFDataRef cfdata = CFBridgingRetain(self); - return dispatch_data_create(self.bytes, self.length, dispatch_get_global_queue(0, 0), ^{ - CFRelease(cfdata); - }); -} - -@end - -@implementation NSData (ZMT_HTTPDecompression) - -- (NSData *)zm_gzipDecompressedHTTPBody; -{ - if (self.length <= 1) { - return self; - } - - __block z_stream stream = {}; - Require(inflateInit2(&stream, 15 + 16) == Z_OK); - - NSMutableData *result = [NSMutableData dataWithLength:self.length * 2]; - __block size_t resultLength = 0; - - [self enumerateByteRangesUsingBlock:^(const void *bytes, NSRange byteRange, BOOL *stop) { - NOT_USED(stop); - - stream.next_in = (Bytef *) bytes; - stream.avail_in = (uInt) byteRange.length; - - stream.next_out = (Bytef *) (result.mutableBytes + resultLength); - uInt available = (uInt) (result.length - resultLength); - stream.avail_out = available; - - int r = inflate(&stream, Z_NO_FLUSH); - Require(r != Z_STREAM_ERROR); - resultLength += available - stream.avail_out; - - while (stream.avail_out == 0) { - // Not enought space in output. Increase: - result.length = result.length + 1024; - stream.next_out = (Bytef *) (result.mutableBytes + resultLength); - available = (uInt) (result.length - resultLength); - stream.avail_out = available; - r = inflate(&stream, Z_NO_FLUSH); - Require(r != Z_STREAM_ERROR); - resultLength += available - stream.avail_out; - } - }]; - - stream.next_in = NULL; - stream.avail_in = 0; - - stream.next_out = (Bytef *) (result.mutableBytes + resultLength); - uInt available = (uInt) (result.length - resultLength); - stream.avail_out = available; - int rFinish = inflate(&stream, Z_FINISH); - Require(rFinish != Z_STREAM_ERROR); - resultLength += available - stream.avail_out; - - while (stream.avail_out == 0) { - // Not enought space in output. Increase: - result.length = result.length + 1024; - stream.next_out = (Bytef *) (result.mutableBytes + resultLength); - available = (uInt) (result.length - resultLength); - stream.avail_out = available; - rFinish = inflate(&stream, Z_NO_FLUSH); - Require(rFinish != Z_STREAM_ERROR); - resultLength += available - stream.avail_out; - } - - Require(rFinish == Z_STREAM_END); - - result.length = resultLength; - - return result; -} - -@end diff --git a/wire-ios-testing/WireTesting.xcodeproj/project.pbxproj b/wire-ios-testing/WireTesting.xcodeproj/project.pbxproj index b531f25dbf0..f4a080e39e0 100644 --- a/wire-ios-testing/WireTesting.xcodeproj/project.pbxproj +++ b/wire-ios-testing/WireTesting.xcodeproj/project.pbxproj @@ -17,8 +17,6 @@ 09A217F51B78DFAF0076547A /* ZMTExpectation.m in Sources */ = {isa = PBXBuildFile; fileRef = 09A217E51B78DFAF0076547A /* ZMTExpectation.m */; }; 09A217F61B78DFAF0076547A /* ZMTImageComparator.h in Headers */ = {isa = PBXBuildFile; fileRef = 09A217E71B78DFAF0076547A /* ZMTImageComparator.h */; settings = {ATTRIBUTES = (Public, ); }; }; 09A217F71B78DFAF0076547A /* ZMTImageComparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 09A217E81B78DFAF0076547A /* ZMTImageComparator.m */; }; - 09A217F81B78DFAF0076547A /* NSData+WireTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = 09A217E91B78DFAF0076547A /* NSData+WireTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 09A217F91B78DFAF0076547A /* NSData+WireTesting.m in Sources */ = {isa = PBXBuildFile; fileRef = 09A217EA1B78DFAF0076547A /* NSData+WireTesting.m */; }; 09A217FA1B78DFAF0076547A /* NSOperationQueue+WireTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = 09A217EB1B78DFAF0076547A /* NSOperationQueue+WireTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; 09A217FB1B78DFAF0076547A /* NSOperationQueue+WireTesting.m in Sources */ = {isa = PBXBuildFile; fileRef = 09A217EC1B78DFAF0076547A /* NSOperationQueue+WireTesting.m */; }; 09A217FC1B78DFAF0076547A /* ZMTAsserts.h in Headers */ = {isa = PBXBuildFile; fileRef = 09A217ED1B78DFAF0076547A /* ZMTAsserts.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -82,8 +80,6 @@ 09A217E51B78DFAF0076547A /* ZMTExpectation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZMTExpectation.m; sourceTree = ""; }; 09A217E71B78DFAF0076547A /* ZMTImageComparator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZMTImageComparator.h; sourceTree = ""; }; 09A217E81B78DFAF0076547A /* ZMTImageComparator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZMTImageComparator.m; sourceTree = ""; }; - 09A217E91B78DFAF0076547A /* NSData+WireTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+WireTesting.h"; sourceTree = ""; }; - 09A217EA1B78DFAF0076547A /* NSData+WireTesting.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+WireTesting.m"; sourceTree = ""; }; 09A217EB1B78DFAF0076547A /* NSOperationQueue+WireTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSOperationQueue+WireTesting.h"; sourceTree = ""; }; 09A217EC1B78DFAF0076547A /* NSOperationQueue+WireTesting.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSOperationQueue+WireTesting.m"; sourceTree = ""; }; 09A217ED1B78DFAF0076547A /* ZMTAsserts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZMTAsserts.h; sourceTree = ""; }; @@ -247,8 +243,6 @@ 09A217F01B78DFAF0076547A /* WireTesting.h */, 09A217E71B78DFAF0076547A /* ZMTImageComparator.h */, 09A217E81B78DFAF0076547A /* ZMTImageComparator.m */, - 09A217E91B78DFAF0076547A /* NSData+WireTesting.h */, - 09A217EA1B78DFAF0076547A /* NSData+WireTesting.m */, 09A217EB1B78DFAF0076547A /* NSOperationQueue+WireTesting.h */, 09A217EC1B78DFAF0076547A /* NSOperationQueue+WireTesting.m */, 09A217ED1B78DFAF0076547A /* ZMTAsserts.h */, @@ -324,7 +318,6 @@ CEF709D91C1599E700AF3718 /* ZMMockEntity.h in Headers */, 09A217FA1B78DFAF0076547A /* NSOperationQueue+WireTesting.h in Headers */, 09A218001B78DFAF0076547A /* ZMTFailureRecorder.h in Headers */, - 09A217F81B78DFAF0076547A /* NSData+WireTesting.h in Headers */, CEF709DA1C1599ED00AF3718 /* ZMMockEntity2.h in Headers */, 09A217F41B78DFAF0076547A /* ZMTExpectation.h in Headers */, 09A217FF1B78DFAF0076547A /* WireTesting.h in Headers */, @@ -456,7 +449,6 @@ CEB8FD6A1C11E50700ED0BE5 /* ZMMockManagedObjectContextFactory.m in Sources */, 09A218011B78DFAF0076547A /* ZMTFailureRecorder.m in Sources */, 16AAA62C2C22E5BD00080A06 /* FileManger+RandomCacheURL.swift in Sources */, - 09A217F91B78DFAF0076547A /* NSData+WireTesting.m in Sources */, CE6B7B301C11ED5F00FC4C2E /* ZMMockEntity.m in Sources */, 595D4B202C0A1A0500AF6269 /* XCTestExpectation+inverted.swift in Sources */, F97E28BE1D8AACEA00A77567 /* UUID+WireTesting.swift in Sources */, From 3e98481a4c2a90b6fe6dac3c576830c7b6e77ccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franc=CC=A7ois=20Benaiteau?= Date: Fri, 6 Dec 2024 00:18:50 +0100 Subject: [PATCH 2/4] remove import --- wire-ios-testing/Source/Public/WireTesting.h | 1 - 1 file changed, 1 deletion(-) diff --git a/wire-ios-testing/Source/Public/WireTesting.h b/wire-ios-testing/Source/Public/WireTesting.h index e1518fb0294..85d969014fd 100644 --- a/wire-ios-testing/Source/Public/WireTesting.h +++ b/wire-ios-testing/Source/Public/WireTesting.h @@ -30,7 +30,6 @@ FOUNDATION_EXPORT const unsigned char WireTestingVersionString[]; #import #import #import -#import #import #import #import From a8c56d284206eb4ff60b31451325666104e07bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franc=CC=A7ois=20Benaiteau?= Date: Tue, 10 Dec 2024 07:49:59 +0100 Subject: [PATCH 3/4] remove ZMAddressBookContact --- wire-ios-data-model/Source/Model/User/ZMUser.m | 1 - wire-ios-data-model/Source/WireDataModel.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/wire-ios-data-model/Source/Model/User/ZMUser.m b/wire-ios-data-model/Source/Model/User/ZMUser.m index 42848980a8d..fa24786c7a1 100644 --- a/wire-ios-data-model/Source/Model/User/ZMUser.m +++ b/wire-ios-data-model/Source/Model/User/ZMUser.m @@ -33,7 +33,6 @@ #import #import #import "NSPredicate+ZMSearch.h" -#import "ZMAddressBookContact.h" #import diff --git a/wire-ios-data-model/Source/WireDataModel.h b/wire-ios-data-model/Source/WireDataModel.h index 695174bf530..d8a8a8bbbf4 100644 --- a/wire-ios-data-model/Source/WireDataModel.h +++ b/wire-ios-data-model/Source/WireDataModel.h @@ -52,8 +52,6 @@ #import #import -#import - #import #import From 27a50e68b07f783e67fda5696f5b7933ce8fbf8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franc=CC=A7ois=20Benaiteau?= Date: Thu, 12 Dec 2024 21:07:49 +0100 Subject: [PATCH 4/4] draft --- wire-ios-sync-engine/Source/Public/WireSyncEngine.h | 1 - .../Synchronization/Strategies/UserClientRequestStrategy.swift | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/wire-ios-sync-engine/Source/Public/WireSyncEngine.h b/wire-ios-sync-engine/Source/Public/WireSyncEngine.h index 19accd3f293..6724811802b 100644 --- a/wire-ios-sync-engine/Source/Public/WireSyncEngine.h +++ b/wire-ios-sync-engine/Source/Public/WireSyncEngine.h @@ -22,7 +22,6 @@ // PRIVATE #import #import -#import #import #import #import diff --git a/wire-ios-sync-engine/Source/Synchronization/Strategies/UserClientRequestStrategy.swift b/wire-ios-sync-engine/Source/Synchronization/Strategies/UserClientRequestStrategy.swift index cba96ea3696..e6432917e45 100644 --- a/wire-ios-sync-engine/Source/Synchronization/Strategies/UserClientRequestStrategy.swift +++ b/wire-ios-sync-engine/Source/Synchronization/Strategies/UserClientRequestStrategy.swift @@ -259,6 +259,7 @@ public final class UserClientRequestStrategy: ZMObjectSyncStrategy, ZMObjectStra if keys.contains(ZMUserClientNeedsToUpdateSignalingKeysKey) { do { + // what are these: signaling keys? what is it for? return try requestsFactory.updateClientSignalingKeysRequest( userClient, apiVersion: apiVersion