Skip to content

Commit

Permalink
update account data only when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
JanNikGra committed Apr 27, 2023
1 parent 01abe16 commit e1eb69c
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions MatrixSDK/MXSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -4773,21 +4773,26 @@ - (void)removeBreadcrumbWithRoomWithId:(NSString *)roomId
if (index != NSNotFound)
{
[recentRoomIds removeObjectAtIndex:index];

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

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

#pragma mark - Homeserver information
Expand Down

0 comments on commit e1eb69c

Please sign in to comment.