mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 16:13:42 +02:00
6103: Handle refreshing timeline with listner on beaconInfoSummary
This commit is contained in:
@@ -41,6 +41,9 @@ const CGFloat kTypingCellHeight = 24;
|
||||
// Observe key verification transaction changes
|
||||
@property (nonatomic, weak) id keyVerificationTransactionDidChangeNotificationObserver;
|
||||
|
||||
// Listen to location beacon received
|
||||
@property (nonatomic, weak) id beaconInfoSummaryListner;
|
||||
|
||||
// Timer used to debounce cells refresh
|
||||
@property (nonatomic, strong) NSTimer *refreshCellsTimer;
|
||||
|
||||
@@ -100,6 +103,7 @@ const CGFloat kTypingCellHeight = 24;
|
||||
[self registerKeyVerificationRequestNotification];
|
||||
[self registerKeyVerificationTransactionNotification];
|
||||
[self registerTrustLevelDidChangeNotifications];
|
||||
[self registerBeaconInfoSummaryListner];
|
||||
|
||||
self.encryptionTrustLevel = RoomEncryptionTrustLevelUnknown;
|
||||
}
|
||||
@@ -178,9 +182,14 @@ const CGFloat kTypingCellHeight = 24;
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self.keyVerificationTransactionDidChangeNotificationObserver];
|
||||
}
|
||||
|
||||
|
||||
[self.mxSession.threadingService removeDelegate:self];
|
||||
|
||||
if (self.beaconInfoSummaryListner)
|
||||
{
|
||||
[self.mxSession.aggregations.beaconAggregations removeListener:self.beaconInfoSummaryListner];
|
||||
}
|
||||
|
||||
[super destroy];
|
||||
}
|
||||
|
||||
@@ -753,6 +762,37 @@ const CGFloat kTypingCellHeight = 24;
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)registerBeaconInfoSummaryListner
|
||||
{
|
||||
self.beaconInfoSummaryListner = [self.mxSession.aggregations.beaconAggregations listenToBeaconInfoSummaryUpdateInRoomWithId:self.roomId handler:^(id<MXBeaconInfoSummaryProtocol> beaconInfoSummary) {
|
||||
@synchronized (self->bubbles)
|
||||
{
|
||||
[self refreshFirstCellWithBeaconInfoSummary:beaconInfoSummary];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)refreshFirstCellWithBeaconInfoSummary:(id<MXBeaconInfoSummaryProtocol>)beaconInfoSummary
|
||||
{
|
||||
NSUInteger cellIndex = [bubbles indexOfObjectPassingTest:^BOOL(id<MXKRoomBubbleCellDataStoring> _Nonnull cellData, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([cellData isKindOfClass:[RoomBubbleCellData class]])
|
||||
{
|
||||
RoomBubbleCellData *roomBubbleCellData = (RoomBubbleCellData*)cellData;
|
||||
if ([roomBubbleCellData.beaconInfoSummary.id isEqualToString:beaconInfoSummary.id])
|
||||
{
|
||||
*stop = YES;
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}];
|
||||
|
||||
if (cellIndex != NSNotFound)
|
||||
{
|
||||
[self refreshCells];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)shouldFetchKeyVerificationForEvent:(MXEvent*)event
|
||||
{
|
||||
if (!event)
|
||||
|
||||
Reference in New Issue
Block a user