Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit InitialSyncDone notification to allow client to perform auto-a… #1832

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

`kMXSessionInitialSyncDoneNotification` notification will allow client to perform auto-activation
of cross-signing as in Android client (see `observeInitialSync` calling `maybeVerifyOrBootstrapCrossSigning`)
*/
FOUNDATION_EXPORT NSString *const kMXSessionInitialSyncDoneNotification;

#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 kMXSessionInitialSyncDoneNotification = @"kMXSessionInitialSyncDoneNotification";

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:kMXSessionInitialSyncDoneNotification 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
Loading