Skip to content

Commit 77e3b6c

Browse files
committed
MXEventAssetType: Remove no more needed MXEventAssetTypeLiveLocation case and use MXEventAssetTypeUser where needed.
1 parent d084c0f commit 77e3b6c

File tree

6 files changed

+10
-16
lines changed

6 files changed

+10
-16
lines changed

MatrixSDK/JSONModels/Location/MXBeaconInfo.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ - (instancetype)initWithUserId:(NSString *)userId
4949
_desc = desc;
5050
_timeout = timeout;
5151
_isLive = isLive;
52-
_assetType = MXEventAssetTypeLiveLocation;
52+
_assetType = MXEventAssetTypeUser;
5353
_timestamp = timestamp;
5454
_originalEvent = originalEvent;
5555
}
@@ -122,7 +122,7 @@ + (id)modelFromJSON:(NSDictionary *)jsonDictionary
122122

123123
MXJSONModelSetString(assetTypeString, assetDictionary[kMXMessageContentKeyExtensibleAssetType]);
124124

125-
isAssetTypeValid = [assetTypeString isEqualToString:kMXMessageContentKeyExtensibleAssetTypeLiveLocation];
125+
isAssetTypeValid = [assetTypeString isEqualToString:kMXMessageContentKeyExtensibleAssetTypeUser];
126126
}
127127

128128
MXJSONModelSetNumber(timestampNumber, jsonDictionary[kMXMessageContentKeyExtensibleTimestampMSC3488])
@@ -144,7 +144,7 @@ + (id)modelFromJSON:(NSDictionary *)jsonDictionary
144144

145145
beaconInfo->_timestamp = [timestampNumber unsignedLongLongValue];
146146

147-
beaconInfo->_assetType = MXEventAssetTypeLiveLocation;
147+
beaconInfo->_assetType = MXEventAssetTypeUser;
148148
}
149149

150150
return beaconInfo;
@@ -166,7 +166,7 @@ - (NSDictionary *)JSONDictionary
166166
// Asset type
167167

168168
content[kMXMessageContentKeyExtensibleAssetMSC3488] = @{
169-
kMXMessageContentKeyExtensibleAssetType: kMXMessageContentKeyExtensibleAssetTypeLiveLocation
169+
kMXMessageContentKeyExtensibleAssetType: kMXMessageContentKeyExtensibleAssetTypeUser
170170
};
171171

172172
return content;

MatrixSDK/JSONModels/MXEvent.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,6 @@ FOUNDATION_EXPORT NSString *const kMXMessageContentKeyExtensibleAssetMSC3488;
294294
FOUNDATION_EXPORT NSString *const kMXMessageContentKeyExtensibleAssetType;
295295
FOUNDATION_EXPORT NSString *const kMXMessageContentKeyExtensibleAssetTypeUser;
296296
FOUNDATION_EXPORT NSString *const kMXMessageContentKeyExtensibleAssetTypePin;
297-
// live user location tracking
298-
FOUNDATION_EXPORT NSString *const kMXMessageContentKeyExtensibleAssetTypeLiveLocation;
299297

300298
// Join Rules
301299

MatrixSDK/JSONModels/MXEvent.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@
195195
NSString *const kMXMessageContentKeyExtensibleAssetType = @"type";
196196
NSString *const kMXMessageContentKeyExtensibleAssetTypeUser = @"m.self";
197197
NSString *const kMXMessageContentKeyExtensibleAssetTypePin = @"m.pin";
198-
NSString *const kMXMessageContentKeyExtensibleAssetTypeLiveLocation = @"m.self.live";
199198

200199
// Join Rules
201200

MatrixSDK/JSONModels/MXEventAssetType.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
typedef NS_ENUM(NSUInteger, MXEventAssetType)
2020
{
2121
MXEventAssetTypeGeneric, // A generic location without context
22-
MXEventAssetTypeUser, // Static user location
23-
MXEventAssetTypePin, // Pin location (POI)
24-
MXEventAssetTypeLiveLocation // User live location
22+
MXEventAssetTypeUser, // User location, it can be static or live depending of event type
23+
MXEventAssetTypePin // Pin location (POI)
2524
};

MatrixSDK/Utils/MXEventAssetTypeMapper.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ public class MXEventAssetTypeMapper: NSObject {
3131
case .pin:
3232
eventKey = kMXMessageContentKeyExtensibleAssetTypePin
3333
case .generic:
34-
eventKey = ""
35-
case .liveLocation:
36-
eventKey = kMXMessageContentKeyExtensibleAssetTypeLiveLocation
34+
eventKey = ""
3735
@unknown default:
3836
eventKey = ""
3937
}

MatrixSDKTests/MXBeaconInfoUnitTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class MXBeaconInfoUnitTests: XCTestCase {
3636
"live": expectedIsLive,
3737
kMXMessageContentKeyExtensibleTimestampMSC3488: expectedTimestamp,
3838
kMXMessageContentKeyExtensibleAssetMSC3488: [
39-
kMXMessageContentKeyExtensibleAssetType: kMXMessageContentKeyExtensibleAssetTypeLiveLocation
39+
kMXMessageContentKeyExtensibleAssetType: kMXMessageContentKeyExtensibleAssetTypeUser
4040
]
4141
]
4242

@@ -51,7 +51,7 @@ class MXBeaconInfoUnitTests: XCTestCase {
5151
XCTAssertEqual(beaconInfo.timeout, expectedTimeout)
5252
XCTAssertEqual(beaconInfo.isLive, expectedIsLive)
5353
XCTAssertEqual(beaconInfo.timestamp, expectedTimestamp)
54-
XCTAssertEqual(beaconInfo.assetType, MXEventAssetType.liveLocation)
54+
XCTAssertEqual(beaconInfo.assetType, MXEventAssetType.user)
5555
}
5656

5757
func testParsingFailMissingTimeout() throws {
@@ -65,7 +65,7 @@ class MXBeaconInfoUnitTests: XCTestCase {
6565
"live": expectedIsLive,
6666
kMXMessageContentKeyExtensibleTimestampMSC3488: expectedTimestamp,
6767
kMXMessageContentKeyExtensibleAssetMSC3488: [
68-
kMXMessageContentKeyExtensibleAssetType: kMXMessageContentKeyExtensibleAssetTypeLiveLocation
68+
kMXMessageContentKeyExtensibleAssetType: kMXMessageContentKeyExtensibleAssetTypeUser
6969
]
7070
]
7171

0 commit comments

Comments
 (0)