@@ -38,6 +38,8 @@ @interface RoomBubbleCellData()
3838// Flags to "Show All" reactions for an event
3939@property (nonatomic ) NSMutableSet <NSString* /* eventId */> *eventsToShowAllReactions;
4040
41+ @property (nonatomic , strong , readwrite ) id <MXBeaconInfoSummaryProtocol> beaconInfoSummary;
42+
4143@end
4244
4345@implementation RoomBubbleCellData
@@ -159,6 +161,15 @@ - (instancetype)initWithEvent:(MXEvent *)event andRoomState:(MXRoomState *)roomS
159161
160162 break ;
161163 }
164+ case MXEventTypeBeaconInfo:
165+ {
166+ self.tag = RoomBubbleCellDataTagLiveLocation;
167+ self.collapsable = NO ;
168+ self.collapsed = NO ;
169+
170+ [self updateBeaconInfoSummaryWithEventId: event.eventId];
171+ }
172+ break ;
162173 case MXEventTypeCustom:
163174 {
164175 if ([event.type isEqualToString: kWidgetMatrixEventTypeString ]
@@ -210,6 +221,11 @@ - (NSUInteger)updateEvent:(NSString *)eventId withEvent:(MXEvent *)event
210221
211222 // Update any URL preview data as necessary.
212223 [self refreshURLPreviewForEventId: event.eventId];
224+
225+ if (self.tag == RoomBubbleCellDataTagLiveLocation)
226+ {
227+ [self updateBeaconInfoSummaryWithEventId: eventId];
228+ }
213229
214230 return retVal;
215231}
@@ -279,6 +295,17 @@ - (BOOL)hasNoDisplay
279295 return NO ;
280296 }
281297
298+ if (self.tag == RoomBubbleCellDataTagLiveLocation)
299+ {
300+ // If the summary does not exist don't show the cell
301+ if (!self.beaconInfoSummary )
302+ {
303+ return YES ;
304+ }
305+
306+ return NO ;
307+ }
308+
282309 return [super hasNoDisplay ];
283310}
284311
@@ -983,6 +1010,9 @@ - (BOOL)addEvent:(MXEvent*)event andRoomState:(MXRoomState*)roomState
9831010 case RoomBubbleCellDataTagLocation:
9841011 shouldAddEvent = NO ;
9851012 break ;
1013+ case RoomBubbleCellDataTagLiveLocation:
1014+ shouldAddEvent = NO ;
1015+ break ;
9861016 default :
9871017 break ;
9881018 }
@@ -1294,5 +1324,11 @@ - (void)refreshURLPreviewForEventId:(NSString *)eventId
12941324 }];
12951325}
12961326
1327+ - (void )updateBeaconInfoSummaryWithEventId : (NSString *)eventId
1328+ {
1329+ MXBeaconInfoSummary *beaconInfoSummary = [self .mxSession.aggregations.beaconAggegations beaconInfoSummaryFor: eventId inRoomWithId: self .roomId];
1330+
1331+ self.beaconInfoSummary = beaconInfoSummary;
1332+ }
12971333
12981334@end
0 commit comments