diff --git a/MatrixSDK/Background/Store/MXSyncResponseStoreManager.swift b/MatrixSDK/Background/Store/MXSyncResponseStoreManager.swift index 04dca45995..fb7f8334f9 100644 --- a/MatrixSDK/Background/Store/MXSyncResponseStoreManager.swift +++ b/MatrixSDK/Background/Store/MXSyncResponseStoreManager.swift @@ -327,18 +327,18 @@ public class MXSyncResponseStoreManager: NSObject { for event in eventsToProcess { switch event.eventType { case .roomAliases: - if summary.displayname == nil { - summary.displayname = (event.content["aliases"] as? [String])?.first + if summary.displayName == nil { + summary.displayName = (event.content["aliases"] as? [String])?.first } case .roomCanonicalAlias: - if summary.displayname == nil { - summary.displayname = event.content["alias"] as? String - if summary.displayname == nil { - summary.displayname = (event.content["alt_aliases"] as? [String])?.first + if summary.displayName == nil { + summary.displayName = event.content["alias"] as? String + if summary.displayName == nil { + summary.displayName = (event.content["alt_aliases"] as? [String])?.first } } case .roomName: - summary.displayname = event.content["name"] as? String + summary.displayName = event.content["name"] as? String default: break } diff --git a/MatrixSDK/Data/MXRoom.m b/MatrixSDK/Data/MXRoom.m index e4ae043eab..020af712d3 100644 --- a/MatrixSDK/Data/MXRoom.m +++ b/MatrixSDK/Data/MXRoom.m @@ -3870,7 +3870,7 @@ - (void)membersTrustLevelSummaryWithForceDownload:(BOOL)forceDownload success:(v - (NSString *)description { - return [NSString stringWithFormat:@" %@: %@ - %@", self, self.roomId, self.summary.displayname, self.summary.topic]; + return [NSString stringWithFormat:@" %@: %@ - %@", self, self.roomId, self.summary.displayName, self.summary.topic]; } - (NSComparisonResult)compareLastMessageEventOriginServerTs:(MXRoom *)otherRoom diff --git a/MatrixSDK/Data/MXRoomSummary.h b/MatrixSDK/Data/MXRoomSummary.h index 70437d7754..63147cd2dc 100644 --- a/MatrixSDK/Data/MXRoomSummary.h +++ b/MatrixSDK/Data/MXRoomSummary.h @@ -169,7 +169,7 @@ FOUNDATION_EXPORT NSUInteger const MXRoomSummaryPaginationChunkSize; /** The computed display name of the room. */ -@property (nonatomic) NSString *displayname; +@property (nonatomic) NSString *displayName; /** The topic of the room. diff --git a/MatrixSDK/Data/MXRoomSummary.m b/MatrixSDK/Data/MXRoomSummary.m index d54d8623d0..0839f38085 100644 --- a/MatrixSDK/Data/MXRoomSummary.m +++ b/MatrixSDK/Data/MXRoomSummary.m @@ -243,7 +243,7 @@ - (void)updateWith:(id)summary _roomTypeString = summary.roomTypeString; _roomType = summary.roomType; _avatar = summary.avatar; - _displayname = summary.displayname; + _displayName = summary.displayName; _topic = summary.topic; _creatorUserId = summary.creatorUserId; _aliases = summary.aliases; @@ -286,7 +286,7 @@ - (void)resetRoomStateData MXRoom *room = self.room; _avatar = nil; - _displayname = nil; + _displayName = nil; _topic = nil; _aliases = nil; @@ -296,7 +296,7 @@ - (void)resetRoomStateData BOOL updated = [self.mxSession.roomSummaryUpdateDelegate session:self.mxSession updateRoomSummary:self withStateEvents:roomState.stateEvents roomState:roomState]; - if (self.displayname == nil || self.avatar == nil) + if (self.displayName == nil || self.avatar == nil) { // Avatar and displayname may not be recomputed from the state event list if // the latter does not contain any `name` or `avatar` event. So, in this case, @@ -971,7 +971,7 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder _roomTypeString = [aDecoder decodeObjectForKey:@"roomTypeString"]; _roomType = [aDecoder decodeIntegerForKey:@"roomType"]; _avatar = [aDecoder decodeObjectForKey:@"avatar"]; - _displayname = [aDecoder decodeObjectForKey:@"displayname"]; + _displayName = [aDecoder decodeObjectForKey:@"displayname"]; _topic = [aDecoder decodeObjectForKey:@"topic"]; _creatorUserId = [aDecoder decodeObjectForKey:@"creatorUserId"]; _aliases = [aDecoder decodeObjectForKey:@"aliases"]; @@ -1021,7 +1021,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder [aCoder encodeObject:_roomTypeString forKey:@"roomTypeString"]; [aCoder encodeInteger:_roomType forKey:@"roomType"]; [aCoder encodeObject:_avatar forKey:@"avatar"]; - [aCoder encodeObject:_displayname forKey:@"displayname"]; + [aCoder encodeObject:_displayName forKey:@"displayname"]; [aCoder encodeObject:_topic forKey:@"topic"]; [aCoder encodeObject:_creatorUserId forKey:@"creatorUserId"]; [aCoder encodeObject:_aliases forKey:@"aliases"]; @@ -1059,7 +1059,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder - (NSString *)description { - return [NSString stringWithFormat:@"%@ %@: %@ - %@", super.description, _roomId, _displayname, _lastMessage.eventId]; + return [NSString stringWithFormat:@"%@ %@: %@ - %@", super.description, _roomId, _displayName, _lastMessage.eventId]; } - (NSUInteger)hash @@ -1070,7 +1070,7 @@ - (NSUInteger)hash result = prime * result + [_roomId hash]; result = prime * result + [_roomTypeString hash]; result = prime * result + [_avatar hash]; - result = prime * result + [_displayname hash]; + result = prime * result + [_displayName hash]; result = prime * result + [_topic hash]; result = prime * result + [_creatorUserId hash]; result = prime * result + [_aliases hash]; diff --git a/MatrixSDK/Data/MXRoomSummaryProtocol.h b/MatrixSDK/Data/MXRoomSummaryProtocol.h index 7c1cee6864..d5701f2c8d 100644 --- a/MatrixSDK/Data/MXRoomSummaryProtocol.h +++ b/MatrixSDK/Data/MXRoomSummaryProtocol.h @@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) NSString * _Nullable avatar; /// The computed display name of the room. -@property (nonatomic, readonly) NSString * _Nullable displayname; +@property (nonatomic, readonly) NSString * _Nullable displayName; /// The topic of the room. @property (nonatomic, readonly) NSString * _Nullable topic; diff --git a/MatrixSDK/Data/MXRoomSummaryUpdater.m b/MatrixSDK/Data/MXRoomSummaryUpdater.m index 9e455fb198..f494abe568 100644 --- a/MatrixSDK/Data/MXRoomSummaryUpdater.m +++ b/MatrixSDK/Data/MXRoomSummaryUpdater.m @@ -153,7 +153,7 @@ - (BOOL)session:(MXSession *)session updateRoomSummary:(MXRoomSummary *)summary switch (event.eventType) { case MXEventTypeRoomName: - summary.displayname = roomState.name; + summary.displayName = roomState.name; updated = YES; break; @@ -186,7 +186,7 @@ - (BOOL)session:(MXSession *)session updateRoomSummary:(MXRoomSummary *)summary // If m.room.canonical_alias is set, use it if there is no m.room.name if (!roomState.name && roomState.canonicalAlias) { - summary.displayname = roomState.canonicalAlias; + summary.displayName = roomState.canonicalAlias; updated = YES; } // If canonicalAlias is set, add it to the aliases array @@ -300,11 +300,11 @@ - (BOOL)session:(MXSession *)session updateRoomSummary:(MXRoomSummary *)summary NSUInteger memberCount = roomState.membersCount.members; if (memberCount > 1 - && (!summary.displayname || [summary.displayname isEqualToString:_roomNameStringLocalizer.emptyRoom])) + && (!summary.displayName || [summary.displayName isEqualToString:_roomNameStringLocalizer.emptyRoom])) { // Data are missing to compute the display name MXLogDebug(@"[MXRoomSummaryUpdater] updateRoomSummary: Computed an unexpected \"Empty Room\" name. memberCount: %@", @(memberCount)); - summary.displayname = [self fixUnexpectedEmptyRoomDisplayname:memberCount + summary.displayName = [self fixUnexpectedEmptyRoomDisplayname:memberCount session:session roomState:roomState]; updated = YES; @@ -524,9 +524,9 @@ - (BOOL)updateSummaryDisplayname:(MXRoomSummary *)summary session:(MXSession *)s } } - if (displayName != summary.displayname || ![displayName isEqualToString:summary.displayname]) + if (displayName != summary.displayName || ![displayName isEqualToString:summary.displayName]) { - summary.displayname = displayName; + summary.displayName = displayName; return YES; } diff --git a/MatrixSDK/Data/RoomList/Common/MXBreadcrumbsRoomListDataFetcher.swift b/MatrixSDK/Data/RoomList/Common/MXBreadcrumbsRoomListDataFetcher.swift index d4cd931ef5..507242e666 100644 --- a/MatrixSDK/Data/RoomList/Common/MXBreadcrumbsRoomListDataFetcher.swift +++ b/MatrixSDK/Data/RoomList/Common/MXBreadcrumbsRoomListDataFetcher.swift @@ -91,10 +91,10 @@ internal class MXBreadcrumbsRoomListDataFetcher: NSObject, MXRoomListDataFetcher if let query = fetchOptions.filterOptions.query?.lowercased(), !query.isEmpty { recentRoomIds = recentRoomIds.filter({ roomId in - guard let displayname = session?.roomSummary(withRoomId: roomId).displayname else { + guard let displayName = session?.roomSummary(withRoomId: roomId)?.displayName else { return false } - return displayname.lowercased().contains(query) + return displayName.lowercased().contains(query) }) } diff --git a/MatrixSDK/Data/RoomList/Common/MXRoomListDataFilterable.swift b/MatrixSDK/Data/RoomList/Common/MXRoomListDataFilterable.swift index d5ea63d0bb..425f0c2d0a 100644 --- a/MatrixSDK/Data/RoomList/Common/MXRoomListDataFilterable.swift +++ b/MatrixSDK/Data/RoomList/Common/MXRoomListDataFilterable.swift @@ -122,7 +122,7 @@ extension MXRoomListDataFilterable { if let query = filterOptions.query, !query.isEmpty { let predicate1 = NSPredicate(format: "%K CONTAINS[cd] %@", - #keyPath(MXRoomSummaryProtocol.displayname), + #keyPath(MXRoomSummaryProtocol.displayName), query) let predicate2 = NSPredicate(format: "%K CONTAINS[cd] %@", #keyPath(MXRoomSummaryProtocol.spaceChildInfo.displayName), diff --git a/MatrixSDK/Data/RoomList/Common/MXRoomListDataSortable.swift b/MatrixSDK/Data/RoomList/Common/MXRoomListDataSortable.swift index 65a1f4a10b..2aced9df00 100644 --- a/MatrixSDK/Data/RoomList/Common/MXRoomListDataSortable.swift +++ b/MatrixSDK/Data/RoomList/Common/MXRoomListDataSortable.swift @@ -52,7 +52,7 @@ extension MXRoomListDataSortable { // } if sortOptions.alphabetical { - result.append(NSSortDescriptor(keyPath: \MXRoomSummaryProtocol.displayname, ascending: true)) + result.append(NSSortDescriptor(keyPath: \MXRoomSummaryProtocol.displayName, ascending: true)) } if sortOptions.invitesFirst { diff --git a/MatrixSDK/Data/RoomList/CoreData/MXCoreDataRoomListDataFetcher.swift b/MatrixSDK/Data/RoomList/CoreData/MXCoreDataRoomListDataFetcher.swift index 0a3edf50ae..84c521bf96 100644 --- a/MatrixSDK/Data/RoomList/CoreData/MXCoreDataRoomListDataFetcher.swift +++ b/MatrixSDK/Data/RoomList/CoreData/MXCoreDataRoomListDataFetcher.swift @@ -410,7 +410,7 @@ private class RoomSummaryForTotalCounts: NSObject, MXRoomSummaryProtocol { var roomTypeString: String? var roomType: MXRoomType = .room var avatar: String? - var displayname: String? + var displayName: String? var topic: String? var creatorUserId: String = "" var aliases: [String] = [] @@ -465,7 +465,7 @@ private class RoomSummaryForTotalCounts: NSObject, MXRoomSummaryProtocol { } override var description: String { - return "" + return "" } } diff --git a/MatrixSDK/Data/RoomSummaryStore/CoreData/Models/MXRoomSummaryMO.swift b/MatrixSDK/Data/RoomSummaryStore/CoreData/Models/MXRoomSummaryMO.swift index c886d433a9..6c3730ecb9 100644 --- a/MatrixSDK/Data/RoomSummaryStore/CoreData/Models/MXRoomSummaryMO.swift +++ b/MatrixSDK/Data/RoomSummaryStore/CoreData/Models/MXRoomSummaryMO.swift @@ -83,7 +83,7 @@ public class MXRoomSummaryMO: NSManagedObject { s_typeString = summary.roomTypeString s_typeInt = Int16(summary.roomType.rawValue) s_avatar = summary.avatar - s_displayName = summary.displayname + s_displayName = summary.displayName s_topic = summary.topic s_creatorUserId = summary.creatorUserId s_aliases = summary.aliases.joined(separator: StringArrayDelimiter) @@ -186,7 +186,7 @@ extension MXRoomSummaryMO: MXRoomSummaryProtocol { return s_avatar } - public var displayname: String? { + public var displayName: String? { return s_displayName } diff --git a/MatrixSDK/MXSession.h b/MatrixSDK/MXSession.h index c283598c8c..a9ce329a02 100644 --- a/MatrixSDK/MXSession.h +++ b/MatrixSDK/MXSession.h @@ -1087,7 +1087,7 @@ typedef void (^MXOnBackgroundSyncFail)(NSError *error); @return the MXRoomSummary instance. */ -- (MXRoomSummary *)roomSummaryWithRoomId:(NSString*)roomId; +- (nullable MXRoomSummary *)roomSummaryWithRoomId:(NSString*)roomId; /** Recompute all room summaries last message. diff --git a/MatrixSDK/MXSession.m b/MatrixSDK/MXSession.m index 11d3370e3b..c32d663d84 100644 --- a/MatrixSDK/MXSession.m +++ b/MatrixSDK/MXSession.m @@ -3320,7 +3320,7 @@ - (MXHTTPOperation*)eventWithEventId:(NSString*)eventId #pragma mark - Rooms summaries -- (MXRoomSummary *)roomSummaryWithRoomId:(NSString*)roomId +- (nullable MXRoomSummary *)roomSummaryWithRoomId:(NSString*)roomId { MXRoomSummary *roomSummary; diff --git a/MatrixSDK/Space/MXSpaceService.swift b/MatrixSDK/Space/MXSpaceService.swift index 15011f7dc8..ad8b7b71bd 100644 --- a/MatrixSDK/Space/MXSpaceService.swift +++ b/MatrixSDK/Space/MXSpaceService.swift @@ -783,7 +783,7 @@ public class MXSpaceService: NSObject { membersCount.members = joinedMembersCount roomSummary.membersCount = membersCount - roomSummary.displayname = spaceChildSummaryResponse.name + roomSummary.displayName = spaceChildSummaryResponse.name roomSummary.topic = spaceChildSummaryResponse.topic roomSummary.avatar = spaceChildSummaryResponse.avatarUrl roomSummary.isEncrypted = false diff --git a/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.m b/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.m index a549f46bee..e4cfb2516c 100644 --- a/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.m +++ b/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.m @@ -401,7 +401,7 @@ - (void)contactIdentifierForCall:(MXCall *)call onComplete:(void (^)(NSString *c { if (call.isConferenceCall) { - onComplete(call.room.summary.displayname); + onComplete(call.room.summary.displayName); } else { diff --git a/MatrixSDK/VoIP/MXCall.m b/MatrixSDK/VoIP/MXCall.m index 227512f7b8..7affafe075 100644 --- a/MatrixSDK/VoIP/MXCall.m +++ b/MatrixSDK/VoIP/MXCall.m @@ -1117,7 +1117,7 @@ - (void)handleCallInvite:(MXEvent *)event } else { - _callerName = nativeRoom.summary.displayname; + _callerName = nativeRoom.summary.displayName; } } calleeId = callManager.mxSession.myUserId; diff --git a/MatrixSDKTests/MXBackgroundSyncServiceTests.swift b/MatrixSDKTests/MXBackgroundSyncServiceTests.swift index f64f9e57cb..736de954ab 100644 --- a/MatrixSDKTests/MXBackgroundSyncServiceTests.swift +++ b/MatrixSDKTests/MXBackgroundSyncServiceTests.swift @@ -391,7 +391,7 @@ class MXBackgroundSyncServiceTests: XCTestCase { case .success: let roomSummary = self.bgSyncService?.roomSummary(forRoomId: roomId) XCTAssertNotNil(roomSummary, "Room summary should be fetched") - XCTAssertEqual(roomSummary?.displayname, newName, "Room name change should be reflected") + XCTAssertEqual(roomSummary?.displayName, newName, "Room name change should be reflected") expectation?.fulfill() case .failure(let error): XCTFail("Cannot fetch the event from background sync service - error: \(error)") diff --git a/MatrixSDKTests/MXCoreDataRoomListDataManagerUnitTests.swift b/MatrixSDKTests/MXCoreDataRoomListDataManagerUnitTests.swift index fbe1ddc51e..ab883f92fc 100644 --- a/MatrixSDKTests/MXCoreDataRoomListDataManagerUnitTests.swift +++ b/MatrixSDKTests/MXCoreDataRoomListDataManagerUnitTests.swift @@ -214,7 +214,7 @@ class MXCoreDataRoomListDataManagerUnitTests: XCTestCase { // rename rooms by index for (index, summary) in result.enumerated() { - summary.displayname = "Room \(index + 1)" + summary.displayName = "Room \(index + 1)" if let event = MXEvent(fromJSON: [ "event_id": MXTools.generateTransactionId() as Any, "room_id": summary.roomId, diff --git a/MatrixSDKTests/MXLazyLoadingTests.m b/MatrixSDKTests/MXLazyLoadingTests.m index b8dffdc4ad..2bda1299b3 100644 --- a/MatrixSDKTests/MXLazyLoadingTests.m +++ b/MatrixSDKTests/MXLazyLoadingTests.m @@ -1041,8 +1041,8 @@ - (void)checkRoomSummaryDisplayNameFromHeroesWithLazyLoading:(BOOL)lazyLoading MXRoomSummary *roomSummary = [aliceSession roomSummaryWithRoomId:roomId]; - XCTAssertTrue(roomSummary.displayname.length - && ![roomSummary.displayname isEqualToString:@"Empty room"], @"Unexpected null room name: %@", roomSummary.displayname); + XCTAssertTrue(roomSummary.displayName.length + && ![roomSummary.displayName isEqualToString:@"Empty room"], @"Unexpected null room name: %@", roomSummary.displayName); [expectation fulfill]; }]; @@ -1079,8 +1079,8 @@ - (void)checkRoomSummaryDisplayNameWhenNoMoreNameWithLazyLoading:(BOOL)lazyLoadi // -> The room name should be "Bob & 2 others" MXRoomSummary *roomSummary = [aliceSession roomSummaryWithRoomId:roomId]; - XCTAssertTrue(roomSummary.displayname.length - && ![roomSummary.displayname isEqualToString:@"Empty room"], @"Unexpected null room name: %@", roomSummary.displayname); + XCTAssertTrue(roomSummary.displayName.length + && ![roomSummary.displayName isEqualToString:@"Empty room"], @"Unexpected null room name: %@", roomSummary.displayName); // Make alice do an initial sync @@ -1100,8 +1100,8 @@ - (void)checkRoomSummaryDisplayNameWhenNoMoreNameWithLazyLoading:(BOOL)lazyLoadi // -> The room name should be "Bob & 2 others" MXRoomSummary *roomSummary2 = [aliceSession2 roomSummaryWithRoomId:roomId]; - XCTAssertTrue(roomSummary2.displayname.length - && ![roomSummary2.displayname isEqualToString:@"Empty room"], @"Unexpected null room name: %@", roomSummary2.displayname); + XCTAssertTrue(roomSummary2.displayName.length + && ![roomSummary2.displayName isEqualToString:@"Empty room"], @"Unexpected null room name: %@", roomSummary2.displayName); [expectation fulfill]; @@ -1145,10 +1145,10 @@ - (void)checkRoomSummaryDisplayNameInDirectChatWithLazyLoading:(BOOL)lazyLoading [self createDirectChatScenarioWithLazyLoading:lazyLoading readyToTest:^(MXSession *aliceSession, MXSession *bobSession, NSString *roomId, XCTestExpectation *expectation) { MXRoomSummary *roomSummary = [aliceSession roomSummaryWithRoomId:roomId]; - XCTAssertTrue(roomSummary.displayname.length - && ![roomSummary.displayname isEqualToString:@"Empty room"], @"Unexpected null room name: %@", roomSummary.displayname); + XCTAssertTrue(roomSummary.displayName.length + && ![roomSummary.displayName isEqualToString:@"Empty room"], @"Unexpected null room name: %@", roomSummary.displayName); - NSString *roomDisplayName = roomSummary.displayname; + NSString *roomDisplayName = roomSummary.displayName; [aliceSession pause]; @@ -1160,7 +1160,7 @@ - (void)checkRoomSummaryDisplayNameInDirectChatWithLazyLoading:(BOOL)lazyLoading // -> The room name should be still the same MXRoomSummary *roomSummary2 = [aliceSession roomSummaryWithRoomId:roomId]; - XCTAssertEqualObjects(roomSummary2.displayname, roomDisplayName); + XCTAssertEqualObjects(roomSummary2.displayName, roomDisplayName); [expectation fulfill]; }]; diff --git a/MatrixSDKTests/MXPeekingRoomTests.m b/MatrixSDKTests/MXPeekingRoomTests.m index 66d8820f70..d9022d56ab 100644 --- a/MatrixSDKTests/MXPeekingRoomTests.m +++ b/MatrixSDKTests/MXPeekingRoomTests.m @@ -104,7 +104,7 @@ - (void)testPeekingSummary XCTAssertNotNil(peekingRoom.summary); - XCTAssertNotNil(peekingRoom.summary.displayname); + XCTAssertNotNil(peekingRoom.summary.displayName); XCTAssertNotNil(peekingRoom.summary.topic); XCTAssertEqual(peekingRoom.summary.membersCount.members, 1, @"The MXPeekingRoom state must be known now"); diff --git a/MatrixSDKTests/MXRoomSummaryTests.m b/MatrixSDKTests/MXRoomSummaryTests.m index 3b5f37a3aa..0644aa9e14 100644 --- a/MatrixSDKTests/MXRoomSummaryTests.m +++ b/MatrixSDKTests/MXRoomSummaryTests.m @@ -458,7 +458,7 @@ - (void)testDisplaynameUpdate observer = [[NSNotificationCenter defaultCenter] addObserverForName:kMXRoomSummaryDidChangeNotification object:summary queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { - XCTAssertEqualObjects(summary.displayname, displayName, @"Room summary must be updated"); + XCTAssertEqualObjects(summary.displayName, displayName, @"Room summary must be updated"); [expectation fulfill]; }]; @@ -479,13 +479,13 @@ - (void)testRoomDisplaynameExcludingUsers [room state:^(MXRoomState *roomState) { // Given a room with two users. - XCTAssertEqualObjects(summary.displayname, @"mxAlice", @"A room with one other user should be given the name of that user."); + XCTAssertEqualObjects(summary.displayName, @"mxAlice", @"A room with one other user should be given the name of that user."); // When excluding the other user during a display name update. [updater updateSummaryDisplayname:summary session:bobSession withServerRoomSummary:nil roomState:roomState excludingUserIDs: @[aliceRestClient.credentials.userId]]; // Then the name of the room should no longer include the other user. - XCTAssertEqualObjects(summary.displayname, @"Empty room", @"The name of the room should not include the other user when they are excluded."); + XCTAssertEqualObjects(summary.displayName, @"Empty room", @"The name of the room should not include the other user when they are excluded."); [expectation fulfill]; }]; }]; @@ -1107,7 +1107,7 @@ - (void)testStatePassedToMXRoomSummaryUpdating [room state:^(MXRoomState *roomState) { XCTAssertEqualObjects(roomState.name, displayName); - XCTAssertEqualObjects(summary.displayname, displayName, @"Room summary must be updated"); + XCTAssertEqualObjects(summary.displayName, displayName, @"Room summary must be updated"); [expectation fulfill]; }]; diff --git a/MatrixSDKTests/MXSpaceServiceTest.swift b/MatrixSDKTests/MXSpaceServiceTest.swift index 93a25d46bd..9921a002bf 100644 --- a/MatrixSDKTests/MXSpaceServiceTest.swift +++ b/MatrixSDKTests/MXSpaceServiceTest.swift @@ -196,7 +196,7 @@ class MXSpaceServiceTest: XCTestCase { XCTAssertTrue(summary.roomType == .space) XCTAssert(summary.membersCount.members == 1, "Bob must be the only one") - XCTAssertTrue(summary.displayname == expectedSpaceName) + XCTAssertTrue(summary.displayName == expectedSpaceName) XCTAssertTrue(summary.topic == expectedSpaceTopic) guard let room = space.room else { @@ -381,18 +381,18 @@ class MXSpaceServiceTest: XCTestCase { switch response { case .success(let spaceChildrenSummary): - XCTAssert(spaceChildrenSummary.spaceInfo?.displayName == spaceB.summary?.displayname) + XCTAssert(spaceChildrenSummary.spaceInfo?.displayName == spaceB.summary?.displayName) let childInfos = spaceChildrenSummary.childInfos XCTAssert(childInfos.count == 2) let childInfoSpaceC = childInfos.first { (childInfo) -> Bool in - childInfo.name == spaceC.summary?.displayname + childInfo.name == spaceC.summary?.displayName } let childInfoSpaceD = childInfos.first { (childInfo) -> Bool in - childInfo.name == spaceD.summary?.displayname + childInfo.name == spaceD.summary?.displayName } XCTAssertNotNil(childInfoSpaceC) diff --git a/MatrixSDKTests/MXStoreRoomListDataManagerUnitTests.swift b/MatrixSDKTests/MXStoreRoomListDataManagerUnitTests.swift index 562530b042..e68d6778dd 100644 --- a/MatrixSDKTests/MXStoreRoomListDataManagerUnitTests.swift +++ b/MatrixSDKTests/MXStoreRoomListDataManagerUnitTests.swift @@ -300,7 +300,7 @@ class MXStoreRoomListDataManagerUnitTests: XCTestCase { // rename rooms by index for (index, summary) in result.enumerated() { - summary.displayname = "Room \(index + 1)" + summary.displayName = "Room \(index + 1)" if let event = MXEvent(fromJSON: [ "event_id": MXTools.generateTransactionId() as Any, "room_id": summary.roomId, diff --git a/MatrixSDKTests/MXStoreTests.m b/MatrixSDKTests/MXStoreTests.m index 58db85b98f..771c237750 100644 --- a/MatrixSDKTests/MXStoreTests.m +++ b/MatrixSDKTests/MXStoreTests.m @@ -1686,7 +1686,7 @@ - (void)checkRoomSummary:(Class)mxStoreClass XCTAssert(summary); - XCTAssertEqualObjects(summary.displayname, @"A name"); + XCTAssertEqualObjects(summary.displayName, @"A name"); XCTAssertEqualObjects(summary.topic, @"A topic"); [expectation fulfill]; diff --git a/MatrixSDKTests/Mocks/MockRoomSummary.swift b/MatrixSDKTests/Mocks/MockRoomSummary.swift index 3a8f3f4c5f..8d213984c9 100644 --- a/MatrixSDKTests/Mocks/MockRoomSummary.swift +++ b/MatrixSDKTests/Mocks/MockRoomSummary.swift @@ -25,7 +25,7 @@ internal class MockRoomSummary: NSObject, MXRoomSummaryProtocol { var avatar: String? - var displayname: String? + var displayName: String? var topic: String? @@ -124,6 +124,6 @@ internal class MockRoomSummary: NSObject, MXRoomSummaryProtocol { } override var description: String { - return "" + return "" } } diff --git a/changelog.d/pr-1731.bugfix b/changelog.d/pr-1731.bugfix new file mode 100644 index 0000000000..80aacf0875 --- /dev/null +++ b/changelog.d/pr-1731.bugfix @@ -0,0 +1 @@ +Fixed a crash when roomSummary is nil.