mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 17:12:45 +02:00
RoomDataSource: Handle live location sharing deletion.
This commit is contained in:
@@ -44,6 +44,9 @@ const CGFloat kTypingCellHeight = 24;
|
||||
// Listen to location beacon received
|
||||
@property (nonatomic, weak) id beaconInfoSummaryListener;
|
||||
|
||||
// Listen to location beacon info deletion
|
||||
@property (nonatomic, weak) id beaconInfoSummaryDeletionListener;
|
||||
|
||||
// Timer used to debounce cells refresh
|
||||
@property (nonatomic, strong) NSTimer *refreshCellsTimer;
|
||||
|
||||
@@ -190,6 +193,11 @@ const CGFloat kTypingCellHeight = 24;
|
||||
[self.mxSession.aggregations.beaconAggregations removeListener:self.beaconInfoSummaryListener];
|
||||
}
|
||||
|
||||
if (self.beaconInfoSummaryDeletionListener)
|
||||
{
|
||||
[self.mxSession.aggregations.beaconAggregations removeListener:self.beaconInfoSummaryDeletionListener];
|
||||
}
|
||||
|
||||
[super destroy];
|
||||
}
|
||||
|
||||
@@ -770,9 +778,20 @@ const CGFloat kTypingCellHeight = 24;
|
||||
[self updateCurrentUserLocationSharingStatus];
|
||||
[self refreshFirstCellWithBeaconInfoSummary:beaconInfoSummary];
|
||||
}];
|
||||
|
||||
self.beaconInfoSummaryDeletionListener = [self.mxSession.aggregations.beaconAggregations listenToBeaconInfoSummaryDeletionInRoomWithId:self.roomId handler:^(NSString * _Nonnull beaconInfoEventId) {
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
[self updateCurrentUserLocationSharingStatus];
|
||||
[self refreshFirstCellWithBeaconInfoSummaryIdentifier:beaconInfoEventId updatedBeaconInfoSummary:nil];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)refreshFirstCellWithBeaconInfoSummary:(id<MXBeaconInfoSummaryProtocol>)beaconInfoSummary
|
||||
{
|
||||
[self refreshFirstCellWithBeaconInfoSummaryIdentifier:beaconInfoSummary.id updatedBeaconInfoSummary:beaconInfoSummary];
|
||||
}
|
||||
|
||||
- (void)refreshFirstCellWithBeaconInfoSummaryIdentifier:(NSString*)beaconInfoEventId updatedBeaconInfoSummary:(nullable id<MXBeaconInfoSummaryProtocol>)beaconInfoSummary
|
||||
{
|
||||
NSUInteger cellIndex;
|
||||
__block RoomBubbleCellData *roomBubbleCellData;
|
||||
@@ -783,7 +802,7 @@ const CGFloat kTypingCellHeight = 24;
|
||||
if ([cellData isKindOfClass:[RoomBubbleCellData class]])
|
||||
{
|
||||
roomBubbleCellData = (RoomBubbleCellData*)cellData;
|
||||
if ([roomBubbleCellData.beaconInfoSummary.id isEqualToString:beaconInfoSummary.id])
|
||||
if ([roomBubbleCellData.beaconInfoSummary.id isEqualToString:beaconInfoEventId])
|
||||
{
|
||||
*stop = YES;
|
||||
return YES;
|
||||
|
||||
Reference in New Issue
Block a user