From e1eb69cb40be462dd4fd377e1aa84bc49168471d Mon Sep 17 00:00:00 2001 From: JanNiklas Grabowski Date: Thu, 27 Apr 2023 10:48:52 +0200 Subject: [PATCH] update account data only when necessary --- MatrixSDK/MXSession.m | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/MatrixSDK/MXSession.m b/MatrixSDK/MXSession.m index 92ef66a55..0b1a988e2 100644 --- a/MatrixSDK/MXSession.m +++ b/MatrixSDK/MXSession.m @@ -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