Skip to content

Commit

Permalink
Merge pull request #6542 from vector-im/steve/lls_debug_beacon_info
Browse files Browse the repository at this point in the history
RoomBubbleCellData: Add logs to track missing beacon info summary associated to a start beacon info
  • Loading branch information
SBiOSoftWhare authored Aug 9, 2022
2 parents 16cc569 + 649178b commit 36b4a35
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions Riot/Modules/Room/CellData/RoomBubbleCellData.m
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ - (instancetype)initWithEvent:(MXEvent *)event andRoomState:(MXRoomState *)roomS
self.collapsable = NO;
self.collapsed = NO;

[self updateBeaconInfoSummaryWithEventId:event.eventId];
[self updateBeaconInfoSummaryWithId:event.eventId andEvent:event];
break;
}
case MXEventTypeCustom:
Expand Down Expand Up @@ -224,7 +224,7 @@ - (NSUInteger)updateEvent:(NSString *)eventId withEvent:(MXEvent *)event

if (self.tag == RoomBubbleCellDataTagLiveLocation)
{
[self updateBeaconInfoSummaryWithEventId:eventId];
[self updateBeaconInfoSummaryWithId:eventId andEvent:event];
}

return retVal;
Expand Down Expand Up @@ -1361,10 +1361,27 @@ - (void)refreshURLPreviewForEventId:(NSString *)eventId
}];
}

- (void)updateBeaconInfoSummaryWithEventId:(NSString *)eventId
- (void)updateBeaconInfoSummaryWithId:(NSString *)eventId andEvent:(MXEvent*)event
{
if (event.eventType != MXEventTypeBeaconInfo)
{
MXLogError(@"[RoomBubbleCellData] Try to update beacon info summary with wrong event type with event id %@", eventId);
return;
}

id<MXBeaconInfoSummaryProtocol> beaconInfoSummary = [self.mxSession.aggregations.beaconAggregations beaconInfoSummaryFor:eventId inRoomWithId:self.roomId];

if (!beaconInfoSummary)
{
MXBeaconInfo *beaconInfo = [[MXBeaconInfo alloc] initWithMXEvent:event];

// A start beacon info event (isLive == true) should have an associated BeaconInfoSummary
if (beaconInfo && beaconInfo.isLive)
{
MXLogError(@"[RoomBubbleCellData] No beacon info summary found for beacon info start event with id %@", eventId);
}
}

self.beaconInfoSummary = beaconInfoSummary;
}

Expand Down

0 comments on commit 36b4a35

Please sign in to comment.