Skip to content

Commit 60bb2d8

Browse files
committed
Fix comments
1 parent 45e996b commit 60bb2d8

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

MatrixSDK/Aggregations/LocationSharing/MXBeaconAggregations.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public class MXBeaconAggregations: NSObject {
164164
}
165165
}
166166

167+
/// Get MXBeaconInfoSummary class instead of MXBeaconInfoSummaryProtocol to have access to internal methods
167168
private func getBeaconInfoSummary(withIdentifier identifier: String, inRoomWithId roomId: String) -> MXBeaconInfoSummary? {
168169
return self.beaconInfoSummaryStore.getBeaconInfoSummary(withIdentifier: identifier, inRoomWithId: roomId)
169170
}

MatrixSDK/Aggregations/LocationSharing/MXBeaconInfoSummaryStore.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class MXBeaconInfoSummaryMemoryStore: NSObject, MXBeaconInfoSummaryStoreP
3434
}
3535

3636
if let existingIndex = existingIndex {
37-
beaconInfoSummaries.insert(beaconInfoSummary, at: existingIndex)
37+
beaconInfoSummaries[existingIndex] = beaconInfoSummary
3838
} else {
3939
beaconInfoSummaries.append(beaconInfoSummary)
4040
}

MatrixSDK/JSONModels/Location/MXBeacon.m

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,7 @@ - (nullable instancetype)initWithMXEvent:(MXEvent*)event
6666
return nil;
6767
}
6868

69-
MXBeacon *beacon = [MXBeacon modelFromJSON:event.content];
70-
71-
if (!beacon)
72-
{
73-
return nil;
74-
}
75-
76-
return [self initWithLocation:beacon.location timestamp:beacon.timestamp beaconInfoEventId:beacon.beaconInfoEventId];
69+
return [MXBeacon modelFromJSON:event.content];
7770
}
7871

7972
#pragma mark - Overrides
@@ -101,8 +94,6 @@ + (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary
10194

10295
MXJSONModelSetNumber(timestampNumber, JSONDictionary[kMXMessageContentKeyExtensibleTimestampMSC3488])
10396

104-
MXJSONModelSetMXJSONModel(location, MXLocation, locationDictionary);
105-
10697
MXJSONModelSetMXJSONModel(relatesTo, MXEventContentRelatesTo, JSONDictionary[kMXEventRelationRelatesToKey]);
10798

10899
if (relatesTo && [relatesTo.relationType isEqualToString:MXEventRelationTypeReference])

MatrixSDK/LocationSharing/MXBeaconInfoSummary.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public class MXBeaconInfoSummary: NSObject, MXBeaconInfoSummaryProtocol {
8585
return true
8686
}
8787

88+
/// Only set the device id after the beacon start if needed for current user only.
89+
/// There is no reason to change it twice.
8890
@discardableResult
8991
func updateWithDeviceId(_ deviceId: String) -> Bool {
9092
guard self.deviceId != nil else {

0 commit comments

Comments
 (0)