Skip to content

Commit

Permalink
Merge branch 'release/0.19.0/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
manuroe committed Jun 2, 2021
2 parents 0eb9cbc + 60af8c3 commit f50d30a
Show file tree
Hide file tree
Showing 194 changed files with 7,429 additions and 3,366 deletions.
51 changes: 51 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,50 @@
Changes in 0.19.0 (2021-06-02)
=================================================

✨ Features
* Spaces: Support Space room type (vector-im/element-ios/issues/4069).

🙌 Improvements
* MXSession: Cache initial sync response until it is fully handled (vector-im/element-ios/issues/4317).
* MXStore: New commit method accepting a completion block.
* MXCrypto: Decrypt events asynchronously and no more on the main thread )(vector-im/element-ios/issues/4306).
* MXSession: Add the decryptEvents method to decypt a bunch of events asynchronously.
* MXSession: Make the eventWithEventId method decrypt the event if needed.
* MXEventTimeline: Add NSCopying implementation so that another pagination can be done on the same set of data.
* MXCrypto: eventDeviceInfo: Do not synchronise anymore the operation with the decryption queue.
* MXRoomSummary: Improve reset resetLastMessage to avoid pagination loop and to limit number of decryptions.
* MXSession: Limit the number of decryptions when processing an initial sync (vector-im/element-ios/issues/4307).
* Adapt sync response models to new sync API (vector-im/element-ios/issues/4309).
* MXKeyBackup: Do not reset the backup if forceRefresh() is called too early.
* Pod: Update Realm to 10.7.6.
* Pod: Update Jitsi to 3.5.0.
* Pod: Update OLMKit to 3.2.4.
* MXRealmCryptoStore: Use Realm instances as read-only in background store (vector-im/element-ios/issues/4352).
* MXLog: centralised logging facility, use everywhere instead of NSLog (vector-im/element-ios/issues/4351).

🐛 Bugfix
* MXRoomSummary: Fix decryption of the last message when it is edited (vector-im/element-ios/issues/4322).
* MXCall: Check remote partyId for select_answer events (vector-im/element-ios/issues/4337).
* MXSession: Fix used initial sync cache.

⚠️ API Changes
* MXRoom: MXRoom.outgoingMessages does not decrypt messages anymore. Use MXSession.decryptEvents to get decrypted events.
* MXSession: [MXSession decryptEvent:inTimeline:] is deprecated, use [MXSession decryptEvents:inTimeline:onComplete:] instead.
* MXCrypto: [MXCrypto decryptEvent:inTimeline:] is deprecated, use [MXCrypto decryptEvents:inTimeline:onComplete:] instead.
* MXCrypto: [MXCrypto hasKeysToDecryptEvent:] is now asynchronous.

🗣 Translations
*

🧱 Build
*

Others
*

Improvements:


Changes in 0.18.12 (2021-05-12)
=================================================

Expand Down Expand Up @@ -69,6 +116,10 @@ Changes in 0.18.10 (2021-04-22)

🙌 Improvements
* MXHTTPOperation: Expose the HTTP response (vector-im/element-ios/issues/4206).
* MXRoomPowerLevels: Handle undefined values and add init with default spec values.
* MXRoomCreationParameters: Add roomType and powerLevelContentOverride properties. Add initial state events update method.
* MXResponse: Add convenient uncurry method to convert a Swift method into Objective-C.
* Add MXRoomInitialStateEventBuilder that enables to build initial state events.

🐛 Bugfix
* MXCrypto: Disable optimisation on room members list to make sure we share keys to all (vector-im/element-ios/issues/3807).
Expand Down
10 changes: 6 additions & 4 deletions MatrixSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "MatrixSDK"
s.version = "0.18.12"
s.version = "0.19.0"
s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)"

s.description = <<-DESC
Expand Down Expand Up @@ -36,9 +36,11 @@ Pod::Spec.new do |s|
ss.dependency 'AFNetworking', '~> 4.0.0'
ss.dependency 'GZIP', '~> 1.3.0'

ss.dependency 'SwiftyBeaver', '1.9.5'

# Requirements for e2e encryption
ss.dependency 'OLMKit', '~> 3.2.2'
ss.dependency 'Realm', '10.7.2'
ss.dependency 'OLMKit', '~> 3.2.4'
ss.dependency 'Realm', '10.7.6'
ss.dependency 'libbase58', '~> 0.1.4'
end

Expand All @@ -55,7 +57,7 @@ Pod::Spec.new do |s|
#ss.ios.dependency 'GoogleWebRTC', '~>1.1.21820'

# Use WebRTC framework included in Jitsi Meet SDK
ss.ios.dependency 'JitsiMeetSDK', ' 3.2.0'
ss.ios.dependency 'JitsiMeetSDK', ' 3.5.0'

# JitsiMeetSDK has not yet binaries for arm64 simulator
ss.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
Expand Down
436 changes: 391 additions & 45 deletions MatrixSDK.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#import "MXRealmAggregationsMapper.h"

#import "MXLog.h"


@interface MXRealmAggregationsStore ()

Expand Down Expand Up @@ -241,7 +243,7 @@ - (nullable RLMRealm*)realm

if (error)
{
NSLog(@"[MXRealmFileProvider] realmForUser gets error: %@", error);
MXLogDebug(@"[MXRealmFileProvider] realmForUser gets error: %@", error);
}

return realm;
Expand All @@ -264,7 +266,7 @@ - (nonnull RLMRealmConfiguration*)realmConfiguration

if (folderCreationError)
{
NSLog(@"[MXScanRealmFileProvider] Fail to create Realm folder %@ with error: %@", realmFileFolderURL, folderCreationError);
MXLogDebug(@"[MXScanRealmFileProvider] Fail to create Realm folder %@ with error: %@", realmFileFolderURL, folderCreationError);
}

realmConfiguration.fileURL = realmFileURL;
Expand Down
32 changes: 7 additions & 25 deletions MatrixSDK/Aggregations/MXAggregatedEditsUpdater.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,16 @@ - (MXHTTPOperation*)replaceTextMessageEvent:(MXEvent*)event
MXRoom *room = [self.mxSession roomWithRoomId:roomId];
if (!room)
{
NSLog(@"[MXAggregations] replaceTextMessageEvent: Error: Unknown room: %@", roomId);
MXLogDebug(@"[MXAggregations] replaceTextMessageEvent: Error: Unknown room: %@", roomId);
failure(nil);
return nil;
}

// If it is not already done, decrypt the event to build the new content
if (event.isEncrypted && !event.clearEvent)
{
if (![self.mxSession decryptEvent:event inTimeline:nil])
{
NSLog(@"[MXAggregations] replaceTextMessageEvent: Fail to decrypt original event: %@", event.eventId);
failure(nil);
return nil;
}
}

NSString *messageType = event.content[@"msgtype"];

if (![self.editSupportedMessageTypes containsObject:messageType])
{
NSLog(@"[MXAggregations] replaceTextMessageEvent: Error: Only message types %@ are supported", self.editSupportedMessageTypes);
MXLogDebug(@"[MXAggregations] replaceTextMessageEvent: Error: Only message types %@ are supported", self.editSupportedMessageTypes);
failure(nil);
return nil;
}
Expand All @@ -107,7 +96,7 @@ - (MXHTTPOperation*)replaceTextMessageEvent:(MXEvent*)event
}
else
{
NSLog(@"[MXAggregations] replaceTextMessageEvent: Fail to parse reply event: %@", event.eventId);
MXLogDebug(@"[MXAggregations] replaceTextMessageEvent: Fail to parse reply event: %@", event.eventId);
failure(nil);
return nil;
}
Expand Down Expand Up @@ -161,7 +150,7 @@ - (MXHTTPOperation*)replaceTextMessageEvent:(MXEvent*)event
if (event.isLocalEvent)
{
// Need to wait to get the final event id of the message being sent
NSLog(@"[MXAggregations] replaceTextMessageEvent: Event to edit is a local echo. Wait for the end of the sending");
MXLogDebug(@"[MXAggregations] replaceTextMessageEvent: Event to edit is a local echo. Wait for the end of the sending");
operation = [MXHTTPOperation new];

MXWeakify(self);
Expand All @@ -171,7 +160,7 @@ - (MXHTTPOperation*)replaceTextMessageEvent:(MXEvent*)event

if (event.sentState == MXEventSentStateSent)
{
NSLog(@"[MXAggregations] replaceTextMessageEvent: Edit request can be done now");
MXLogDebug(@"[MXAggregations] replaceTextMessageEvent: Edit request can be done now");

[[NSNotificationCenter defaultCenter] removeObserver:observer];
observer = nil;
Expand Down Expand Up @@ -233,7 +222,7 @@ - (void)handleReplace:(MXEvent *)replaceEvent
if (![event.sender isEqualToString:replaceEvent.sender])
{
// not coming from the original sender, ignore
NSLog(@"[MXAggregations] handleReplace: Edit event not coming from the original sender, ignoring.");
MXLogDebug(@"[MXAggregations] handleReplace: Edit event not coming from the original sender, ignoring.");
return;
}
if (![event.unsignedData.relations.replace.eventId isEqualToString:replaceEvent.eventId])
Expand All @@ -243,20 +232,13 @@ - (void)handleReplace:(MXEvent *)replaceEvent
if (editedEvent)
{
[self.matrixStore replaceEvent:editedEvent inRoom:roomId];

if (editedEvent.isEncrypted && !editedEvent.clearEvent)
{
[self.mxSession decryptEvent:editedEvent inTimeline:nil];
}


[self notifyEventEditsListenersOfRoom:roomId replaceEvent:replaceEvent];
}
}
}
else
{
NSLog(@"[MXAggregations] handleReplace: Unknown event id: %@", replaceEvent.relatesTo.eventId);
MXLogDebug(@"[MXAggregations] handleReplace: Unknown event id: %@", replaceEvent.relatesTo.eventId);
}
}

Expand Down
18 changes: 9 additions & 9 deletions MatrixSDK/Aggregations/MXAggregatedReactionsUpdater.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ - (void)removeReaction:(NSString*)reaction
}
else
{
NSLog(@"[MXAggregations] removeReaction: ERROR: Unknown room %@", roomId);
MXLogDebug(@"[MXAggregations] removeReaction: ERROR: Unknown room %@", roomId);
[self didOperationCompleteForReaction:reaction forEvent:eventId isAdd:NO];
success();
}
}
else
{
NSLog(@"[MXAggregations] removeReaction: ERROR: Do not know reaction(%@) event on event %@", reaction, eventId);
MXLogDebug(@"[MXAggregations] removeReaction: ERROR: Do not know reaction(%@) event on event %@", reaction, eventId);
[self didOperationCompleteForReaction:reaction forEvent:eventId isAdd:NO];
success();
}
Expand Down Expand Up @@ -261,7 +261,7 @@ - (void)handleReaction:(MXEvent *)event direction:(MXTimelineDirection)direction
}
else
{
NSLog(@"[MXAggregations] handleReaction: ERROR: invalid reaction event: %@", event.JSONDictionary);
MXLogDebug(@"[MXAggregations] handleReaction: ERROR: invalid reaction event: %@", event.JSONDictionary);
}
}

Expand Down Expand Up @@ -483,17 +483,17 @@ - (void)addOperationForReaction:(NSString*)reaction forEvent:(NSString*)eventId
if (self.reactionOperations[eventId][reaction].lastObject.isAddOperation == isAdd)
{
// The same operation is already pending
NSLog(@"[MXAggregations] addOperationForReaction: Debounce same reaction operation: %@",
isAdd ? @"ADD" : @"REMOVE");
MXLogDebug(@"[MXAggregations] addOperationForReaction: Debounce same reaction operation: %@",
isAdd ? @"ADD" : @"REMOVE");
[self notifyReactionCountChangeListenersOfRoom:roomId forLocalEchoForOperation:reactionOperation];
block(YES);
return;
}
else if (self.reactionOperations[eventId][reaction].count > 1)
{
// The app requires 3 binary switch operations, keep only the pending first one
NSLog(@"[MXAggregations] addOperationForReaction: Debounce: do only the reaction operation: %@",
isAdd ? @"ADD" : @"REMOVE");
MXLogDebug(@"[MXAggregations] addOperationForReaction: Debounce: do only the reaction operation: %@",
isAdd ? @"ADD" : @"REMOVE");
[self.reactionOperations[eventId][reaction] removeObjectAtIndex:1];
[self notifyReactionCountChangeListenersOfRoom:roomId forLocalEchoForOperation:reactionOperation];
block(YES);
Expand Down Expand Up @@ -641,12 +641,12 @@ - (MXHTTPOperation*)sendReactionUsingHack:(NSString*)reaction
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure
{
NSLog(@"[MXAggregations] sendReactionUsingHack");
MXLogDebug(@"[MXAggregations] sendReactionUsingHack");

MXRoom *room = [self.mxSession roomWithRoomId:roomId];
if (!room)
{
NSLog(@"[MXAggregations] sendReactionUsingHack Error: Unknown room: %@", roomId);
MXLogDebug(@"[MXAggregations] sendReactionUsingHack Error: Unknown room: %@", roomId);
return nil;
}

Expand Down
7 changes: 1 addition & 6 deletions MatrixSDK/Aggregations/MXAggregatedReferencesUpdater.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,13 @@ - (void)handleReference:(MXEvent *)referenceEvent
{
[self.matrixStore replaceEvent:newEvent inRoom:roomId];

if (newEvent.isEncrypted && !newEvent.clearEvent)
{
[self.mxSession decryptEvent:newEvent inTimeline:nil];
}

// TODO or not?
//[self notifyEventEditsListenersOfRoom:roomId replaceEvent:replaceEvent];
}
}
else
{
NSLog(@"[MXAggregations] handleReference: Unknown event id: %@", relation.eventId);
MXLogDebug(@"[MXAggregations] handleReference: Unknown event id: %@", relation.eventId);
}
}

Expand Down
14 changes: 12 additions & 2 deletions MatrixSDK/Aggregations/MXAggregations.m
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,25 @@ - (MXHTTPOperation*)referenceEventsForEvent:(NSString*)eventId
}
}

NSMutableArray *eventsToDecrypt = [NSMutableArray array];
for (MXEvent *event in allEvents)
{
if (event.isEncrypted && !event.clearEvent)
{
[self.mxSession decryptEvent:event inTimeline:nil];
[eventsToDecrypt addObject:event];
}
}

success(paginatedResponse);
if (eventsToDecrypt.count)
{
[self.mxSession decryptEvents:eventsToDecrypt inTimeline:nil onComplete:^(NSArray<MXEvent *> *failedEvents) {
success(paginatedResponse);
}];
}
else
{
success(paginatedResponse);
}
};

MXEvent *event = [self.mxSession.store eventWithEventId:eventId inRoom:roomId];
Expand Down
Loading

0 comments on commit f50d30a

Please sign in to comment.