merged element-ios 1.10.5 into 4409_basis_update_1_10_5

This commit is contained in:
Arnfried Griesert
2023-03-16 12:19:26 +01:00
168 changed files with 2451 additions and 850 deletions
@@ -26,10 +26,21 @@
*/
NSMutableDictionary *roomDataSources;
/**
The list of rooms with a "late decryption" event. Causing bubbles issues
Each element is a room ID.
*/
NSMutableSet *roomDataSourcesToDestroy;
/**
Observe UIApplicationDidReceiveMemoryWarningNotification to dispose of any resources that can be recreated.
*/
id UIApplicationDidReceiveMemoryWarningNotificationObserver;
/**
Observe kMXEventDidDecryptNotification to get late decrypted events.
*/
id mxEventDidDecryptNotificationObserver;
}
@end
@@ -119,6 +130,7 @@ static Class _roomDataSourceClass;
{
mxSession = matrixSession;
roomDataSources = [NSMutableDictionary dictionary];
roomDataSourcesToDestroy = [NSMutableSet set];
_releasePolicy = MXKRoomDataSourceManagerReleasePolicyNeverRelease;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didMXSessionDidLeaveRoom:) name:kMXSessionDidLeaveRoomNotification object:nil];
@@ -138,6 +150,12 @@ static Class _roomDataSourceClass;
}
}];
// Observe late decrypted events, and store rooms ids in memory
mxEventDidDecryptNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXEventDidDecryptNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
MXEvent *decryptedEvent = notif.object;
[self->roomDataSourcesToDestroy addObject:decryptedEvent.roomId];
}];
}
return self;
}
@@ -156,6 +174,11 @@ static Class _roomDataSourceClass;
[[NSNotificationCenter defaultCenter] removeObserver:UIApplicationDidReceiveMemoryWarningNotificationObserver];
UIApplicationDidReceiveMemoryWarningNotificationObserver = nil;
}
if (mxEventDidDecryptNotificationObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:mxEventDidDecryptNotificationObserver];
mxEventDidDecryptNotificationObserver = nil;
}
}
#pragma mark
@@ -202,9 +225,19 @@ static Class _roomDataSourceClass;
// If not available yet, create the room data source
MXKRoomDataSource *roomDataSource = roomDataSources[roomId];
// check if the room's dataSource has events with late decryption issues and destroys it
BOOL roomDataSourceToBeDestroyed = [roomDataSourcesToDestroy containsObject:roomId];
if (roomDataSource && roomDataSourceToBeDestroyed && create) {
[roomDataSource destroy];
roomDataSources[roomId] = nil;
roomDataSource = nil;
}
if (!roomDataSource && create && roomId)
{
[roomDataSourcesToDestroy removeObject:roomId];
[_roomDataSourceClass loadRoomDataSourceWithRoomId:roomId threadId:nil andMatrixSession:mxSession onComplete:^(id roomDataSource) {
[self addRoomDataSource:roomDataSource];
onComplete(roomDataSource);
@@ -49,7 +49,7 @@ class MXKSendReplyEventStringLocalizer: NSObject, MXSendReplyEventStringLocalize
VectorL10n.messageReplyToMessageToReplyToPrefix
}
func replyToEndedPoll() -> String {
func endedPollMessage() -> String {
VectorL10n.pollTimelineReplyEndedPoll
}
}