Skip to content

Commit

Permalink
add success and failure callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
JanNikGra committed Apr 19, 2023
1 parent cfaf594 commit c9005c9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions MatrixSDK/MXSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -3200,7 +3200,7 @@ - (void)removeRoom:(NSString *)roomId
[rooms removeObjectForKey:roomId];
[roomSummaries removeObjectForKey:roomId];
// Remove room from breadcrub list
[self removeBreadcrumbWithRoomWithId: roomId];
[self removeBreadcrumbWithRoomWithId:roomId success:nil failure:nil];

// Broadcast the left room
[[NSNotificationCenter defaultCenter] postNotificationName:kMXSessionDidLeaveRoomNotification
Expand Down Expand Up @@ -4762,6 +4762,8 @@ - (void)updateBreadcrumbsWithRoomWithId:(NSString *)roomId

// Update breadcrub list when leaving a room
- (void)removeBreadcrumbWithRoomWithId:(NSString *)roomId
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure
{
NSDictionary<NSString *, NSArray *> *breadcrumbs = [self.accountData accountDataForEventType:kMXAccountDataTypeBreadcrumbs];

Expand All @@ -4775,7 +4777,17 @@ - (void)removeBreadcrumbWithRoomWithId:(NSString *)roomId

[self setAccountData:@{kMXAccountDataTypeRecentRoomsKey : recentRoomIds}
forType:kMXAccountDataTypeBreadcrumbs
success: nil failure: nil];
success:^{
if (success)
{
success();
}
} failure:^(NSError *error) {
if (failure)
{
failure(error);
}
}];
}

#pragma mark - Homeserver information
Expand Down

0 comments on commit c9005c9

Please sign in to comment.