Skip to content

Commit

Permalink
Emit InitialSyncDone notification to allow client to perform auto-a…
Browse files Browse the repository at this point in the history
…ctivation of cross-signing as in Android client

Signed-off-by: Nicolas Buquet <[email protected]>
  • Loading branch information
NicolasBuquet committed Nov 20, 2023
1 parent 3bed914 commit 4d7df67
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions MatrixSDK/MXSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@ FOUNDATION_EXPORT NSString *const kMXSessionDidUpdateGroupUsersNotification;
*/
FOUNDATION_EXPORT NSString *const kMXSessionDidUpdatePublicisedGroupsForUsersNotification;

/**
Posted when MXSession has finished its initial sync.
No userInfo passed.
`kMXSessionInitialSyncDone` notification will allow client to perform auto-activation
of cross-signing as in Android client (see `observeInitialSync` calling `maybeVerifyOrBootstrapCrossSigning`)
*/
FOUNDATION_EXPORT NSString *const kMXSessionInitialSyncDone;

#pragma mark - Notifications keys
/**
The key in notification userInfo dictionary representating the roomId.
Expand Down
5 changes: 5 additions & 0 deletions MatrixSDK/MXSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
NSString *const kMXSessionDidUpdateGroupRoomsNotification = @"kMXSessionDidUpdateGroupRoomsNotification";
NSString *const kMXSessionDidUpdateGroupUsersNotification = @"kMXSessionDidUpdateGroupUsersNotification";
NSString *const kMXSessionDidUpdatePublicisedGroupsForUsersNotification = @"kMXSessionDidUpdatePublicisedGroupsForUsersNotification";
NSString *const kMXSessionInitialSyncDone = @"kMXSessionInitialSyncDone";

NSString *const kMXSessionNotificationRoomIdKey = @"roomId";
NSString *const kMXSessionNotificationGroupKey = @"group";
Expand Down Expand Up @@ -1545,6 +1546,10 @@ - (void)serverSyncWithServerTimeout:(NSUInteger)serverTimeout
MXCachedSyncResponse *response = [[MXCachedSyncResponse alloc] initWithSyncToken:nil
syncResponse:syncResponse];
[self.initialSyncResponseCache addSyncResponseWithSyncResponse:response];

// Emit `InitialSyncDone` notification to allow client to perform auto-activation
// of cross-signing as in Android client (see `observeInitialSync` calling `maybeVerifyOrBootstrapCrossSigning`)
[NSNotificationCenter.defaultCenter postNotificationName:kMXSessionInitialSyncDone object:nil];
}

// By default, the next sync will be a long polling (with the default server timeout value)
Expand Down
2 changes: 2 additions & 0 deletions changelog.d/intiial-sync-notification.change
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
`kMXSessionInitialSyncDone` notification will allow client to perform auto-activation
of cross-signing as in Android client

0 comments on commit 4d7df67

Please sign in to comment.