mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 16:42:44 +02:00
RoomBubbleCellData: Handle live location cell and beacon info summary.
This commit is contained in:
@@ -38,6 +38,8 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
// Flags to "Show All" reactions for an event
|
||||
@property(nonatomic) NSMutableSet<NSString* /* eventId */> *eventsToShowAllReactions;
|
||||
|
||||
@property(nonatomic, strong, readwrite) id<MXBeaconInfoSummaryProtocol> beaconInfoSummary;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RoomBubbleCellData
|
||||
@@ -159,6 +161,15 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
|
||||
break;
|
||||
}
|
||||
case MXEventTypeBeaconInfo:
|
||||
{
|
||||
self.tag = RoomBubbleCellDataTagLiveLocation;
|
||||
self.collapsable = NO;
|
||||
self.collapsed = NO;
|
||||
|
||||
[self updateBeaconInfoSummaryWithEventId:event.eventId];
|
||||
}
|
||||
break;
|
||||
case MXEventTypeCustom:
|
||||
{
|
||||
if ([event.type isEqualToString:kWidgetMatrixEventTypeString]
|
||||
@@ -210,6 +221,11 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
|
||||
// Update any URL preview data as necessary.
|
||||
[self refreshURLPreviewForEventId:event.eventId];
|
||||
|
||||
if (self.tag == RoomBubbleCellDataTagLiveLocation)
|
||||
{
|
||||
[self updateBeaconInfoSummaryWithEventId:eventId];
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
@@ -279,6 +295,17 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (self.tag == RoomBubbleCellDataTagLiveLocation)
|
||||
{
|
||||
// If the summary does not exist do show the cell
|
||||
if (!self.beaconInfoSummary)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
return [super hasNoDisplay];
|
||||
}
|
||||
|
||||
@@ -983,6 +1010,9 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
case RoomBubbleCellDataTagLocation:
|
||||
shouldAddEvent = NO;
|
||||
break;
|
||||
case RoomBubbleCellDataTagLiveLocation:
|
||||
shouldAddEvent = NO;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1294,5 +1324,11 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)updateBeaconInfoSummaryWithEventId:(NSString *)eventId
|
||||
{
|
||||
MXBeaconInfoSummary *beaconInfoSummary = [self.mxSession.aggregations.beaconAggegations beaconInfoSummaryFor:eventId inRoomWithId:self.roomId];
|
||||
|
||||
self.beaconInfoSummary = beaconInfoSummary;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user