Skip to content

Commit 848ab2b

Browse files
author
gulekismail
committed
Merge branch 'release/0.23.3/master'
2 parents 75480e6 + 5b3b144 commit 848ab2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1107
-60
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ GEM
6363
public_suffix (~> 4.0)
6464
typhoeus (~> 1.0)
6565
cocoapods-deintegrate (1.0.5)
66-
cocoapods-downloader (1.5.1)
66+
cocoapods-downloader (1.6.3)
6767
cocoapods-plugins (1.0.0)
6868
nap
6969
cocoapods-search (1.0.1)

MatrixSDK.podspec

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "MatrixSDK"
4-
s.version = "0.23.2"
4+
s.version = "0.23.3"
55
s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)"
66

77
s.description = <<-DESC
@@ -48,7 +48,7 @@ Pod::Spec.new do |s|
4848
end
4949

5050
s.subspec 'JingleCallStack' do |ss|
51-
ss.ios.deployment_target = "11.0"
51+
ss.ios.deployment_target = "12.0"
5252

5353
ss.source_files = "MatrixSDKExtensions/VoIP/Jingle/**/*.{h,m}"
5454

@@ -60,11 +60,7 @@ Pod::Spec.new do |s|
6060
#ss.ios.dependency 'GoogleWebRTC', '~>1.1.21820'
6161

6262
# Use WebRTC framework included in Jitsi Meet SDK
63-
ss.ios.dependency 'JitsiMeetSDK', ' 3.10.2'
64-
65-
# JitsiMeetSDK has not yet binaries for arm64 simulator
66-
ss.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
67-
ss.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
63+
ss.ios.dependency 'JitsiMeetSDK', '5.0.2'
6864
end
6965

7066
end

MatrixSDK.xcodeproj/project.pbxproj

Lines changed: 58 additions & 0 deletions
Large diffs are not rendered by default.

MatrixSDK/Categories/MXEvent+Extensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public extension MXEvent {
3434
if displayNameChecker.isCondition(nil, satisfiedBy: self, roomState: nil, withJsonDict: nil) {
3535
return true
3636
}
37-
guard let rule = session.notificationCenter.rule(matching: self, roomState: nil) else {
37+
guard let rule = session.notificationCenter?.rule(matching: self, roomState: nil) else {
3838
return false
3939
}
4040

MatrixSDK/Contrib/Swift/JSONModels/MXEvent.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ public enum MXEventType: Equatable, Hashable {
7878
case pollStart
7979
case pollResponse
8080
case pollEnd
81+
82+
case beaconInfo
8183

8284
case custom(String)
8385

@@ -132,7 +134,8 @@ public enum MXEventType: Equatable, Hashable {
132134
case .pollStart: return kMXEventTypeStringPollStartMSC3381
133135
case .pollResponse: return kMXEventTypeStringPollResponseMSC3381
134136
case .pollEnd: return kMXEventTypeStringPollEndMSC3381
135-
137+
case .beaconInfo: return kMXEventTypeStringBeaconInfoMSC3672
138+
136139
// Swift converts any constant with the suffix "Notification" as the type `Notification.Name`
137140
// The original value can be reached using the `rawValue` property.
138141
case .typing: return NSNotification.Name.mxEventTypeStringTyping.rawValue
@@ -142,7 +145,7 @@ public enum MXEventType: Equatable, Hashable {
142145
}
143146

144147
public init(identifier: String) {
145-
let events: [MXEventType] = [.roomName, .roomTopic, .roomAvatar, .roomMember, .roomCreate, .roomJoinRules, .roomPowerLevels, .roomAliases, .roomCanonicalAlias, .roomEncrypted, .roomEncryption, .roomGuestAccess, .roomHistoryVisibility, .roomKey, .roomForwardedKey, .roomKeyRequest, .roomMessage, .roomMessageFeedback, .roomRedaction, .roomThirdPartyInvite, .roomTag, .presence, .typing, .callInvite, .callCandidates, .callAnswer, .callSelectAnswer, .callHangup, .callReject, .callNegotiate, .callReplaces, .callRejectReplacement, .callAssertedIdentity, .callAssertedIdentityUnstable, .reaction, .receipt, .roomTombStone, .keyVerificationStart, .keyVerificationAccept, .keyVerificationKey, .keyVerificationMac, .keyVerificationCancel, .keyVerificationDone, .taggedEvents, .spaceChild, .spaceOrder, .pollStart, .pollResponse, .pollEnd]
148+
let events: [MXEventType] = [.roomName, .roomTopic, .roomAvatar, .roomMember, .roomCreate, .roomJoinRules, .roomPowerLevels, .roomAliases, .roomCanonicalAlias, .roomEncrypted, .roomEncryption, .roomGuestAccess, .roomHistoryVisibility, .roomKey, .roomForwardedKey, .roomKeyRequest, .roomMessage, .roomMessageFeedback, .roomRedaction, .roomThirdPartyInvite, .roomTag, .presence, .typing, .callInvite, .callCandidates, .callAnswer, .callSelectAnswer, .callHangup, .callReject, .callNegotiate, .callReplaces, .callRejectReplacement, .callAssertedIdentity, .callAssertedIdentityUnstable, .reaction, .receipt, .roomTombStone, .keyVerificationStart, .keyVerificationAccept, .keyVerificationKey, .keyVerificationMac, .keyVerificationCancel, .keyVerificationDone, .taggedEvents, .spaceChild, .spaceOrder, .pollStart, .pollResponse, .pollEnd, .beaconInfo]
146149

147150
if let type = events.first(where: { $0.identifier == identifier }) {
148151
self = type

MatrixSDK/Crypto/CrossSigning/MXCrossSigning.m

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ - (void)requestPrivateKeysToDeviceIds:(nullable NSArray<NSString*>*)deviceIds
325325
// Note: this may never resolve because this depends on other user's devices.
326326
// We could improve it a bit but we will never fix all cases
327327
dispatch_group_t onPrivateKeysReceivedGroup = dispatch_group_create();
328+
__block BOOL secretReceivedForMSK = NO;
329+
__block BOOL secretReceivedForUSK = NO;
330+
__block BOOL secretReceivedForSSK = NO;
328331

329332
__block NSString *mskRequestId, *uskRequestId, *sskRequestId;
330333

@@ -352,7 +355,11 @@ - (void)requestPrivateKeysToDeviceIds:(nullable NSArray<NSString*>*)deviceIds
352355
if (isSecretValid)
353356
{
354357
[self.crypto.store storeSecret:secret withSecretId:MXSecretId.crossSigningMaster];
355-
dispatch_group_leave(onPrivateKeysReceivedGroup);
358+
if (!secretReceivedForMSK)
359+
{
360+
secretReceivedForMSK = YES;
361+
dispatch_group_leave(onPrivateKeysReceivedGroup);
362+
}
356363
}
357364
return isSecretValid;
358365
} failure:^(NSError * _Nonnull error) {
@@ -389,7 +396,11 @@ - (void)requestPrivateKeysToDeviceIds:(nullable NSArray<NSString*>*)deviceIds
389396
if (isSecretValid)
390397
{
391398
[self.crypto.store storeSecret:secret withSecretId:MXSecretId.crossSigningUserSigning];
392-
dispatch_group_leave(onPrivateKeysReceivedGroup);
399+
if (!secretReceivedForUSK)
400+
{
401+
secretReceivedForUSK = YES;
402+
dispatch_group_leave(onPrivateKeysReceivedGroup);
403+
}
393404
}
394405
return isSecretValid;
395406
} failure:^(NSError * _Nonnull error) {
@@ -426,7 +437,11 @@ - (void)requestPrivateKeysToDeviceIds:(nullable NSArray<NSString*>*)deviceIds
426437
if (isSecretValid)
427438
{
428439
[self.crypto.store storeSecret:secret withSecretId:MXSecretId.crossSigningSelfSigning];
429-
dispatch_group_leave(onPrivateKeysReceivedGroup);
440+
if (!secretReceivedForSSK)
441+
{
442+
secretReceivedForSSK = YES;
443+
dispatch_group_leave(onPrivateKeysReceivedGroup);
444+
}
430445
}
431446
return isSecretValid;
432447
} failure:^(NSError * _Nonnull error) {

MatrixSDK/Crypto/Data/Store/MXRealmCryptoStore/MXRealmCryptoStore.m

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ + (BOOL)hasDataForCredentials:(MXCredentials*)credentials
342342
// there is no Realm with this config
343343
return NO;
344344
}
345-
return (nil != [MXRealmOlmAccount objectsInRealm:realm where:@"userId = %@", credentials.userId].firstObject);
345+
return nil != [MXRealmOlmAccount objectInRealm:realm forPrimaryKey:credentials.userId];
346346
}
347347

348348
+ (instancetype)createStoreWithCredentials:(MXCredentials*)credentials
@@ -469,7 +469,7 @@ - (RLMRealm *)realm
469469

470470
- (MXRealmOlmAccount*)accountInCurrentThread
471471
{
472-
return [MXRealmOlmAccount objectsInRealm:self.realm where:@"userId = %@", userId].firstObject;
472+
return [MXRealmOlmAccount objectInRealm:self.realm forPrimaryKey:userId];
473473
}
474474

475475
- (void)open:(void (^)(void))onComplete failure:(void (^)(NSError *error))failure
@@ -564,7 +564,7 @@ - (void)storeDeviceForUser:(NSString*)userID device:(MXDeviceInfo*)device
564564

565565
[realm transactionWithName:@"[MXRealmCryptoStore] storeDeviceForUser" block:^{
566566

567-
MXRealmUser *realmUser = [MXRealmUser objectsInRealm:realm where:@"userId = %@", userID].firstObject;
567+
MXRealmUser *realmUser = [MXRealmUser objectInRealm:realm forPrimaryKey:userID];
568568
if (!realmUser)
569569
{
570570
realmUser = [[MXRealmUser alloc] initWithValue:@{
@@ -596,7 +596,7 @@ - (void)storeDeviceForUser:(NSString*)userID device:(MXDeviceInfo*)device
596596

597597
- (MXDeviceInfo*)deviceWithDeviceId:(NSString*)deviceId forUser:(NSString*)userID
598598
{
599-
MXRealmUser *realmUser = [MXRealmUser objectsInRealm:self.realm where:@"userId = %@", userID].firstObject;
599+
MXRealmUser *realmUser = [MXRealmUser objectInRealm:self.realm forPrimaryKey:userID];
600600

601601
MXRealmDeviceInfo *realmDevice = [[realmUser.devices objectsWhere:@"deviceId = %@", deviceId] firstObject];
602602
if (realmDevice)
@@ -626,7 +626,7 @@ - (void)storeDevicesForUser:(NSString*)userID devices:(NSDictionary<NSString*, M
626626

627627
[realm transactionWithName:@"[MXRealmCryptoStore] storeDevicesForUser" block:^{
628628

629-
MXRealmUser *realmUser = [MXRealmUser objectsInRealm:realm where:@"userId = %@", userID].firstObject;
629+
MXRealmUser *realmUser = [MXRealmUser objectInRealm:realm forPrimaryKey:userID];;
630630
if (!realmUser)
631631
{
632632
realmUser = [[MXRealmUser alloc] initWithValue:@{
@@ -659,7 +659,7 @@ - (void)storeDevicesForUser:(NSString*)userID devices:(NSDictionary<NSString*, M
659659
{
660660
NSMutableDictionary *devicesForUser;
661661

662-
MXRealmUser *realmUser = [MXRealmUser objectsInRealm:self.realm where:@"userId = %@", userID].firstObject;
662+
MXRealmUser *realmUser = [MXRealmUser objectInRealm:self.realm forPrimaryKey:userID];
663663
if (realmUser)
664664
{
665665
devicesForUser = [NSMutableDictionary dictionary];
@@ -697,7 +697,7 @@ - (void)storeCrossSigningKeys:(MXCrossSigningInfo*)crossSigningInfo
697697

698698
[realm transactionWithName:@"[MXRealmCryptoStore] storeCrossSigningKeys" block:^{
699699

700-
MXRealmUser *realmUser = [MXRealmUser objectsInRealm:realm where:@"userId = %@", crossSigningInfo.userId].firstObject;
700+
MXRealmUser *realmUser = [MXRealmUser objectInRealm:realm forPrimaryKey:crossSigningInfo.userId];
701701
if (!realmUser)
702702
{
703703
realmUser = [[MXRealmUser alloc] initWithValue:@{
@@ -724,7 +724,7 @@ - (MXCrossSigningInfo*)crossSigningKeysForUser:(NSString*)userId
724724
{
725725
MXCrossSigningInfo *crossSigningKeys;
726726

727-
MXRealmUser *realmUser = [MXRealmUser objectsInRealm:self.realm where:@"userId = %@", userId].firstObject;
727+
MXRealmUser *realmUser = [MXRealmUser objectInRealm:self.realm forPrimaryKey:userId];
728728
if (realmUser)
729729
{
730730
crossSigningKeys = [NSKeyedUnarchiver unarchiveObjectWithData:realmUser.crossSigningKeys.data];
@@ -816,7 +816,7 @@ - (BOOL)blacklistUnverifiedDevicesInRoom:(NSString *)roomId
816816

817817
- (MXRealmRoomAlgorithm *)realmRoomAlgorithmForRoom:(NSString*)roomId inRealm:(RLMRealm*)realm
818818
{
819-
return [MXRealmRoomAlgorithm objectsInRealm:realm where:@"roomId = %@", roomId].firstObject;
819+
return [MXRealmRoomAlgorithm objectInRealm:realm forPrimaryKey:roomId];
820820
}
821821

822822

@@ -1052,7 +1052,7 @@ - (MXOlmOutboundGroupSession *)storeOutboundGroupSession:(OLMOutboundGroupSessio
10521052
RLMRealm *realm = self.realm;
10531053
[realm transactionWithName:@"[MXRealmCryptoStore] storeOutboundGroupSession" block:^{
10541054

1055-
MXRealmOlmOutboundGroupSession *realmSession = [MXRealmOlmOutboundGroupSession objectsInRealm:realm where:@"roomId = %@", roomId].firstObject;
1055+
MXRealmOlmOutboundGroupSession *realmSession = [MXRealmOlmOutboundGroupSession objectInRealm:realm forPrimaryKey:roomId];
10561056
if (realmSession && [realmSession.sessionId isEqual:session.sessionIdentifier])
10571057
{
10581058
// Update the existing one
@@ -1089,7 +1089,7 @@ - (MXOlmOutboundGroupSession *)storeOutboundGroupSession:(OLMOutboundGroupSessio
10891089
- (MXOlmOutboundGroupSession *)outboundGroupSessionWithRoomId:(NSString*)roomId
10901090
{
10911091
OLMOutboundGroupSession *session;
1092-
MXRealmOlmOutboundGroupSession *realmSession = [MXRealmOlmOutboundGroupSession objectsInRealm:self.realm where:@"roomId = %@", roomId].firstObject;
1092+
MXRealmOlmOutboundGroupSession *realmSession = [MXRealmOlmOutboundGroupSession objectInRealm:self.realm forPrimaryKey:roomId];
10931093

10941094
MXLogDebug(@"[MXRealmCryptoStore] outboundGroupSessionWithRoomId: %@ -> %@", roomId, realmSession ? @"found" : @"not found");
10951095

@@ -1151,7 +1151,7 @@ - (void)storeSharedDevices:(MXUsersDevicesMap<NSNumber *> *)devices messageIndex
11511151
{
11521152
for (NSString *deviceId in [devices deviceIdsForUser:userId])
11531153
{
1154-
MXRealmUser *realmUser = [MXRealmUser objectsInRealm:realm where:@"userId = %@", userId].firstObject;
1154+
MXRealmUser *realmUser = [MXRealmUser objectInRealm:realm forPrimaryKey:userId];
11551155
if (!realmUser)
11561156
{
11571157
MXLogDebug(@"[MXRealmCryptoStore] storeSharedDevices cannot find user with the ID %@", userId);

MatrixSDK/Crypto/Verification/Data/MXTransactionCancelCode.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ NS_ASSUME_NONNULL_BEGIN
7171
// The QR code is invalid
7272
+ (instancetype)qrCodeInvalid;
7373

74+
// Verification request accepted by another device
75+
+ (instancetype)accepted;
76+
7477
@end
7578

7679
NS_ASSUME_NONNULL_END

MatrixSDK/Crypto/Verification/Data/MXTransactionCancelCode.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,9 @@ + (instancetype)qrCodeInvalid
8787
return [[MXTransactionCancelCode alloc] initWithValue:@"m.qr_code.invalid" humanReadable:@"Invalid QR code"];
8888
}
8989

90+
+ (instancetype)accepted
91+
{
92+
return [[MXTransactionCancelCode alloc] initWithValue:@"m.accepted" humanReadable:@"Verification request accepted by another device"];
93+
}
94+
9095
@end

MatrixSDK/Crypto/Verification/MXKeyVerificationManager.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,13 @@ FOUNDATION_EXPORT NSString *const MXKeyVerificationManagerNotificationTransactio
203203
*/
204204
- (void)removeQRCodeTransactionWithTransactionId:(NSString*)transactionId;
205205

206+
207+
- (void)notifyOthersOfAcceptanceWithTransactionId:(NSString*)transactionId
208+
acceptedUserId:(NSString*)acceptedUserId
209+
acceptedDeviceId:(NSString*)acceptedDeviceId
210+
success:(void(^)(void))success
211+
failure:(void(^)(NSError *error))failure;
212+
206213
@end
207214

208215
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)