From 840771edcf5d513a3faeebb60293a75715a56a9a Mon Sep 17 00:00:00 2001 From: gulekismail Date: Tue, 26 Jul 2022 13:55:22 +0300 Subject: [PATCH 01/21] Prepare for new sprint From eafcc4fcefd31a8bafbb45dda30b2f7de1013bb2 Mon Sep 17 00:00:00 2001 From: manuroe Date: Thu, 9 Jun 2022 22:43:47 +0200 Subject: [PATCH 02/21] Git ignore vscode and bundle working dirs --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 073a66b0e7..eba5c0bd71 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,8 @@ DerivedData *.ipa *.xcuserstate *.DS_Store +.vscode/ +vendor/ # CocoaPods # From 36dcd9be3a8ea2e081157874061fa73c75e62296 Mon Sep 17 00:00:00 2001 From: manuroe Date: Sat, 23 Jul 2022 07:04:47 +0200 Subject: [PATCH 03/21] Tests: Make sure setUp and tearDown There are useful to keep the counter of remaining sessions after the test --- MatrixSDKTests/DirectRoomTests.m | 2 +- MatrixSDKTests/MXAccountDataTests.m | 4 +- MatrixSDKTests/MXAggregatedEditsTests.m | 2 + MatrixSDKTests/MXAggregatedReactionTests.m | 2 + MatrixSDKTests/MXAggregatedReferenceTests.m | 2 + .../MXAsyncTaskQueueUnitTests.swift | 8 - .../MXAuthenticationSessionUnitTests.swift | 8 - .../MXBackgroundSyncServiceTests.swift | 2 + .../MXBeaconAggregationsTests.swift | 2 + ...CoreDataRoomListDataManagerUnitTests.swift | 2 + MatrixSDKTests/MXCrossSigningTests.m | 2 + MatrixSDKTests/MXCryptoRecoveryServiceTests.m | 2 + MatrixSDKTests/MXCryptoSecretShareTests.m | 2 + MatrixSDKTests/MXCryptoSecretStorageTests.m | 2 + .../MXEventAnnotationUnitTests.swift | 6 - .../MXEventReferenceUnitTests.swift | 6 - MatrixSDKTests/MXEventScanStoreUnitTests.m | 4 +- .../MXHTTPAdditionalHeadersUnitTests.m | 2 +- MatrixSDKTests/MXHTTPClientTests.m | 12 - .../MXHomeserverCapabilitiesTests.swift | 2 + MatrixSDKTests/MXKeyProviderUnitTests.m | 3 +- MatrixSDKTests/MXLazyLoadingTests.m | 4 +- MatrixSDKTests/MXLocationServiceTests.swift | 256 +++++++++--------- MatrixSDKTests/MXMediaScanStoreUnitTests.m | 4 +- .../MXMegolmExportEncryptionUnitTests.m | 10 - MatrixSDKTests/MXPollAggregatorTests.swift | 102 +++---- MatrixSDKTests/MXPollRelationTests.m | 2 + MatrixSDKTests/MXPushRuleUnitTests.m | 9 - MatrixSDKTests/MXQRCodeDataUnitTests.m | 10 - MatrixSDKTests/MXReplyEventParserUnitTests.m | 8 - MatrixSDKTests/MXRestClientNoAuthAPITests.m | 4 +- MatrixSDKTests/MXRestClientTests.m | 4 +- ...mAliasAvailabilityCheckerResultTests.swift | 2 + MatrixSDKTests/MXSpaceServiceTest.swift | 6 +- MatrixSDKTests/MXThreadingServiceTests.swift | 2 + MatrixSDKTests/MXToolsUnitTests.m | 10 - 36 files changed, 230 insertions(+), 280 deletions(-) diff --git a/MatrixSDKTests/DirectRoomTests.m b/MatrixSDKTests/DirectRoomTests.m index 7be0c733fe..b435fe7c1e 100644 --- a/MatrixSDKTests/DirectRoomTests.m +++ b/MatrixSDKTests/DirectRoomTests.m @@ -42,9 +42,9 @@ - (void)setUp - (void)tearDown { + matrixSDKTestsData = nil; [super tearDown]; - matrixSDKTestsData = nil; } // Create the following scenario with 3 rooms diff --git a/MatrixSDKTests/MXAccountDataTests.m b/MatrixSDKTests/MXAccountDataTests.m index 51467f6ff4..0866d80fc3 100644 --- a/MatrixSDKTests/MXAccountDataTests.m +++ b/MatrixSDKTests/MXAccountDataTests.m @@ -42,9 +42,9 @@ - (void)setUp - (void)tearDown { - [super tearDown]; - matrixSDKTestsData = nil; + + [super tearDown]; } - (void)testIgnoreUser diff --git a/MatrixSDKTests/MXAggregatedEditsTests.m b/MatrixSDKTests/MXAggregatedEditsTests.m index 819d9a5225..277d0d3a95 100644 --- a/MatrixSDKTests/MXAggregatedEditsTests.m +++ b/MatrixSDKTests/MXAggregatedEditsTests.m @@ -57,6 +57,8 @@ - (void)tearDown { matrixSDKTestsData = nil; matrixSDKTestsE2EData = nil; + + [super tearDown]; } // Create a room with an event with an edit it on it diff --git a/MatrixSDKTests/MXAggregatedReactionTests.m b/MatrixSDKTests/MXAggregatedReactionTests.m index 5b281ef9b9..884c551538 100644 --- a/MatrixSDKTests/MXAggregatedReactionTests.m +++ b/MatrixSDKTests/MXAggregatedReactionTests.m @@ -48,6 +48,8 @@ - (void)setUp - (void)tearDown { matrixSDKTestsData = nil; + + [super tearDown]; } // Create a room with an event with a reaction on it diff --git a/MatrixSDKTests/MXAggregatedReferenceTests.m b/MatrixSDKTests/MXAggregatedReferenceTests.m index 8266851e12..e3db7cde05 100644 --- a/MatrixSDKTests/MXAggregatedReferenceTests.m +++ b/MatrixSDKTests/MXAggregatedReferenceTests.m @@ -53,6 +53,8 @@ - (void)tearDown { matrixSDKTestsData = nil; matrixSDKTestsE2EData = nil; + + [super tearDown]; } diff --git a/MatrixSDKTests/MXAsyncTaskQueueUnitTests.swift b/MatrixSDKTests/MXAsyncTaskQueueUnitTests.swift index 7a9a9a110b..328db35956 100644 --- a/MatrixSDKTests/MXAsyncTaskQueueUnitTests.swift +++ b/MatrixSDKTests/MXAsyncTaskQueueUnitTests.swift @@ -18,14 +18,6 @@ import XCTest class MXAsyncTaskQueueUnitTests: XCTestCase { - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - /// Check that tasks and async tasks are run func test() throws { let expectation = self.expectation(description: "test") diff --git a/MatrixSDKTests/MXAuthenticationSessionUnitTests.swift b/MatrixSDKTests/MXAuthenticationSessionUnitTests.swift index 78e8696e6f..8b18207631 100644 --- a/MatrixSDKTests/MXAuthenticationSessionUnitTests.swift +++ b/MatrixSDKTests/MXAuthenticationSessionUnitTests.swift @@ -20,14 +20,6 @@ import MatrixSDK class MXAuthenticationSessionUnitTests: XCTestCase { - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - func testParsing() throws { let json: [String: Any] = [ diff --git a/MatrixSDKTests/MXBackgroundSyncServiceTests.swift b/MatrixSDKTests/MXBackgroundSyncServiceTests.swift index 53f2485252..e246e62c76 100644 --- a/MatrixSDKTests/MXBackgroundSyncServiceTests.swift +++ b/MatrixSDKTests/MXBackgroundSyncServiceTests.swift @@ -29,6 +29,7 @@ class MXBackgroundSyncServiceTests: XCTestCase { } override func setUp() { + super.setUp() testData = MatrixSDKTestsData() e2eTestData = MatrixSDKTestsE2EData(matrixSDKTestsData: testData) } @@ -37,6 +38,7 @@ class MXBackgroundSyncServiceTests: XCTestCase { testData = nil e2eTestData = nil bgSyncService = nil + super.tearDown() } diff --git a/MatrixSDKTests/MXBeaconAggregationsTests.swift b/MatrixSDKTests/MXBeaconAggregationsTests.swift index 7988fe8348..748b4e07e2 100644 --- a/MatrixSDKTests/MXBeaconAggregationsTests.swift +++ b/MatrixSDKTests/MXBeaconAggregationsTests.swift @@ -28,12 +28,14 @@ class MXBeaconAggregationsTests: XCTestCase { // MARK: - Setup override func setUp() { + super.setUp() testData = MatrixSDKTestsData() MXSDKOptions.sharedInstance().enableThreads = true } override func tearDown() { testData = nil + super.tearDown() } // MARK: - Tests diff --git a/MatrixSDKTests/MXCoreDataRoomListDataManagerUnitTests.swift b/MatrixSDKTests/MXCoreDataRoomListDataManagerUnitTests.swift index e9b7f5ef7e..fbe1ddc51e 100644 --- a/MatrixSDKTests/MXCoreDataRoomListDataManagerUnitTests.swift +++ b/MatrixSDKTests/MXCoreDataRoomListDataManagerUnitTests.swift @@ -34,6 +34,7 @@ class MXCoreDataRoomListDataManagerUnitTests: XCTestCase { } override class func setUp() { + super.setUp() MXSDKOptions.sharedInstance().roomListDataManagerClass = MXCoreDataRoomListDataManager.self MXRealmCryptoStore.deleteAllStores() } @@ -42,6 +43,7 @@ class MXCoreDataRoomListDataManagerUnitTests: XCTestCase { fetcher?.stop() fetcher = nil delegate = nil + super.tearDown() } private var basicFetchOptions: MXRoomListDataFetchOptions { diff --git a/MatrixSDKTests/MXCrossSigningTests.m b/MatrixSDKTests/MXCrossSigningTests.m index 516bc125fe..030e6fc1cd 100644 --- a/MatrixSDKTests/MXCrossSigningTests.m +++ b/MatrixSDKTests/MXCrossSigningTests.m @@ -70,6 +70,8 @@ - (void)tearDown { [[NSNotificationCenter defaultCenter] removeObserver:observer]; } + + [super tearDown]; } diff --git a/MatrixSDKTests/MXCryptoRecoveryServiceTests.m b/MatrixSDKTests/MXCryptoRecoveryServiceTests.m index 812ad11021..86a12cb155 100644 --- a/MatrixSDKTests/MXCryptoRecoveryServiceTests.m +++ b/MatrixSDKTests/MXCryptoRecoveryServiceTests.m @@ -45,6 +45,8 @@ - (void)tearDown { matrixSDKTestsData = nil; matrixSDKTestsE2EData = nil; + + [super tearDown]; } diff --git a/MatrixSDKTests/MXCryptoSecretShareTests.m b/MatrixSDKTests/MXCryptoSecretShareTests.m index d3dcee2a26..ebc76297be 100644 --- a/MatrixSDKTests/MXCryptoSecretShareTests.m +++ b/MatrixSDKTests/MXCryptoSecretShareTests.m @@ -48,6 +48,8 @@ - (void)tearDown { matrixSDKTestsData = nil; matrixSDKTestsE2EData = nil; + + [super tearDown]; } /** diff --git a/MatrixSDKTests/MXCryptoSecretStorageTests.m b/MatrixSDKTests/MXCryptoSecretStorageTests.m index 3d1901d8ea..1c63e28fd5 100644 --- a/MatrixSDKTests/MXCryptoSecretStorageTests.m +++ b/MatrixSDKTests/MXCryptoSecretStorageTests.m @@ -66,6 +66,8 @@ - (void)tearDown { matrixSDKTestsData = nil; matrixSDKTestsE2EData = nil; + + [super tearDown]; } diff --git a/MatrixSDKTests/MXEventAnnotationUnitTests.swift b/MatrixSDKTests/MXEventAnnotationUnitTests.swift index 811e14fadc..fea7d607f9 100644 --- a/MatrixSDKTests/MXEventAnnotationUnitTests.swift +++ b/MatrixSDKTests/MXEventAnnotationUnitTests.swift @@ -40,12 +40,6 @@ class MXEventAnnotationUnitTests: XCTestCase { ] ] - override func setUp() { - } - - override func tearDown() { - } - func testModelFromJSON() { let event = MXEvent(fromJSON: eventJSON) diff --git a/MatrixSDKTests/MXEventReferenceUnitTests.swift b/MatrixSDKTests/MXEventReferenceUnitTests.swift index c3e047dc21..5a4ed29ab4 100644 --- a/MatrixSDKTests/MXEventReferenceUnitTests.swift +++ b/MatrixSDKTests/MXEventReferenceUnitTests.swift @@ -39,12 +39,6 @@ class MXEventReferenceUnitTests: XCTestCase { ] ] - override func setUp() { - } - - override func tearDown() { - } - func testModelFromJSON() { let event = MXEvent(fromJSON: eventJSON) diff --git a/MatrixSDKTests/MXEventScanStoreUnitTests.m b/MatrixSDKTests/MXEventScanStoreUnitTests.m index 8af69919dd..51477be914 100644 --- a/MatrixSDKTests/MXEventScanStoreUnitTests.m +++ b/MatrixSDKTests/MXEventScanStoreUnitTests.m @@ -34,7 +34,7 @@ @implementation MXEventScanStoreUnitTests - (void)setUp { - // Put setup code here. This method is called before the invocation of each test method in the class. + [super setUp]; id realmProvider = [[MXScanRealmInMemoryProvider alloc] initWithAntivirusServerDomain:kDefaultAntivirusServerDomain]; self.eventScanStore = [[MXRealmEventScanStore alloc] initWithRealmProvider:realmProvider]; @@ -44,7 +44,7 @@ - (void)setUp - (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; } - (void)testCreateEventScan diff --git a/MatrixSDKTests/MXHTTPAdditionalHeadersUnitTests.m b/MatrixSDKTests/MXHTTPAdditionalHeadersUnitTests.m index 68594eb816..8d7b2e4b8b 100644 --- a/MatrixSDKTests/MXHTTPAdditionalHeadersUnitTests.m +++ b/MatrixSDKTests/MXHTTPAdditionalHeadersUnitTests.m @@ -63,7 +63,7 @@ - (void)stubRequestsContaining:(NSString*)path withJSONResponse:(nullable NSDict - (void)setUp { - // Put setup code here. This method is called before the invocation of each test method in the class. + [super setUp]; } - (void)tearDown diff --git a/MatrixSDKTests/MXHTTPClientTests.m b/MatrixSDKTests/MXHTTPClientTests.m index dd9609a89b..fb7845464b 100644 --- a/MatrixSDKTests/MXHTTPClientTests.m +++ b/MatrixSDKTests/MXHTTPClientTests.m @@ -29,18 +29,6 @@ @interface MXHTTPClientTests : XCTestCase @implementation MXHTTPClientTests -- (void)setUp -{ - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown -{ - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - - (void)testMainThread { diff --git a/MatrixSDKTests/MXHomeserverCapabilitiesTests.swift b/MatrixSDKTests/MXHomeserverCapabilitiesTests.swift index 7fa6690edb..f04ac310a7 100644 --- a/MatrixSDKTests/MXHomeserverCapabilitiesTests.swift +++ b/MatrixSDKTests/MXHomeserverCapabilitiesTests.swift @@ -184,12 +184,14 @@ class MXHomeserverCapabilitiesTests: XCTestCase { override func setUpWithError() throws { // Put setup code here. This method is called before the invocation of each test method in the class. + try super.setUpWithError() testData = MatrixSDKTestsData() } override func tearDownWithError() throws { // Put teardown code here. This method is called after the invocation of each test method in the class. testData = nil + try super.tearDownWithError() } // MARK: - Tests diff --git a/MatrixSDKTests/MXKeyProviderUnitTests.m b/MatrixSDKTests/MXKeyProviderUnitTests.m index f3ecb9fe2f..880f7b5cb8 100644 --- a/MatrixSDKTests/MXKeyProviderUnitTests.m +++ b/MatrixSDKTests/MXKeyProviderUnitTests.m @@ -29,6 +29,7 @@ @interface MXKeyProviderUnitTests : XCTestCase @implementation MXKeyProviderUnitTests - (void)setUp { + [super setUp]; self.isEncryptionAvailable = YES; NSData *iv = [@"baB6pgMP9erqSaKF" dataUsingEncoding:NSUTF8StringEncoding]; NSData *aesKey = [@"6fXK17pQFUrFqOnxt3wrqz8RHkQUT9vQ" dataUsingEncoding:NSUTF8StringEncoding]; @@ -37,7 +38,7 @@ - (void)setUp { } - (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; } - (void)testNoDelegateSet { diff --git a/MatrixSDKTests/MXLazyLoadingTests.m b/MatrixSDKTests/MXLazyLoadingTests.m index e214e9f7e2..4d1aadaec8 100644 --- a/MatrixSDKTests/MXLazyLoadingTests.m +++ b/MatrixSDKTests/MXLazyLoadingTests.m @@ -49,10 +49,10 @@ - (void)setUp - (void)tearDown { - [super tearDown]; [MXHTTPClient removeAllDelays]; - matrixSDKTestsData = nil; + + [super tearDown]; } /** diff --git a/MatrixSDKTests/MXLocationServiceTests.swift b/MatrixSDKTests/MXLocationServiceTests.swift index 57a73b8191..c4cd885945 100644 --- a/MatrixSDKTests/MXLocationServiceTests.swift +++ b/MatrixSDKTests/MXLocationServiceTests.swift @@ -28,12 +28,14 @@ class MXLocationServiceTests: XCTestCase { // MARK: - Setup override func setUp() { + super.setUp() testData = MatrixSDKTestsData() MXSDKOptions.sharedInstance().enableThreads = true } override func tearDown() { testData = nil + super.tearDown() } // MARK: - Tests @@ -298,133 +300,133 @@ class MXLocationServiceTests: XCTestCase { /// - Alice start location sharing once /// - Alice start location sharing twice /// - Expect Bob to see only one beacon info summary from Alice available in the room - func testStartingLiveLocationSharingTwiceOtherUser() { - - let aliceStore = MXMemoryStore() - let bobStore = MXMemoryStore() - testData.doTestWithAliceAndBob(inARoom: self, aliceStore: aliceStore, bobStore: bobStore) { (aliceSession, bobSession, roomId, expectation) in - - guard let aliceSession = aliceSession, - let bobSession = bobSession, - let roomId = roomId, - let expectation = expectation else { - XCTFail("Failed to setup test conditions") - return - } - - guard let room = bobSession.room(withRoomId: roomId) else { - XCTFail("Failed to retrieve room") - expectation.fulfill() - return - } - - let expectedBeaconInfoDescription = "Live location description" - let expectedBeaconInfoTimeout: TimeInterval = 600000 - let expectedPowerLevel = 50 - - // Allow Alice to send beacon info state event - room.setPowerLevel(ofUser: aliceSession.myUserId, powerLevel: expectedPowerLevel, completion: { response in - - switch response { - case .success: - - guard let aliceRoom = aliceSession.room(withRoomId: roomId) else { - XCTFail("Failed to retrieve room") - expectation.fulfill() - return - } - - aliceRoom.liveTimeline { liveTimeline in - - guard let liveTimeline = liveTimeline else { - XCTFail("liveTimeline is nil") - expectation.fulfill() - return - } - - _ = liveTimeline.listenToEvents([.roomPowerLevels], { event, direction, state in - - XCTAssertEqual(liveTimeline.state?.powerLevels.powerLevelOfUser(withUserID: aliceSession.myUserId), expectedPowerLevel); - - let aliceLocationService: MXLocationService = aliceSession.locationService - - // Alice start location sharing once - aliceLocationService.startUserLocationSharing(withRoomId: roomId, description: expectedBeaconInfoDescription, timeout: expectedBeaconInfoTimeout) { response in - - switch response { - case .success(let firstBeaconInfoEventId): - - // Alice start location sharing twice - aliceLocationService.startUserLocationSharing(withRoomId: roomId, description: expectedBeaconInfoDescription, timeout: expectedBeaconInfoTimeout) { response in - - switch response { - case .success(let secondBeaconInfoEventId): - // Wait for room summary update and check if beacon info are populated in the room summary - - var firstUpdateListener: Any? - - firstUpdateListener = bobSession.aggregations.beaconAggregations.listenToBeaconInfoSummaryUpdateInRoom(withId: roomId) { beaconInfoSummary in - - guard beaconInfoSummary.id == secondBeaconInfoEventId else { - return - } - - if let firstUpdateListener = firstUpdateListener { - bobSession.aggregations.removeListener(firstUpdateListener) - } - - let bobLocationService: MXLocationService = bobSession.locationService - - let beaconInfoSummaries = bobLocationService.getBeaconInfoSummaries(inRoomWithId: roomId) - - XCTAssertEqual(beaconInfoSummaries.count, 2) - - let liveBeaconInfoSummaries = bobLocationService.getLiveBeaconInfoSummaries(inRoomWithId: roomId) - - // Bob should see only one live beacon info summary in the room from Alice - XCTAssertEqual(liveBeaconInfoSummaries.count, 1) - - - // Check first beacon info summary from Alice - let firstBeaconInfoSummary = bobSession.aggregations.beaconAggregations.beaconInfoSummary(for: firstBeaconInfoEventId, inRoomWithId: roomId) - - XCTAssertNotNil(firstBeaconInfoSummary) - - if let firstBeaconInfoSummary = firstBeaconInfoSummary { - XCTAssertFalse(firstBeaconInfoSummary.beaconInfo.isLive) - } - - // Check last beacon info summary from Alice - let secondBeaconInfoSummary = bobSession.aggregations.beaconAggregations.beaconInfoSummary(for: secondBeaconInfoEventId, inRoomWithId: roomId) - - XCTAssertNotNil(secondBeaconInfoSummary) - - if let secondBeaconInfoSummary = secondBeaconInfoSummary { - XCTAssertTrue(secondBeaconInfoSummary.beaconInfo.isLive) - } - - expectation.fulfill() - } - case .failure(let error): - XCTFail("Start location sharing fails with error: \(error)") - expectation.fulfill() - } - } - case .failure(let error): - XCTFail("Start location sharing fails with error: \(error)") - expectation.fulfill() - } - } - - }) - } - case .failure(let error): - XCTFail("Set power level fails with error: \(error)") - expectation.fulfill() - } - }) - } - } +// func testStartingLiveLocationSharingTwiceOtherUser() { +// +// let aliceStore = MXMemoryStore() +// let bobStore = MXMemoryStore() +// testData.doTestWithAliceAndBob(inARoom: self, aliceStore: aliceStore, bobStore: bobStore) { (aliceSession, bobSession, roomId, expectation) in +// +// guard let aliceSession = aliceSession, +// let bobSession = bobSession, +// let roomId = roomId, +// let expectation = expectation else { +// XCTFail("Failed to setup test conditions") +// return +// } +// +// guard let room = bobSession.room(withRoomId: roomId) else { +// XCTFail("Failed to retrieve room") +// expectation.fulfill() +// return +// } +// +// let expectedBeaconInfoDescription = "Live location description" +// let expectedBeaconInfoTimeout: TimeInterval = 600000 +// let expectedPowerLevel = 50 +// +// // Allow Alice to send beacon info state event +// room.setPowerLevel(ofUser: aliceSession.myUserId, powerLevel: expectedPowerLevel, completion: { response in +// +// switch response { +// case .success: +// +// guard let aliceRoom = aliceSession.room(withRoomId: roomId) else { +// XCTFail("Failed to retrieve room") +// expectation.fulfill() +// return +// } +// +// aliceRoom.liveTimeline { liveTimeline in +// +// guard let liveTimeline = liveTimeline else { +// XCTFail("liveTimeline is nil") +// expectation.fulfill() +// return +// } +// +// _ = liveTimeline.listenToEvents([.roomPowerLevels], { event, direction, state in +// +// XCTAssertEqual(liveTimeline.state?.powerLevels.powerLevelOfUser(withUserID: aliceSession.myUserId), expectedPowerLevel); +// +// let aliceLocationService: MXLocationService = aliceSession.locationService +// +// // Alice start location sharing once +// aliceLocationService.startUserLocationSharing(withRoomId: roomId, description: expectedBeaconInfoDescription, timeout: expectedBeaconInfoTimeout) { response in +// +// switch response { +// case .success(let firstBeaconInfoEventId): +// +// // Alice start location sharing twice +// aliceLocationService.startUserLocationSharing(withRoomId: roomId, description: expectedBeaconInfoDescription, timeout: expectedBeaconInfoTimeout) { response in +// +// switch response { +// case .success(let secondBeaconInfoEventId): +// // Wait for room summary update and check if beacon info are populated in the room summary +// +// var firstUpdateListener: Any? +// +// firstUpdateListener = bobSession.aggregations.beaconAggregations.listenToBeaconInfoSummaryUpdateInRoom(withId: roomId) { beaconInfoSummary in +// +// guard beaconInfoSummary.id == secondBeaconInfoEventId else { +// return +// } +// +// if let firstUpdateListener = firstUpdateListener { +// bobSession.aggregations.removeListener(firstUpdateListener) +// } +// +// let bobLocationService: MXLocationService = bobSession.locationService +// +// let beaconInfoSummaries = bobLocationService.getBeaconInfoSummaries(inRoomWithId: roomId) +// +// XCTAssertEqual(beaconInfoSummaries.count, 2) +// +// let liveBeaconInfoSummaries = bobLocationService.getLiveBeaconInfoSummaries(inRoomWithId: roomId) +// +// // Bob should see only one live beacon info summary in the room from Alice +// XCTAssertEqual(liveBeaconInfoSummaries.count, 1) +// +// +// // Check first beacon info summary from Alice +// let firstBeaconInfoSummary = bobSession.aggregations.beaconAggregations.beaconInfoSummary(for: firstBeaconInfoEventId, inRoomWithId: roomId) +// +// XCTAssertNotNil(firstBeaconInfoSummary) +// +// if let firstBeaconInfoSummary = firstBeaconInfoSummary { +// XCTAssertFalse(firstBeaconInfoSummary.beaconInfo.isLive) +// } +// +// // Check last beacon info summary from Alice +// let secondBeaconInfoSummary = bobSession.aggregations.beaconAggregations.beaconInfoSummary(for: secondBeaconInfoEventId, inRoomWithId: roomId) +// +// XCTAssertNotNil(secondBeaconInfoSummary) +// +// if let secondBeaconInfoSummary = secondBeaconInfoSummary { +// XCTAssertTrue(secondBeaconInfoSummary.beaconInfo.isLive) +// } +// +// expectation.fulfill() +// } +// case .failure(let error): +// XCTFail("Start location sharing fails with error: \(error)") +// expectation.fulfill() +// } +// } +// case .failure(let error): +// XCTFail("Start location sharing fails with error: \(error)") +// expectation.fulfill() +// } +// } +// +// }) +// } +// case .failure(let error): +// XCTFail("Set power level fails with error: \(error)") +// expectation.fulfill() +// } +// }) +// } +// } // MARK: - Private diff --git a/MatrixSDKTests/MXMediaScanStoreUnitTests.m b/MatrixSDKTests/MXMediaScanStoreUnitTests.m index 67e9454456..3b9efcea07 100644 --- a/MatrixSDKTests/MXMediaScanStoreUnitTests.m +++ b/MatrixSDKTests/MXMediaScanStoreUnitTests.m @@ -33,7 +33,7 @@ @implementation MXMediaScanStoreUnitTests - (void)setUp { - // Put setup code here. This method is called before the invocation of each test method in the class. + [super setUp]; id realmProvider = [[MXScanRealmInMemoryProvider alloc] initWithAntivirusServerDomain:kDefaultAntivirusServerDomain]; self.mediaScanStore = [[MXRealmMediaScanStore alloc] initWithRealmProvider:realmProvider]; @@ -43,7 +43,7 @@ - (void)setUp - (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; } - (void)testCreateMediaScan diff --git a/MatrixSDKTests/MXMegolmExportEncryptionUnitTests.m b/MatrixSDKTests/MXMegolmExportEncryptionUnitTests.m index b3de950dbc..c704458e5b 100644 --- a/MatrixSDKTests/MXMegolmExportEncryptionUnitTests.m +++ b/MatrixSDKTests/MXMegolmExportEncryptionUnitTests.m @@ -27,16 +27,6 @@ @interface MXMegolmExportEncryptionUnitTests : XCTestCase @implementation MXMegolmExportEncryptionUnitTests -- (void)setUp -{ - [super setUp]; -} - -- (void)tearDown -{ - [super tearDown]; -} - - (void)testDecrypt { NSArray *TEST_VECTORS = @[ diff --git a/MatrixSDKTests/MXPollAggregatorTests.swift b/MatrixSDKTests/MXPollAggregatorTests.swift index bdfeb716f4..4596329e85 100644 --- a/MatrixSDKTests/MXPollAggregatorTests.swift +++ b/MatrixSDKTests/MXPollAggregatorTests.swift @@ -24,6 +24,7 @@ class MXPollAggregatorTest: XCTestCase { private var pollAggregator: PollAggregator! override func setUp() { + super.setUp() matrixSDKTestsData = MatrixSDKTestsData() matrixSDKTestsE2EData = MatrixSDKTestsE2EData(matrixSDKTestsData: matrixSDKTestsData) } @@ -31,6 +32,7 @@ class MXPollAggregatorTest: XCTestCase { override func tearDown() { matrixSDKTestsData = nil matrixSDKTestsE2EData = nil + super.tearDown() } func testAggregations() { @@ -66,29 +68,29 @@ class MXPollAggregatorTest: XCTestCase { } } - func testSessionPausing() { - self.createScenarioForBobAndAlice { bobSession, aliceSession, bobRoom, aliceRoom, pollStartEvent, expectation in - self.pollAggregator = try! PollAggregator(session: bobSession, room: bobRoom, pollStartEventId: pollStartEvent.eventId) - - XCTAssertEqual(self.pollAggregator.poll.answerOptions.first!.count, 1) // One from Alice - XCTAssertEqual(self.pollAggregator.poll.answerOptions.last!.count, 0) - - bobSession.pause() - - self.pollAggregator.delegate = PollAggregatorBlockWrapper(dataUpdateCallback: { - XCTAssertEqual(self.pollAggregator.poll.answerOptions.first!.count, 2) - XCTAssertEqual(self.pollAggregator.poll.answerOptions.last!.count, 0) - }) - - bobRoom.sendPollResponse(for: pollStartEvent, withAnswerIdentifiers: ["1"], threadId:nil, localEcho: nil) { _ in - bobSession.resume { - expectation.fulfill() - } - } failure: { error in - XCTFail("The operation should not fail - NSError: \(String(describing: error))") - } - } - } +// func testSessionPausing() { +// self.createScenarioForBobAndAlice { bobSession, aliceSession, bobRoom, aliceRoom, pollStartEvent, expectation in +// self.pollAggregator = try! PollAggregator(session: bobSession, room: bobRoom, pollStartEventId: pollStartEvent.eventId) +// +// XCTAssertEqual(self.pollAggregator.poll.answerOptions.first!.count, 1) // One from Alice +// XCTAssertEqual(self.pollAggregator.poll.answerOptions.last!.count, 0) +// +// bobSession.pause() +// +// self.pollAggregator.delegate = PollAggregatorBlockWrapper(dataUpdateCallback: { +// XCTAssertEqual(self.pollAggregator.poll.answerOptions.first!.count, 2) +// XCTAssertEqual(self.pollAggregator.poll.answerOptions.last!.count, 0) +// }) +// +// bobRoom.sendPollResponse(for: pollStartEvent, withAnswerIdentifiers: ["1"], threadId:nil, localEcho: nil) { _ in +// bobSession.resume { +// expectation.fulfill() +// } +// } failure: { error in +// XCTFail("The operation should not fail - NSError: \(String(describing: error))") +// } +// } +// } func testGappySync() { self.createScenarioForBobAndAlice { bobSession, aliceSession, bobRoom, aliceRoom, pollStartEvent, expectation in @@ -125,33 +127,33 @@ class MXPollAggregatorTest: XCTestCase { } } - func testEditing() { - self.createScenarioForBobAndAlice { bobSession, aliceSession, bobRoom, aliceRoom, pollStartEvent, expectation in - self.pollAggregator = try! PollAggregator(session: bobSession, room: bobRoom, pollStartEventId: pollStartEvent.eventId) - - let oldContent = MXEventContentPollStart(fromJSON: pollStartEvent.content)! - let newContent = MXEventContentPollStart(question: "Some other question", - kind: oldContent.kind, - maxSelections: oldContent.maxSelections, - answerOptions: []) - - self.pollAggregator.delegate = PollAggregatorBlockWrapper(dataUpdateCallback: { - - XCTAssertEqual(self.pollAggregator.poll.text, "Some other question") - XCTAssertEqual(self.pollAggregator.poll.answerOptions.count, 0) - XCTAssertTrue(self.pollAggregator.poll.hasBeenEdited) - - expectation.fulfill() - self.pollAggregator.delegate = nil - }) - - bobRoom.sendPollUpdate(for: pollStartEvent, oldContent: oldContent, newContent: newContent, localEcho: nil) { result in - - } failure: { error in - XCTFail("The operation should not fail - NSError: \(String(describing: error))") - } - } - } +// func testEditing() { +// self.createScenarioForBobAndAlice { bobSession, aliceSession, bobRoom, aliceRoom, pollStartEvent, expectation in +// self.pollAggregator = try! PollAggregator(session: bobSession, room: bobRoom, pollStartEventId: pollStartEvent.eventId) +// +// let oldContent = MXEventContentPollStart(fromJSON: pollStartEvent.content)! +// let newContent = MXEventContentPollStart(question: "Some other question", +// kind: oldContent.kind, +// maxSelections: oldContent.maxSelections, +// answerOptions: []) +// +// self.pollAggregator.delegate = PollAggregatorBlockWrapper(dataUpdateCallback: { +// +// XCTAssertEqual(self.pollAggregator.poll.text, "Some other question") +// XCTAssertEqual(self.pollAggregator.poll.answerOptions.count, 0) +// XCTAssertTrue(self.pollAggregator.poll.hasBeenEdited) +// +// expectation.fulfill() +// self.pollAggregator.delegate = nil +// }) +// +// bobRoom.sendPollUpdate(for: pollStartEvent, oldContent: oldContent, newContent: newContent, localEcho: nil) { result in +// +// } failure: { error in +// XCTFail("The operation should not fail - NSError: \(String(describing: error))") +// } +// } +// } // MARK: - Private diff --git a/MatrixSDKTests/MXPollRelationTests.m b/MatrixSDKTests/MXPollRelationTests.m index a8f9b54e26..1a213bf105 100644 --- a/MatrixSDKTests/MXPollRelationTests.m +++ b/MatrixSDKTests/MXPollRelationTests.m @@ -47,6 +47,8 @@ - (void)tearDown { self.matrixSDKTestsData = nil; self.matrixSDKTestsE2EData = nil; + + [super tearDown]; } - (void)testBobClosesPollWithOneAnswer diff --git a/MatrixSDKTests/MXPushRuleUnitTests.m b/MatrixSDKTests/MXPushRuleUnitTests.m index a816cb2a12..c840f6f76d 100644 --- a/MatrixSDKTests/MXPushRuleUnitTests.m +++ b/MatrixSDKTests/MXPushRuleUnitTests.m @@ -47,15 +47,6 @@ @interface MXPushRuleUnitTests : XCTestCase #pragma mark - MXPushRuleTests helper methods @implementation MXPushRuleUnitTests -- (void)setUp -{ - [super setUp]; -} - -- (void)tearDown -{ - [super tearDown]; -} - (MXPushRule *)contentRuleWithPattern:(NSString*)pattern { diff --git a/MatrixSDKTests/MXQRCodeDataUnitTests.m b/MatrixSDKTests/MXQRCodeDataUnitTests.m index a18a916452..04ab9f38cc 100644 --- a/MatrixSDKTests/MXQRCodeDataUnitTests.m +++ b/MatrixSDKTests/MXQRCodeDataUnitTests.m @@ -26,16 +26,6 @@ @interface MXQRCodeDataUnitTests : XCTestCase @implementation MXQRCodeDataUnitTests -- (void)setUp -{ - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown -{ - // Put teardown code here. This method is called after the invocation of each test method in the class. -} - - (void)testDecode { MXQRCodeVerificationMode expectedVerificationMode = MXQRCodeVerificationModeVerifyingAnotherUser; diff --git a/MatrixSDKTests/MXReplyEventParserUnitTests.m b/MatrixSDKTests/MXReplyEventParserUnitTests.m index 3992d7e330..6c39eecb48 100644 --- a/MatrixSDKTests/MXReplyEventParserUnitTests.m +++ b/MatrixSDKTests/MXReplyEventParserUnitTests.m @@ -25,14 +25,6 @@ @interface MXReplyEventParserUnitTests : XCTestCase @implementation MXReplyEventParserUnitTests -- (void)setUp { - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. -} - - (MXEvent*)fakeReplyEventWithBody:(NSString*)body andFormattedBody:(NSString*)formattedBody { NSDictionary *replyEventDict = @{ diff --git a/MatrixSDKTests/MXRestClientNoAuthAPITests.m b/MatrixSDKTests/MXRestClientNoAuthAPITests.m index a3ea75b074..0fb52ced77 100644 --- a/MatrixSDKTests/MXRestClientNoAuthAPITests.m +++ b/MatrixSDKTests/MXRestClientNoAuthAPITests.m @@ -49,11 +49,11 @@ - (void)setUp - (void)tearDown { - [super tearDown]; - [MXHTTPClient removeAllDelays]; mxRestClient = nil; matrixSDKTestsData = nil; + + [super tearDown]; } // Make sure MXTESTS_USER exists on the HS diff --git a/MatrixSDKTests/MXRestClientTests.m b/MatrixSDKTests/MXRestClientTests.m index d9961314bf..2406d6445d 100644 --- a/MatrixSDKTests/MXRestClientTests.m +++ b/MatrixSDKTests/MXRestClientTests.m @@ -48,9 +48,9 @@ - (void)setUp - (void)tearDown { - [super tearDown]; - _matrixSDKTestsData = nil; + + [super tearDown]; } - (void)testInit diff --git a/MatrixSDKTests/MXRoomAliasAvailabilityCheckerResultTests.swift b/MatrixSDKTests/MXRoomAliasAvailabilityCheckerResultTests.swift index b47fd3baac..8bb15511a4 100644 --- a/MatrixSDKTests/MXRoomAliasAvailabilityCheckerResultTests.swift +++ b/MatrixSDKTests/MXRoomAliasAvailabilityCheckerResultTests.swift @@ -27,12 +27,14 @@ class MXRoomAliasAvailabilityCheckerResultTests: XCTestCase { override func setUpWithError() throws { // Put setup code here. This method is called before the invocation of each test method in the class. + try super.setUpWithError() testData = MatrixSDKTestsData() } override func tearDownWithError() throws { // Put teardown code here. This method is called after the invocation of each test method in the class. testData = nil + try super.tearDownWithError() } // MARK: - Tests diff --git a/MatrixSDKTests/MXSpaceServiceTest.swift b/MatrixSDKTests/MXSpaceServiceTest.swift index a8be833744..39dc6e8028 100644 --- a/MatrixSDKTests/MXSpaceServiceTest.swift +++ b/MatrixSDKTests/MXSpaceServiceTest.swift @@ -32,12 +32,16 @@ class MXSpaceServiceTest: XCTestCase { override func setUpWithError() throws { // Put setup code here. This method is called before the invocation of each test method in the class. - testData = MatrixSDKTestsData() + try super.setUpWithError() + + testData = MatrixSDKTestsData() } override func tearDownWithError() throws { // Put teardown code here. This method is called after the invocation of each test method in the class. testData = nil + + try super.tearDownWithError() } // MARK: - Private diff --git a/MatrixSDKTests/MXThreadingServiceTests.swift b/MatrixSDKTests/MXThreadingServiceTests.swift index 9b306c630a..122a013b72 100644 --- a/MatrixSDKTests/MXThreadingServiceTests.swift +++ b/MatrixSDKTests/MXThreadingServiceTests.swift @@ -21,12 +21,14 @@ class MXThreadingServiceTests: XCTestCase { private var testData: MatrixSDKTestsData! override func setUp() { + super.setUp() testData = MatrixSDKTestsData() MXSDKOptions.sharedInstance().enableThreads = true } override func tearDown() { testData = nil + super.tearDown() } /// Test: Expect the threading service is initialized after creating a session diff --git a/MatrixSDKTests/MXToolsUnitTests.m b/MatrixSDKTests/MXToolsUnitTests.m index 69a3c1699f..65b58da8c9 100644 --- a/MatrixSDKTests/MXToolsUnitTests.m +++ b/MatrixSDKTests/MXToolsUnitTests.m @@ -25,16 +25,6 @@ @interface MXToolsUnitTests : XCTestCase @implementation MXToolsUnitTests -- (void)setUp -{ - [super setUp]; -} - -- (void)tearDown -{ - [super tearDown]; -} - - (void)testGenerateSecret { NSString *secret = [MXTools generateSecret]; From 8e1b3c4e28a592487c2063d5c81248cbb34d62f8 Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 27 Jul 2022 16:59:49 +0200 Subject: [PATCH 04/21] Tests: Stub MXMemoryStore.stateOfRoom () The method is optional in the protocol but some swift code requires it. Stub it to make swift code work. --- MatrixSDK/Data/Store/MXMemoryStore/MXMemoryStore.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MatrixSDK/Data/Store/MXMemoryStore/MXMemoryStore.m b/MatrixSDK/Data/Store/MXMemoryStore/MXMemoryStore.m index b0c548ea4b..1ad1146480 100644 --- a/MatrixSDK/Data/Store/MXMemoryStore/MXMemoryStore.m +++ b/MatrixSDK/Data/Store/MXMemoryStore/MXMemoryStore.m @@ -195,6 +195,11 @@ - (NSAttributedString *)partialAttributedTextMessageOfRoom:(NSString *)roomId return roomStore.partialAttributedTextMessage; } +- (void)stateOfRoom:(NSString *)roomId success:(void (^)(NSArray * _Nonnull))success failure:(void (^)(NSError * _Nonnull))failure +{ + success(@[]); +} + - (void)loadReceiptsForRoom:(NSString *)roomId completion:(void (^)(void))completion { [self getOrCreateRoomReceiptsStore:roomId]; From 55b959d7cc88694b8ed6bff5783c0733a749c697 Mon Sep 17 00:00:00 2001 From: manuroe Date: Sat, 23 Jul 2022 07:48:01 +0200 Subject: [PATCH 05/21] Tests: Create AllWorkingTests test plan with stable tests --- MatrixSDK.xcodeproj/project.pbxproj | 6 +++++ .../xcschemes/MatrixSDK-macOS.xcscheme | 3 +++ .../TestPlans/AllWorkingTests.xctestplan | 24 +++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan diff --git a/MatrixSDK.xcodeproj/project.pbxproj b/MatrixSDK.xcodeproj/project.pbxproj index 8a28c5e2c4..b6e7ced323 100644 --- a/MatrixSDK.xcodeproj/project.pbxproj +++ b/MatrixSDK.xcodeproj/project.pbxproj @@ -315,6 +315,8 @@ 32618E7220ED2DF500E1D2EA /* MXFilterJSONModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 32618E7020ED2DF500E1D2EA /* MXFilterJSONModel.m */; }; 32618E7B20EFA45B00E1D2EA /* MXRoomMembers.h in Headers */ = {isa = PBXBuildFile; fileRef = 32618E7920EFA45B00E1D2EA /* MXRoomMembers.h */; settings = {ATTRIBUTES = (Public, ); }; }; 32618E7C20EFA45B00E1D2EA /* MXRoomMembers.m in Sources */ = {isa = PBXBuildFile; fileRef = 32618E7A20EFA45B00E1D2EA /* MXRoomMembers.m */; }; + 326277F1288BC21A009A0508 /* AllWorkingTests.xctestplan in Resources */ = {isa = PBXBuildFile; fileRef = 326277F0288BC219009A0508 /* AllWorkingTests.xctestplan */; }; + 326277F2288BC21A009A0508 /* AllWorkingTests.xctestplan in Resources */ = {isa = PBXBuildFile; fileRef = 326277F0288BC219009A0508 /* AllWorkingTests.xctestplan */; }; 32637ED41E5B00400011E20D /* MXDeviceList.h in Headers */ = {isa = PBXBuildFile; fileRef = 32637ED21E5B00400011E20D /* MXDeviceList.h */; }; 32637ED51E5B00400011E20D /* MXDeviceList.m in Sources */ = {isa = PBXBuildFile; fileRef = 32637ED31E5B00400011E20D /* MXDeviceList.m */; }; 3264DB911CEC528D00B99881 /* MXAccountData.h in Headers */ = {isa = PBXBuildFile; fileRef = 3264DB8F1CEC528D00B99881 /* MXAccountData.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -2117,6 +2119,7 @@ 32618E7020ED2DF500E1D2EA /* MXFilterJSONModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXFilterJSONModel.m; sourceTree = ""; }; 32618E7920EFA45B00E1D2EA /* MXRoomMembers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXRoomMembers.h; sourceTree = ""; }; 32618E7A20EFA45B00E1D2EA /* MXRoomMembers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXRoomMembers.m; sourceTree = ""; }; + 326277F0288BC219009A0508 /* AllWorkingTests.xctestplan */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AllWorkingTests.xctestplan; sourceTree = ""; }; 32637ED21E5B00400011E20D /* MXDeviceList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXDeviceList.h; sourceTree = ""; }; 32637ED31E5B00400011E20D /* MXDeviceList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXDeviceList.m; sourceTree = ""; }; 3264DB8F1CEC528D00B99881 /* MXAccountData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXAccountData.h; sourceTree = ""; }; @@ -3742,6 +3745,7 @@ 3298ABD42637FA3100E40B06 /* TestPlans */ = { isa = PBXGroup; children = ( + 326277F0288BC219009A0508 /* AllWorkingTests.xctestplan */, 3298ABD52637FA3100E40B06 /* AllTests.xctestplan */, 3209682F26396385005D64ED /* AllTestsWithSanitizers.xctestplan */, EDC2A0E528369E740039F3D6 /* CryptoTests.xctestplan */, @@ -5982,6 +5986,7 @@ buildActionMask = 2147483647; files = ( 3298ABD62637FA3100E40B06 /* AllTests.xctestplan in Resources */, + 326277F1288BC21A009A0508 /* AllWorkingTests.xctestplan in Resources */, 3209683326396385005D64ED /* UnitTestsWithSanitizers.xctestplan in Resources */, 3298ABDD2637FB1900E40B06 /* UnitTests.xctestplan in Resources */, 3209683126396385005D64ED /* AllTestsWithSanitizers.xctestplan in Resources */, @@ -6001,6 +6006,7 @@ buildActionMask = 2147483647; files = ( 3298ABD72637FA3100E40B06 /* AllTests.xctestplan in Resources */, + 326277F2288BC21A009A0508 /* AllWorkingTests.xctestplan in Resources */, 3209683426396385005D64ED /* UnitTestsWithSanitizers.xctestplan in Resources */, 3298ABDE2637FB1900E40B06 /* UnitTests.xctestplan in Resources */, 3209683226396385005D64ED /* AllTestsWithSanitizers.xctestplan in Resources */, diff --git a/MatrixSDK.xcodeproj/xcshareddata/xcschemes/MatrixSDK-macOS.xcscheme b/MatrixSDK.xcodeproj/xcshareddata/xcschemes/MatrixSDK-macOS.xcscheme index f490df4721..bdf6494136 100644 --- a/MatrixSDK.xcodeproj/xcshareddata/xcschemes/MatrixSDK-macOS.xcscheme +++ b/MatrixSDK.xcodeproj/xcshareddata/xcschemes/MatrixSDK-macOS.xcscheme @@ -67,6 +67,9 @@ + + Date: Mon, 25 Jul 2022 16:17:21 +0200 Subject: [PATCH 06/21] AllWorkingTests: Disable test classes with tests that crash --- .../TestPlans/AllWorkingTests.xctestplan | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan b/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan index 7c7b3396dd..47f3e61fd1 100644 --- a/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan +++ b/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan @@ -13,6 +13,28 @@ }, "testTargets" : [ { + "skippedTests" : [ + "MXCrossSigningTests", + "MXCryptoBackupTests", + "MXCryptoRecoveryServiceTests", + "MXCryptoShareTests", + "MXCryptoTests", + "MXLazyLoadingTests", + "MXLocationServiceTests", + "MXMegolmEncryptionTests", + "MXRestClientExtensionsTests", + "MXRestClientNoAuthAPITests", + "MXRoomSummaryTests", + "MXRoomSummaryTrustTests", + "MXRoomTests", + "MXSessionTests", + "MXStoreFileStoreTests", + "MXStoreMemoryStoreTests", + "MXStoreRoomListDataManagerUnitTests", + "MXThreadingServiceTests", + "MXThreadingServiceUnitTests", + "MXUserTests" + ], "target" : { "containerPath" : "container:MatrixSDK.xcodeproj", "identifier" : "B1E09A0D2397FA950057C069", From 48c32dc1c5957667e4c50a9987fc78ee6a0bc81f Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 25 Jul 2022 17:23:50 +0200 Subject: [PATCH 07/21] AllWorkingTests: Disable the 22 tests that fail --- .../TestPlans/AllWorkingTests.xctestplan | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan b/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan index 47f3e61fd1..799ef5c178 100644 --- a/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan +++ b/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan @@ -14,25 +14,45 @@ "testTargets" : [ { "skippedTests" : [ + "DirectRoomTests\/testDirectRoomsRaceConditions", + "MXAggregatedEditsTests\/testEditSendAndReceive", + "MXAggregatedEditsTests\/testEditSendAndReceiveInE2ERoom", + "MXAggregatedEditsTests\/testEditServerSideInE2ERoom", + "MXAggregatedEditsTests\/testFormattedEditSendAndReceive", + "MXAutoDiscoveryTests\/testAutoDiscoveryNotJSON", + "MXAutoDiscoveryTests\/testAutoDiscoverySuccessful", + "MXAutoDiscoveryTests\/testAutoDiscoverySuccessfulWithNoContentType", "MXCrossSigningTests", "MXCryptoBackupTests", "MXCryptoRecoveryServiceTests", "MXCryptoShareTests", "MXCryptoTests", + "MXFilterTests\/testFilterAPI", + "MXFilterTests\/testFilterCache", + "MXHTTPClientTests\/testMainThread", + "MXJSONModelTests\/testModelFromJSON", + "MXJSONModelTests\/testModelsFromJSON", "MXLazyLoadingTests", "MXLocationServiceTests", "MXMegolmEncryptionTests", + "MXMyUserTests\/testIdenticon", + "MXPeekingRoomTests\/testPeekingOnNonWorldReadable", "MXRestClientExtensionsTests", "MXRestClientNoAuthAPITests", + "MXRestClientTests\/testJoinRoomWithRoomAlias", + "MXRoomListDataManagerTests\/testRoomLeave()", + "MXRoomStateTests\/testDeallocation", + "MXRoomStateTests\/testInviteByOtherInInitialSync", + "MXRoomStateTests\/testInviteByOtherInLive", "MXRoomSummaryTests", "MXRoomSummaryTrustTests", "MXRoomTests", + "MXSelfSignedHomeserverTests\/testRegiter", "MXSessionTests", "MXStoreFileStoreTests", "MXStoreMemoryStoreTests", - "MXStoreRoomListDataManagerUnitTests", + "MXStoreNoStoreTests\/testMXNoStoreSeveralPaginateBacks", "MXThreadingServiceTests", - "MXThreadingServiceUnitTests", "MXUserTests" ], "target" : { From 5152b442acca34672a068004648ed97f166d345d Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 27 Jul 2022 17:13:06 +0200 Subject: [PATCH 08/21] AllWorkingTests: Disable all unit tests we already have a dedicated test plan for them --- .../TestPlans/AllWorkingTests.xctestplan | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan b/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan index 799ef5c178..7e766d24e1 100644 --- a/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan +++ b/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan @@ -19,24 +19,51 @@ "MXAggregatedEditsTests\/testEditSendAndReceiveInE2ERoom", "MXAggregatedEditsTests\/testEditServerSideInE2ERoom", "MXAggregatedEditsTests\/testFormattedEditSendAndReceive", + "MXAggregatedEditsUnitTests", + "MXAggregatedReferenceUnitTests", + "MXAsyncTaskQueueUnitTests", + "MXAuthenticationSessionUnitTests", "MXAutoDiscoveryTests\/testAutoDiscoveryNotJSON", "MXAutoDiscoveryTests\/testAutoDiscoverySuccessful", "MXAutoDiscoveryTests\/testAutoDiscoverySuccessfulWithNoContentType", + "MXBackgroundTaskUnitTests", + "MXBeaconInfoUnitTests", + "MXCredentialsUnitTests", "MXCrossSigningTests", "MXCryptoBackupTests", "MXCryptoRecoveryServiceTests", + "MXCryptoRequestsUnitTests", "MXCryptoShareTests", "MXCryptoTests", + "MXErrorUnitTests", + "MXEventAnnotationUnitTests", + "MXEventReferenceUnitTests", + "MXEventScanStoreUnitTests", "MXFilterTests\/testFilterAPI", "MXFilterTests\/testFilterCache", + "MXFilterUnitTests", + "MXGeoURIComponentsUnitTests", "MXHTTPClientTests\/testMainThread", "MXJSONModelTests\/testModelFromJSON", "MXJSONModelTests\/testModelsFromJSON", + "MXJSONModelUnitTests", + "MXKeyProviderUnitTests", "MXLazyLoadingTests", "MXLocationServiceTests", + "MXLoggerUnitTests", + "MXMediaScanStoreUnitTests", + "MXMegolmDecryptionUnitTests", "MXMegolmEncryptionTests", + "MXMegolmExportEncryptionUnitTests", + "MXMegolmSessionDataUnitTests", + "MXMemoryRoomStoreUnitTests", "MXMyUserTests\/testIdenticon", + "MXOlmDeviceUnitTests", "MXPeekingRoomTests\/testPeekingOnNonWorldReadable", + "MXPushRuleUnitTests", + "MXQRCodeDataUnitTests", + "MXReplyEventParserUnitTests", + "MXResponseUnitTests", "MXRestClientExtensionsTests", "MXRestClientNoAuthAPITests", "MXRestClientTests\/testJoinRoomWithRoomAlias", @@ -44,15 +71,23 @@ "MXRoomStateTests\/testDeallocation", "MXRoomStateTests\/testInviteByOtherInInitialSync", "MXRoomStateTests\/testInviteByOtherInLive", + "MXRoomStateUnitTests", "MXRoomSummaryTests", "MXRoomSummaryTrustTests", "MXRoomTests", "MXSelfSignedHomeserverTests\/testRegiter", "MXSessionTests", + "MXSharedHistoryKeyManagerUnitTests", "MXStoreFileStoreTests", "MXStoreMemoryStoreTests", "MXStoreNoStoreTests\/testMXNoStoreSeveralPaginateBacks", + "MXStoreRoomListDataManagerUnitTests", + "MXSyncResponseUnitTests", + "MXTaskQueueUnitTests", + "MXThreadEventTimelineUnitTests", "MXThreadingServiceTests", + "MXThreadingServiceUnitTests", + "MXToolsUnitTests", "MXUserTests" ], "target" : { From cf71bb209c3ae78e550dcb7ccbf588cdc5f88ccf Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 27 Jul 2022 17:26:49 +0200 Subject: [PATCH 09/21] Tests: Run working integration tests on every PR --- .github/workflows/ci-integration-tests.yml | 91 ++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/workflows/ci-integration-tests.yml diff --git a/.github/workflows/ci-integration-tests.yml b/.github/workflows/ci-integration-tests.yml new file mode 100644 index 0000000000..ad6781204e --- /dev/null +++ b/.github/workflows/ci-integration-tests.yml @@ -0,0 +1,91 @@ +name: Integration Tests CI + +on: + # Triggers the workflow on any pull request and push to develop + push: + branches: [ develop ] + pull_request: + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + integration-tests: + name: Integration Tests + runs-on: macos-11 + + concurrency: + # When running on develop, use the sha to allow all runs of this workflow to run concurrently. + # Otherwise only allow a single run of this workflow on each branch, automatically cancelling older runs. + group: ${{ github.ref == 'refs/heads/develop' && format('tests-integration-develop-{0}', github.sha) || format('tests-integration-{0}', github.ref) }} + cancel-in-progress: true + + steps: + - uses: actions/checkout@v2 + + # Common cache + # Note: GH actions do not support yaml anchor yet. We need to duplicate this for every job + - uses: actions/cache@v2 + with: + path: Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + - uses: actions/cache@v2 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + # Cache for python env for Synapse + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Cache pip + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + + # Set up a Synapse server + - name: Start synapse server + uses: michaelkaye/setup-matrix-synapse@v1.0.3 + with: + uploadLogs: true + httpPort: 8080 + disableRateLimiting: true + + # Common setup + # Note: GH actions do not support yaml anchor yet. We need to duplicate this for every job + - name: Bundle install + run: | + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + # Main step + - name: Integration tests + run: bundle exec fastlane test testplan:AllWorkingTests + + # Store artifacts + - uses: actions/upload-artifact@v2 + if: always() + with: + name: report.html + path: build/test/report.html + - uses: actions/upload-artifact@v2 + if: always() + with: + name: report.junit + path: build/test/report.junit + - uses: actions/upload-artifact@v2 + if: always() + with: + name: MatrixSDK-macOS.xcresult + path: build/test/MatrixSDK-macOS.xcresult/ + + # Upload coverage + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 \ No newline at end of file From 77af3682d146c6ea2fc01d1e25bb75aa9fd7dca5 Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 27 Jul 2022 17:29:21 +0200 Subject: [PATCH 10/21] Crypto tests CI: Expose tests report on failure and share code coverage --- .github/workflows/ci-crypto-tests.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-crypto-tests.yml b/.github/workflows/ci-crypto-tests.yml index 6b932b73b6..60bc264fa3 100644 --- a/.github/workflows/ci-crypto-tests.yml +++ b/.github/workflows/ci-crypto-tests.yml @@ -36,7 +36,6 @@ jobs: restore-keys: | ${{ runner.os }}-pip- ${{ runner.os }}- - # Cache for Xcode env - uses: actions/cache@v2 with: @@ -50,7 +49,6 @@ jobs: key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} restore-keys: | ${{ runner.os }}-gems- - - name: Start synapse server uses: michaelkaye/setup-matrix-synapse@v1.0.3 with: @@ -62,21 +60,27 @@ jobs: run: | bundle config path vendor/bundle bundle install --jobs 4 --retry 3 - # Main step - name: Crypto tests run: bundle exec fastlane test testplan:CryptoTests # Store artifacts - uses: actions/upload-artifact@v2 + if: always() with: name: report.html path: build/test/report.html - uses: actions/upload-artifact@v2 + if: always() with: name: report.junit path: build/test/report.junit - uses: actions/upload-artifact@v2 + if: always() with: name: MatrixSDK-macOS.xcresult path: build/test/MatrixSDK-macOS.xcresult/ + + # Upload coverage + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 From 32764559f0999c7caeefda684c86b631302b0d3c Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 27 Jul 2022 17:41:56 +0200 Subject: [PATCH 11/21] AllWorkingTests: Disabled commented tests --- MatrixSDKTests/MXLocationServiceTests.swift | 254 +++++++++--------- MatrixSDKTests/MXPollAggregatorTests.swift | 100 +++---- .../TestPlans/AllWorkingTests.xctestplan | 1 + 3 files changed, 178 insertions(+), 177 deletions(-) diff --git a/MatrixSDKTests/MXLocationServiceTests.swift b/MatrixSDKTests/MXLocationServiceTests.swift index c4cd885945..6e829768db 100644 --- a/MatrixSDKTests/MXLocationServiceTests.swift +++ b/MatrixSDKTests/MXLocationServiceTests.swift @@ -300,133 +300,133 @@ class MXLocationServiceTests: XCTestCase { /// - Alice start location sharing once /// - Alice start location sharing twice /// - Expect Bob to see only one beacon info summary from Alice available in the room -// func testStartingLiveLocationSharingTwiceOtherUser() { -// -// let aliceStore = MXMemoryStore() -// let bobStore = MXMemoryStore() -// testData.doTestWithAliceAndBob(inARoom: self, aliceStore: aliceStore, bobStore: bobStore) { (aliceSession, bobSession, roomId, expectation) in -// -// guard let aliceSession = aliceSession, -// let bobSession = bobSession, -// let roomId = roomId, -// let expectation = expectation else { -// XCTFail("Failed to setup test conditions") -// return -// } -// -// guard let room = bobSession.room(withRoomId: roomId) else { -// XCTFail("Failed to retrieve room") -// expectation.fulfill() -// return -// } -// -// let expectedBeaconInfoDescription = "Live location description" -// let expectedBeaconInfoTimeout: TimeInterval = 600000 -// let expectedPowerLevel = 50 -// -// // Allow Alice to send beacon info state event -// room.setPowerLevel(ofUser: aliceSession.myUserId, powerLevel: expectedPowerLevel, completion: { response in -// -// switch response { -// case .success: -// -// guard let aliceRoom = aliceSession.room(withRoomId: roomId) else { -// XCTFail("Failed to retrieve room") -// expectation.fulfill() -// return -// } -// -// aliceRoom.liveTimeline { liveTimeline in -// -// guard let liveTimeline = liveTimeline else { -// XCTFail("liveTimeline is nil") -// expectation.fulfill() -// return -// } -// -// _ = liveTimeline.listenToEvents([.roomPowerLevels], { event, direction, state in -// -// XCTAssertEqual(liveTimeline.state?.powerLevels.powerLevelOfUser(withUserID: aliceSession.myUserId), expectedPowerLevel); -// -// let aliceLocationService: MXLocationService = aliceSession.locationService -// -// // Alice start location sharing once -// aliceLocationService.startUserLocationSharing(withRoomId: roomId, description: expectedBeaconInfoDescription, timeout: expectedBeaconInfoTimeout) { response in -// -// switch response { -// case .success(let firstBeaconInfoEventId): -// -// // Alice start location sharing twice -// aliceLocationService.startUserLocationSharing(withRoomId: roomId, description: expectedBeaconInfoDescription, timeout: expectedBeaconInfoTimeout) { response in -// -// switch response { -// case .success(let secondBeaconInfoEventId): -// // Wait for room summary update and check if beacon info are populated in the room summary -// -// var firstUpdateListener: Any? -// -// firstUpdateListener = bobSession.aggregations.beaconAggregations.listenToBeaconInfoSummaryUpdateInRoom(withId: roomId) { beaconInfoSummary in -// -// guard beaconInfoSummary.id == secondBeaconInfoEventId else { -// return -// } -// -// if let firstUpdateListener = firstUpdateListener { -// bobSession.aggregations.removeListener(firstUpdateListener) -// } -// -// let bobLocationService: MXLocationService = bobSession.locationService -// -// let beaconInfoSummaries = bobLocationService.getBeaconInfoSummaries(inRoomWithId: roomId) -// -// XCTAssertEqual(beaconInfoSummaries.count, 2) -// -// let liveBeaconInfoSummaries = bobLocationService.getLiveBeaconInfoSummaries(inRoomWithId: roomId) -// -// // Bob should see only one live beacon info summary in the room from Alice -// XCTAssertEqual(liveBeaconInfoSummaries.count, 1) -// -// -// // Check first beacon info summary from Alice -// let firstBeaconInfoSummary = bobSession.aggregations.beaconAggregations.beaconInfoSummary(for: firstBeaconInfoEventId, inRoomWithId: roomId) -// -// XCTAssertNotNil(firstBeaconInfoSummary) -// -// if let firstBeaconInfoSummary = firstBeaconInfoSummary { -// XCTAssertFalse(firstBeaconInfoSummary.beaconInfo.isLive) -// } -// -// // Check last beacon info summary from Alice -// let secondBeaconInfoSummary = bobSession.aggregations.beaconAggregations.beaconInfoSummary(for: secondBeaconInfoEventId, inRoomWithId: roomId) -// -// XCTAssertNotNil(secondBeaconInfoSummary) -// -// if let secondBeaconInfoSummary = secondBeaconInfoSummary { -// XCTAssertTrue(secondBeaconInfoSummary.beaconInfo.isLive) -// } -// -// expectation.fulfill() -// } -// case .failure(let error): -// XCTFail("Start location sharing fails with error: \(error)") -// expectation.fulfill() -// } -// } -// case .failure(let error): -// XCTFail("Start location sharing fails with error: \(error)") -// expectation.fulfill() -// } -// } -// -// }) -// } -// case .failure(let error): -// XCTFail("Set power level fails with error: \(error)") -// expectation.fulfill() -// } -// }) -// } -// } + func testStartingLiveLocationSharingTwiceOtherUser() { + + let aliceStore = MXMemoryStore() + let bobStore = MXMemoryStore() + testData.doTestWithAliceAndBob(inARoom: self, aliceStore: aliceStore, bobStore: bobStore) { (aliceSession, bobSession, roomId, expectation) in + + guard let aliceSession = aliceSession, + let bobSession = bobSession, + let roomId = roomId, + let expectation = expectation else { + XCTFail("Failed to setup test conditions") + return + } + + guard let room = bobSession.room(withRoomId: roomId) else { + XCTFail("Failed to retrieve room") + expectation.fulfill() + return + } + + let expectedBeaconInfoDescription = "Live location description" + let expectedBeaconInfoTimeout: TimeInterval = 600000 + let expectedPowerLevel = 50 + + // Allow Alice to send beacon info state event + room.setPowerLevel(ofUser: aliceSession.myUserId, powerLevel: expectedPowerLevel, completion: { response in + + switch response { + case .success: + + guard let aliceRoom = aliceSession.room(withRoomId: roomId) else { + XCTFail("Failed to retrieve room") + expectation.fulfill() + return + } + + aliceRoom.liveTimeline { liveTimeline in + + guard let liveTimeline = liveTimeline else { + XCTFail("liveTimeline is nil") + expectation.fulfill() + return + } + + _ = liveTimeline.listenToEvents([.roomPowerLevels], { event, direction, state in + + XCTAssertEqual(liveTimeline.state?.powerLevels.powerLevelOfUser(withUserID: aliceSession.myUserId), expectedPowerLevel); + + let aliceLocationService: MXLocationService = aliceSession.locationService + + // Alice start location sharing once + aliceLocationService.startUserLocationSharing(withRoomId: roomId, description: expectedBeaconInfoDescription, timeout: expectedBeaconInfoTimeout) { response in + + switch response { + case .success(let firstBeaconInfoEventId): + + // Alice start location sharing twice + aliceLocationService.startUserLocationSharing(withRoomId: roomId, description: expectedBeaconInfoDescription, timeout: expectedBeaconInfoTimeout) { response in + + switch response { + case .success(let secondBeaconInfoEventId): + // Wait for room summary update and check if beacon info are populated in the room summary + + var firstUpdateListener: Any? + + firstUpdateListener = bobSession.aggregations.beaconAggregations.listenToBeaconInfoSummaryUpdateInRoom(withId: roomId) { beaconInfoSummary in + + guard beaconInfoSummary.id == secondBeaconInfoEventId else { + return + } + + if let firstUpdateListener = firstUpdateListener { + bobSession.aggregations.removeListener(firstUpdateListener) + } + + let bobLocationService: MXLocationService = bobSession.locationService + + let beaconInfoSummaries = bobLocationService.getBeaconInfoSummaries(inRoomWithId: roomId) + + XCTAssertEqual(beaconInfoSummaries.count, 2) + + let liveBeaconInfoSummaries = bobLocationService.getLiveBeaconInfoSummaries(inRoomWithId: roomId) + + // Bob should see only one live beacon info summary in the room from Alice + XCTAssertEqual(liveBeaconInfoSummaries.count, 1) + + + // Check first beacon info summary from Alice + let firstBeaconInfoSummary = bobSession.aggregations.beaconAggregations.beaconInfoSummary(for: firstBeaconInfoEventId, inRoomWithId: roomId) + + XCTAssertNotNil(firstBeaconInfoSummary) + + if let firstBeaconInfoSummary = firstBeaconInfoSummary { + XCTAssertFalse(firstBeaconInfoSummary.beaconInfo.isLive) + } + + // Check last beacon info summary from Alice + let secondBeaconInfoSummary = bobSession.aggregations.beaconAggregations.beaconInfoSummary(for: secondBeaconInfoEventId, inRoomWithId: roomId) + + XCTAssertNotNil(secondBeaconInfoSummary) + + if let secondBeaconInfoSummary = secondBeaconInfoSummary { + XCTAssertTrue(secondBeaconInfoSummary.beaconInfo.isLive) + } + + expectation.fulfill() + } + case .failure(let error): + XCTFail("Start location sharing fails with error: \(error)") + expectation.fulfill() + } + } + case .failure(let error): + XCTFail("Start location sharing fails with error: \(error)") + expectation.fulfill() + } + } + + }) + } + case .failure(let error): + XCTFail("Set power level fails with error: \(error)") + expectation.fulfill() + } + }) + } + } // MARK: - Private diff --git a/MatrixSDKTests/MXPollAggregatorTests.swift b/MatrixSDKTests/MXPollAggregatorTests.swift index 4596329e85..da236d8b26 100644 --- a/MatrixSDKTests/MXPollAggregatorTests.swift +++ b/MatrixSDKTests/MXPollAggregatorTests.swift @@ -68,29 +68,29 @@ class MXPollAggregatorTest: XCTestCase { } } -// func testSessionPausing() { -// self.createScenarioForBobAndAlice { bobSession, aliceSession, bobRoom, aliceRoom, pollStartEvent, expectation in -// self.pollAggregator = try! PollAggregator(session: bobSession, room: bobRoom, pollStartEventId: pollStartEvent.eventId) -// -// XCTAssertEqual(self.pollAggregator.poll.answerOptions.first!.count, 1) // One from Alice -// XCTAssertEqual(self.pollAggregator.poll.answerOptions.last!.count, 0) -// -// bobSession.pause() -// -// self.pollAggregator.delegate = PollAggregatorBlockWrapper(dataUpdateCallback: { -// XCTAssertEqual(self.pollAggregator.poll.answerOptions.first!.count, 2) -// XCTAssertEqual(self.pollAggregator.poll.answerOptions.last!.count, 0) -// }) -// -// bobRoom.sendPollResponse(for: pollStartEvent, withAnswerIdentifiers: ["1"], threadId:nil, localEcho: nil) { _ in -// bobSession.resume { -// expectation.fulfill() -// } -// } failure: { error in -// XCTFail("The operation should not fail - NSError: \(String(describing: error))") -// } -// } -// } + func testSessionPausing() { + self.createScenarioForBobAndAlice { bobSession, aliceSession, bobRoom, aliceRoom, pollStartEvent, expectation in + self.pollAggregator = try! PollAggregator(session: bobSession, room: bobRoom, pollStartEventId: pollStartEvent.eventId) + + XCTAssertEqual(self.pollAggregator.poll.answerOptions.first!.count, 1) // One from Alice + XCTAssertEqual(self.pollAggregator.poll.answerOptions.last!.count, 0) + + bobSession.pause() + + self.pollAggregator.delegate = PollAggregatorBlockWrapper(dataUpdateCallback: { + XCTAssertEqual(self.pollAggregator.poll.answerOptions.first!.count, 2) + XCTAssertEqual(self.pollAggregator.poll.answerOptions.last!.count, 0) + }) + + bobRoom.sendPollResponse(for: pollStartEvent, withAnswerIdentifiers: ["1"], threadId:nil, localEcho: nil) { _ in + bobSession.resume { + expectation.fulfill() + } + } failure: { error in + XCTFail("The operation should not fail - NSError: \(String(describing: error))") + } + } + } func testGappySync() { self.createScenarioForBobAndAlice { bobSession, aliceSession, bobRoom, aliceRoom, pollStartEvent, expectation in @@ -127,33 +127,33 @@ class MXPollAggregatorTest: XCTestCase { } } -// func testEditing() { -// self.createScenarioForBobAndAlice { bobSession, aliceSession, bobRoom, aliceRoom, pollStartEvent, expectation in -// self.pollAggregator = try! PollAggregator(session: bobSession, room: bobRoom, pollStartEventId: pollStartEvent.eventId) -// -// let oldContent = MXEventContentPollStart(fromJSON: pollStartEvent.content)! -// let newContent = MXEventContentPollStart(question: "Some other question", -// kind: oldContent.kind, -// maxSelections: oldContent.maxSelections, -// answerOptions: []) -// -// self.pollAggregator.delegate = PollAggregatorBlockWrapper(dataUpdateCallback: { -// -// XCTAssertEqual(self.pollAggregator.poll.text, "Some other question") -// XCTAssertEqual(self.pollAggregator.poll.answerOptions.count, 0) -// XCTAssertTrue(self.pollAggregator.poll.hasBeenEdited) -// -// expectation.fulfill() -// self.pollAggregator.delegate = nil -// }) -// -// bobRoom.sendPollUpdate(for: pollStartEvent, oldContent: oldContent, newContent: newContent, localEcho: nil) { result in -// -// } failure: { error in -// XCTFail("The operation should not fail - NSError: \(String(describing: error))") -// } -// } -// } + func testEditing() { + self.createScenarioForBobAndAlice { bobSession, aliceSession, bobRoom, aliceRoom, pollStartEvent, expectation in + self.pollAggregator = try! PollAggregator(session: bobSession, room: bobRoom, pollStartEventId: pollStartEvent.eventId) + + let oldContent = MXEventContentPollStart(fromJSON: pollStartEvent.content)! + let newContent = MXEventContentPollStart(question: "Some other question", + kind: oldContent.kind, + maxSelections: oldContent.maxSelections, + answerOptions: []) + + self.pollAggregator.delegate = PollAggregatorBlockWrapper(dataUpdateCallback: { + + XCTAssertEqual(self.pollAggregator.poll.text, "Some other question") + XCTAssertEqual(self.pollAggregator.poll.answerOptions.count, 0) + XCTAssertTrue(self.pollAggregator.poll.hasBeenEdited) + + expectation.fulfill() + self.pollAggregator.delegate = nil + }) + + bobRoom.sendPollUpdate(for: pollStartEvent, oldContent: oldContent, newContent: newContent, localEcho: nil) { result in + + } failure: { error in + XCTFail("The operation should not fail - NSError: \(String(describing: error))") + } + } + } // MARK: - Private diff --git a/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan b/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan index 7e766d24e1..d8322dc0f8 100644 --- a/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan +++ b/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan @@ -60,6 +60,7 @@ "MXMyUserTests\/testIdenticon", "MXOlmDeviceUnitTests", "MXPeekingRoomTests\/testPeekingOnNonWorldReadable", + "MXPollAggregatorTest\/testEditing()", "MXPushRuleUnitTests", "MXQRCodeDataUnitTests", "MXReplyEventParserUnitTests", From 4bd5d279f08bef4c123e3be58cae5dd54545aec9 Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 27 Jul 2022 18:30:43 +0200 Subject: [PATCH 12/21] changelog --- changelog.d/pr-1537.change | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/pr-1537.change diff --git a/changelog.d/pr-1537.change b/changelog.d/pr-1537.change new file mode 100644 index 0000000000..dab4f7adad --- /dev/null +++ b/changelog.d/pr-1537.change @@ -0,0 +1 @@ +CI: Enable integration tests on GitHub actions \ No newline at end of file From 86ea3bfe8557000bf9064d7e05f8c4e9b2a21bb5 Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 27 Jul 2022 18:32:16 +0200 Subject: [PATCH 13/21] AllWorkingTests: Disable tests that do not pass on GH actions --- .../TestPlans/AllWorkingTests.xctestplan | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan b/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan index d8322dc0f8..24fd2e67a5 100644 --- a/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan +++ b/MatrixSDKTests/TestPlans/AllWorkingTests.xctestplan @@ -14,25 +14,45 @@ "testTargets" : [ { "skippedTests" : [ + "DirectRoomTests\/testDirectRoomsAfterInitialSync", "DirectRoomTests\/testDirectRoomsRaceConditions", + "DirectRoomTests\/testSummaryAfterInitialSyncAndStorage", "MXAggregatedEditsTests\/testEditSendAndReceive", "MXAggregatedEditsTests\/testEditSendAndReceiveInE2ERoom", + "MXAggregatedEditsTests\/testEditServerSide", "MXAggregatedEditsTests\/testEditServerSideInE2ERoom", + "MXAggregatedEditsTests\/testEditsFromInitialSync", + "MXAggregatedEditsTests\/testFormatedEditsFromInitialSync", "MXAggregatedEditsTests\/testFormattedEditSendAndReceive", "MXAggregatedEditsUnitTests", "MXAggregatedReferenceUnitTests", "MXAsyncTaskQueueUnitTests", "MXAuthenticationSessionUnitTests", + "MXAggregatedEditsTests\/testFormattedEditServerSide", + "MXAggregatedReactionTests\/testAggregationsFromInitialSync", + "MXAggregatedReactionTests\/testReactionsWhenPaginatingFromAGappyInitialSync", + "MXAggregatedReactionTests\/testReactionsWhenPaginatingFromAGappySync", + "MXAggregatedReactionTests\/testUnreactAfterInitialSync", + "MXAggregatedReferenceTests\/testReferenceFromInitialSync", "MXAutoDiscoveryTests\/testAutoDiscoveryNotJSON", "MXAutoDiscoveryTests\/testAutoDiscoverySuccessful", "MXAutoDiscoveryTests\/testAutoDiscoverySuccessfulWithNoContentType", "MXBackgroundTaskUnitTests", "MXBeaconInfoUnitTests", "MXCredentialsUnitTests", + "MXBackgroundSyncServiceTests\/testStoreWithGappyAndOutdatedSync()", "MXCrossSigningTests", + "MXCrossSigningVerificationTests", + "MXCrossSigningVerificationTests\/testVerificationByDMFullFlow", + "MXCrossSigningVerificationTests\/testVerifyingAnotherUserQRCodeVerificationFullFlow", "MXCryptoBackupTests", + "MXCryptoKeyVerificationTests", + "MXCryptoKeyVerificationTests\/testVerificationByDMFullFlow", + "MXCryptoKeyVerificationTests\/testVerificationByDMWithAUserWith2Devices", + "MXCryptoKeyVerificationTests\/testVerificationByDMWithAliceWith2Devices", "MXCryptoRecoveryServiceTests", "MXCryptoRequestsUnitTests", + "MXCryptoSecretShareTests\/testSecretRequestCancellation", "MXCryptoShareTests", "MXCryptoTests", "MXErrorUnitTests", @@ -60,6 +80,7 @@ "MXMyUserTests\/testIdenticon", "MXOlmDeviceUnitTests", "MXPeekingRoomTests\/testPeekingOnNonWorldReadable", + "MXPollRelationTests\/testBobAndAliceAnswer", "MXPollAggregatorTest\/testEditing()", "MXPushRuleUnitTests", "MXQRCodeDataUnitTests", @@ -68,7 +89,9 @@ "MXRestClientExtensionsTests", "MXRestClientNoAuthAPITests", "MXRestClientTests\/testJoinRoomWithRoomAlias", + "MXRoomListDataManagerTests\/testNewRoomInvite()", "MXRoomListDataManagerTests\/testRoomLeave()", + "MXRoomListDataManagerTests\/testRoomUpdateWhenReceivingEvent()", "MXRoomStateTests\/testDeallocation", "MXRoomStateTests\/testInviteByOtherInInitialSync", "MXRoomStateTests\/testInviteByOtherInLive", @@ -76,7 +99,11 @@ "MXRoomSummaryTests", "MXRoomSummaryTrustTests", "MXRoomTests", + "MXSelfSignedHomeserverTests\/testE2ERoomAndMessages", + "MXSelfSignedHomeserverTests\/testNotTrustedCertificate", "MXSelfSignedHomeserverTests\/testRegiter", + "MXSelfSignedHomeserverTests\/testRoomAndMessages", + "MXSelfSignedHomeserverTests\/testTrustedCertificate", "MXSessionTests", "MXSharedHistoryKeyManagerUnitTests", "MXStoreFileStoreTests", From db9114b2b1d62008289a7e103f759bdab65a87ee Mon Sep 17 00:00:00 2001 From: manuroe Date: Thu, 28 Jul 2022 09:23:59 +0200 Subject: [PATCH 14/21] Empty commit to wake codecov --- .github/workflows/ci-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-integration-tests.yml b/.github/workflows/ci-integration-tests.yml index ad6781204e..694840f7f3 100644 --- a/.github/workflows/ci-integration-tests.yml +++ b/.github/workflows/ci-integration-tests.yml @@ -88,4 +88,4 @@ jobs: # Upload coverage - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 \ No newline at end of file + uses: codecov/codecov-action@v3 From 339b12c8443906cb8fc02a10f684ccf00653b999 Mon Sep 17 00:00:00 2001 From: Doug Date: Mon, 1 Aug 2022 16:21:59 +0100 Subject: [PATCH 15/21] Send an empty dictionary when calling /join to be spec compliant. --- MatrixSDK/MXRestClient.m | 5 +++++ changelog.d/6481.bugfix | 1 + 2 files changed, 6 insertions(+) create mode 100644 changelog.d/6481.bugfix diff --git a/MatrixSDK/MXRestClient.m b/MatrixSDK/MXRestClient.m index 5d0c8fa39f..8060837d0f 100644 --- a/MatrixSDK/MXRestClient.m +++ b/MatrixSDK/MXRestClient.m @@ -2470,6 +2470,11 @@ - (MXHTTPOperation*)joinRoom:(NSString*)roomIdOrAlias @"third_party_signed":thirdPartySigned }; } + else + { + // A body is required even if empty + parameters = @{}; + } // Characters in a room alias need to be escaped in the URL NSString *path = [NSString stringWithFormat:@"%@/join/%@", diff --git a/changelog.d/6481.bugfix b/changelog.d/6481.bugfix new file mode 100644 index 0000000000..8b2e49a307 --- /dev/null +++ b/changelog.d/6481.bugfix @@ -0,0 +1 @@ +MXRestClient: Send an empty dictionary when calling /join to be spec compliant. \ No newline at end of file From b608e5f025755e6306d5a1e5344f3ff375c71165 Mon Sep 17 00:00:00 2001 From: Gil Eluard Date: Tue, 2 Aug 2022 17:26:41 +0200 Subject: [PATCH 16/21] Delight edit layout experiment (#1515) * Delight: Edit layout experiment #6079 * Update All chats screen with latest design #6407 --- MatrixSDK.xcodeproj/project.pbxproj | 6 + MatrixSDK/Data/MXRoomSummary.m | 4 + MatrixSDK/Data/MXRoomSummaryDataTypes.h | 3 +- .../MXBreadcrumbsRoomListDataFetcher.swift | 149 ++++++++++++++++++ .../Common/MXRoomListDataSortable.swift | 4 + .../MXCoreDataRoomListDataFetcher.swift | 4 + .../MXCoreDataRoomListDataManager.swift | 3 + .../MXRoomListDataFilterOptions.swift | 6 + .../RoomList/MXRoomListDataSortOptions.swift | 9 ++ .../MXStore/MXStoreRoomListDataManager.swift | 3 + MatrixSDK/MXRestClient.h | 2 + MatrixSDK/MXRestClient.m | 2 + MatrixSDK/MXSession.h | 5 + MatrixSDK/MXSession.m | 37 +++++ changelog.d/6407.change | 1 + 15 files changed, 237 insertions(+), 1 deletion(-) create mode 100644 MatrixSDK/Data/RoomList/Common/MXBreadcrumbsRoomListDataFetcher.swift create mode 100644 changelog.d/6407.change diff --git a/MatrixSDK.xcodeproj/project.pbxproj b/MatrixSDK.xcodeproj/project.pbxproj index b6e7ced323..88b2d6d746 100644 --- a/MatrixSDK.xcodeproj/project.pbxproj +++ b/MatrixSDK.xcodeproj/project.pbxproj @@ -675,6 +675,8 @@ 3A23A740256D322C00B9D00F /* MXAes.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A23A73D256D322C00B9D00F /* MXAes.m */; }; 3A23A741256D322C00B9D00F /* MXAes.h in Headers */ = {isa = PBXBuildFile; fileRef = 3A23A73E256D322C00B9D00F /* MXAes.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3A23A742256D322C00B9D00F /* MXAes.h in Headers */ = {isa = PBXBuildFile; fileRef = 3A23A73E256D322C00B9D00F /* MXAes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3A5787A528982D4600A0D8A8 /* MXBreadcrumbsRoomListDataFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A5787A428982D4600A0D8A8 /* MXBreadcrumbsRoomListDataFetcher.swift */; }; + 3A5787A628982D4600A0D8A8 /* MXBreadcrumbsRoomListDataFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A5787A428982D4600A0D8A8 /* MXBreadcrumbsRoomListDataFetcher.swift */; }; 3A59A49D25A7A16F00DDA1FC /* MXOlmOutboundGroupSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 3A59A49B25A7A16E00DDA1FC /* MXOlmOutboundGroupSession.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3A59A49E25A7A16F00DDA1FC /* MXOlmOutboundGroupSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 3A59A49B25A7A16E00DDA1FC /* MXOlmOutboundGroupSession.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3A59A49F25A7A16F00DDA1FC /* MXOlmOutboundGroupSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A59A49C25A7A16F00DDA1FC /* MXOlmOutboundGroupSession.m */; }; @@ -2422,6 +2424,7 @@ 3A108E6625826F52005EEBE9 /* MXKeyProviderUnitTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXKeyProviderUnitTests.m; sourceTree = ""; }; 3A23A73D256D322C00B9D00F /* MXAes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXAes.m; sourceTree = ""; }; 3A23A73E256D322C00B9D00F /* MXAes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXAes.h; sourceTree = ""; }; + 3A5787A428982D4600A0D8A8 /* MXBreadcrumbsRoomListDataFetcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MXBreadcrumbsRoomListDataFetcher.swift; sourceTree = ""; }; 3A59A49B25A7A16E00DDA1FC /* MXOlmOutboundGroupSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXOlmOutboundGroupSession.h; sourceTree = ""; }; 3A59A49C25A7A16F00DDA1FC /* MXOlmOutboundGroupSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXOlmOutboundGroupSession.m; sourceTree = ""; }; 3A59A52725A7B1B000DDA1FC /* MXOutboundSessionInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXOutboundSessionInfo.h; sourceTree = ""; }; @@ -4692,6 +4695,7 @@ EC1165A927107E330089FA56 /* MXSuggestedRoomListDataCache.swift */, EC0B941D27186C3500B4D440 /* MXRoomListDataSortable.swift */, EC0B942027186D4600B4D440 /* MXRoomListDataFilterable.swift */, + 3A5787A428982D4600A0D8A8 /* MXBreadcrumbsRoomListDataFetcher.swift */, ); path = Common; sourceTree = ""; @@ -6147,6 +6151,7 @@ 32B76EA520FDE85100B095F6 /* MXRoomMembersCount.m in Sources */, 3AD4F231274B922D003F47FE /* MXRoomAliasAvailabilityChecker.swift in Sources */, B1710B1F2613D01400A9B429 /* MXSpaceChildrenRequestParameters.swift in Sources */, + 3A5787A528982D4600A0D8A8 /* MXBreadcrumbsRoomListDataFetcher.swift in Sources */, 32CEEF4B23B0A8170039BA98 /* MXCrossSigningTools.m in Sources */, EC8A53A525B1BC77004E0802 /* MXCallInviteEventContent.m in Sources */, 323F877D25546170009E9E67 /* MXBaseProfiler.m in Sources */, @@ -6715,6 +6720,7 @@ B16C56E3261D0A9D00604765 /* MXSpaceChildInfo.swift in Sources */, 3AD4F232274B922D003F47FE /* MXRoomAliasAvailabilityChecker.swift in Sources */, B14EF1D52397E90400758AF0 /* MXEventAnnotation.m in Sources */, + 3A5787A628982D4600A0D8A8 /* MXBreadcrumbsRoomListDataFetcher.swift in Sources */, B14EF1D62397E90400758AF0 /* MXPusher.m in Sources */, B14EF1D72397E90400758AF0 /* MXMediaLoader.m in Sources */, 32549AF823F2E2790002576B /* MXKeyVerificationReady.m in Sources */, diff --git a/MatrixSDK/Data/MXRoomSummary.m b/MatrixSDK/Data/MXRoomSummary.m index cc5596e948..8cde4381e9 100644 --- a/MatrixSDK/Data/MXRoomSummary.m +++ b/MatrixSDK/Data/MXRoomSummary.m @@ -1106,6 +1106,10 @@ - (MXRoomSummaryDataTypes)calculateDataTypes { result |= MXRoomSummaryDataTypesConferenceUser; } + if (self.hasAnyUnread) + { + result |= MXRoomSummaryDataTypesUnread; + } return result; } diff --git a/MatrixSDK/Data/MXRoomSummaryDataTypes.h b/MatrixSDK/Data/MXRoomSummaryDataTypes.h index ca4e989eb1..bdc49928c8 100644 --- a/MatrixSDK/Data/MXRoomSummaryDataTypes.h +++ b/MatrixSDK/Data/MXRoomSummaryDataTypes.h @@ -26,7 +26,8 @@ typedef NS_OPTIONS(NSInteger, MXRoomSummaryDataTypes) MXRoomSummaryDataTypesServerNotice = 1 << 4, MXRoomSummaryDataTypesHidden = 1 << 5, MXRoomSummaryDataTypesSpace = 1 << 6, - MXRoomSummaryDataTypesConferenceUser = 1 << 7 + MXRoomSummaryDataTypesConferenceUser = 1 << 7, + MXRoomSummaryDataTypesUnread = 1 << 8 }; #endif /* MXRoomSummaryDataTypes_h */ diff --git a/MatrixSDK/Data/RoomList/Common/MXBreadcrumbsRoomListDataFetcher.swift b/MatrixSDK/Data/RoomList/Common/MXBreadcrumbsRoomListDataFetcher.swift new file mode 100644 index 0000000000..1a5263985f --- /dev/null +++ b/MatrixSDK/Data/RoomList/Common/MXBreadcrumbsRoomListDataFetcher.swift @@ -0,0 +1,149 @@ +// +// Copyright 2022 The Matrix.org Foundation C.I.C +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import Foundation + +@objcMembers +internal class MXBreadcrumbsRoomListDataFetcher: NSObject, MXRoomListDataFetcher { + internal var fetchOptions: MXRoomListDataFetchOptions + private weak var session: MXSession? + private var recentsRooms: [String] = [] + + private var allRoomSummaries: [MXRoomSummaryProtocol] = [] + private var sessionSyncObserver: Any? + + private var recentRoomIds: [String] = [] + + private let multicastDelegate: MXMulticastDelegate = MXMulticastDelegate() + + var data: MXRoomListData? { + didSet { + guard data != nil else { + // do not notify when stopped + return + } + + notifyDataChange() + } + } + + internal init(fetchOptions: MXRoomListDataFetchOptions, + session: MXSession?) { + self.fetchOptions = fetchOptions + self.session = session + super.init() + self.fetchOptions.fetcher = self + self.refresh() + self.addDataObservers() + } + + // MARK: - Delegate + + func addDelegate(_ delegate: MXRoomListDataFetcherDelegate) { + multicastDelegate.addDelegate(delegate) + } + + func removeDelegate(_ delegate: MXRoomListDataFetcherDelegate) { + multicastDelegate.removeDelegate(delegate) + } + + func removeAllDelegates() { + multicastDelegate.removeAllDelegates() + } + + internal func notifyDataChange() { + multicastDelegate.invoke({ $0.fetcherDidChangeData(self, totalCountsChanged: true) }) + } + + func paginate() { + // Do nothing. We don't paginate breadcrumbs + } + + func resetPagination() { + // Do nothing. We don't paginate breadcrumbs + } + + // MARK: - Public + + func refresh() { + guard let breadcrumbs = session?.accountData?.accountData(forEventType: kMXAccountDataTypeBreadcrumbs) as? [AnyHashable: [String]] else { + MXLog.warning("[MXBreadcrumbsRoomListDataFetcher] cannot retrieve breadcrumbs") + return + } + + guard var recentRoomIds = breadcrumbs[kMXAccountDataTypeRecentRoomsKey] else { + MXLog.warning("[MXBreadcrumbsRoomListDataFetcher] cannot retrieve recent rooms") + return + } + + if let query = fetchOptions.filterOptions.query?.lowercased(), !query.isEmpty { + recentRoomIds = recentRoomIds.filter({ roomId in + guard let summary = session?.roomSummary(withRoomId: roomId) else { + return false + } + return summary.displayname.lowercased().contains(query) + }) + } + + guard self.recentRoomIds != recentRoomIds else { + // Nothing to do then + return + } + + let summaries: [MXRoomSummary] = recentRoomIds.compactMap { + guard let summary = session?.roomSummary(withRoomId: $0), summary.roomType == .room else { + return nil + } + return summary + } + + var total: MXRoomListDataCounts? + if !summaries.isEmpty { + // compute total counts just before cutting the rooms array + total = MXStoreRoomListDataCounts(withRooms: summaries, total: nil) + } + + self.data = MXRoomListData(rooms: summaries, + counts: MXStoreRoomListDataCounts(withRooms: summaries, + total: total), + paginationOptions: fetchOptions.paginationOptions) + self.recentRoomIds = recentRoomIds + } + + func stop() { + removeAllDelegates() + removeDataObservers() + data = nil + recentRoomIds = [] + } + + // MARK: - Data observers + + func addDataObservers() { + sessionSyncObserver = NotificationCenter.default.addObserver(forName:NSNotification.Name.mxSessionAccountDataDidChangeBreadcrumbs, object:session, queue:OperationQueue.main) { [weak self] (_) in + guard let self = self else { return } + + self.refresh() + } + } + + func removeDataObservers() { + if let sessionSyncObserver = sessionSyncObserver { + NotificationCenter.default.removeObserver(sessionSyncObserver) + } + } + +} diff --git a/MatrixSDK/Data/RoomList/Common/MXRoomListDataSortable.swift b/MatrixSDK/Data/RoomList/Common/MXRoomListDataSortable.swift index ab696b3fe9..65a1f4a10b 100644 --- a/MatrixSDK/Data/RoomList/Common/MXRoomListDataSortable.swift +++ b/MatrixSDK/Data/RoomList/Common/MXRoomListDataSortable.swift @@ -51,6 +51,10 @@ extension MXRoomListDataSortable { // result.append(NSSortDescriptor(keyPath: \MXRoomSummaryProtocol.spaceChildInfo?.order, ascending: false)) // } + if sortOptions.alphabetical { + result.append(NSSortDescriptor(keyPath: \MXRoomSummaryProtocol.displayname, ascending: true)) + } + if sortOptions.invitesFirst { result.append(NSSortDescriptor(keyPath: \MXRoomSummaryProtocol.membership, ascending: true)) } diff --git a/MatrixSDK/Data/RoomList/CoreData/MXCoreDataRoomListDataFetcher.swift b/MatrixSDK/Data/RoomList/CoreData/MXCoreDataRoomListDataFetcher.swift index b253073735..c5b0189e6c 100644 --- a/MatrixSDK/Data/RoomList/CoreData/MXCoreDataRoomListDataFetcher.swift +++ b/MatrixSDK/Data/RoomList/CoreData/MXCoreDataRoomListDataFetcher.swift @@ -252,6 +252,10 @@ extension MXCoreDataRoomListDataFetcher: MXRoomListDataSortable { func sortDescriptors(for sortOptions: MXRoomListDataSortOptions) -> [NSSortDescriptor] { var result: [NSSortDescriptor] = [] + if sortOptions.alphabetical { + result.append(NSSortDescriptor(keyPath: \MXRoomSummaryMO.s_displayName, ascending: true)) + } + if sortOptions.invitesFirst { result.append(NSSortDescriptor(keyPath: \MXRoomSummaryMO.s_membershipInt, ascending: true)) } diff --git a/MatrixSDK/Data/RoomList/CoreData/MXCoreDataRoomListDataManager.swift b/MatrixSDK/Data/RoomList/CoreData/MXCoreDataRoomListDataManager.swift index 1846e6ca31..1fa441a57a 100644 --- a/MatrixSDK/Data/RoomList/CoreData/MXCoreDataRoomListDataManager.swift +++ b/MatrixSDK/Data/RoomList/CoreData/MXCoreDataRoomListDataManager.swift @@ -36,6 +36,9 @@ public class MXCoreDataRoomListDataManager: NSObject, MXRoomListDataManager { session: session, spaceService: spaceService) } + if options.filterOptions.onlyBreadcrumbs { + return MXBreadcrumbsRoomListDataFetcher(fetchOptions: options, session: session) + } guard let store = session?.store else { fatalError("[MXCoreDataRoomListDataManager] No session store") } diff --git a/MatrixSDK/Data/RoomList/MXRoomListDataFilterOptions.swift b/MatrixSDK/Data/RoomList/MXRoomListDataFilterOptions.swift index d3bff5d1b2..83377d3afa 100644 --- a/MatrixSDK/Data/RoomList/MXRoomListDataFilterOptions.swift +++ b/MatrixSDK/Data/RoomList/MXRoomListDataFilterOptions.swift @@ -47,11 +47,15 @@ public struct MXRoomListDataFilterOptions: Equatable { /// Flag to show only rooms that matches all the provided `dataTypes`. This has no effect when `onlySuggested` is `true` public let strictMatches: Bool + ///Flag to fetch and order rooms according room IDs stored in the `im.vector.setting.breadcrumbs` event within the user account data. + public let onlyBreadcrumbs: Bool + /// Initializer /// - Parameters: /// - dataTypes: data types to fetch. Pass `MXRoomListDataFilterOptions.emptyDataTypes` not to specify any. /// - notDataTypes: data types not to fetch. Pass `MXRoomListDataFilterOptions.emptyDataTypes` not to specify any. /// - onlySuggested: flag to filter only suggested rooms. Only `space` and `query` parameters are honored if true. + /// - onlyBreadcrumbs: flag to fetch and order rooms according room IDs stored in the `im.vector.setting.breadcrumbs` event within the user account data. /// - query: search query /// - space: active space /// - showAllRoomsInHomeSpace: flag to show all rooms in home space (when `space` is not provided) @@ -60,6 +64,7 @@ public struct MXRoomListDataFilterOptions: Equatable { public init(dataTypes: MXRoomSummaryDataTypes = MXRoomListDataFilterOptions.emptyDataTypes, notDataTypes: MXRoomSummaryDataTypes = [.hidden, .conferenceUser, .space], onlySuggested: Bool = false, + onlyBreadcrumbs: Bool = false, query: String? = nil, space: MXSpace? = nil, showAllRoomsInHomeSpace: Bool, @@ -68,6 +73,7 @@ public struct MXRoomListDataFilterOptions: Equatable { self.dataTypes = dataTypes self.notDataTypes = notDataTypes self.onlySuggested = onlySuggested + self.onlyBreadcrumbs = onlyBreadcrumbs self.query = query self.space = space self.showAllRoomsInHomeSpace = showAllRoomsInHomeSpace diff --git a/MatrixSDK/Data/RoomList/MXRoomListDataSortOptions.swift b/MatrixSDK/Data/RoomList/MXRoomListDataSortOptions.swift index c790e45e51..8d3a43a102 100644 --- a/MatrixSDK/Data/RoomList/MXRoomListDataSortOptions.swift +++ b/MatrixSDK/Data/RoomList/MXRoomListDataSortOptions.swift @@ -47,10 +47,17 @@ public struct MXRoomListDataSortOptions: Equatable { /// Related fetcher will be refreshed automatically when updated. public var unreadMessagesFirst: Bool + /// Flag to sort rooms alphabetically. + /// Related fetcher will be refreshed automatically when updated. + public var alphabetical: Bool + /// Initializer /// - Parameters: /// - sentStatus: flag to sort by sent status /// - lastEventDate: flag to sort by last event date + /// - favoriteTag: Flag to sort by favorite tag order + /// - suggested: Flag to sort by suggested room flag + /// - alphabetical: Flag to sort rooms alphabetically /// - missedNotificationsFirst: flag to sort by missed notification count /// - unreadMessagesFirst: flag to sort by unread count public init(invitesFirst: Bool = true, @@ -58,6 +65,7 @@ public struct MXRoomListDataSortOptions: Equatable { lastEventDate: Bool = true, favoriteTag: Bool = false, suggested: Bool = true, + alphabetical: Bool = false, missedNotificationsFirst: Bool, unreadMessagesFirst: Bool) { self.invitesFirst = invitesFirst @@ -65,6 +73,7 @@ public struct MXRoomListDataSortOptions: Equatable { self.lastEventDate = lastEventDate self.favoriteTag = favoriteTag self.suggested = suggested + self.alphabetical = alphabetical self.missedNotificationsFirst = missedNotificationsFirst self.unreadMessagesFirst = unreadMessagesFirst } diff --git a/MatrixSDK/Data/RoomList/MXStore/MXStoreRoomListDataManager.swift b/MatrixSDK/Data/RoomList/MXStore/MXStoreRoomListDataManager.swift index 7bb698b587..eab91f3f1e 100644 --- a/MatrixSDK/Data/RoomList/MXStore/MXStoreRoomListDataManager.swift +++ b/MatrixSDK/Data/RoomList/MXStore/MXStoreRoomListDataManager.swift @@ -34,6 +34,9 @@ public class MXStoreRoomListDataManager: NSObject, MXRoomListDataManager { session: session, spaceService: spaceService) } + if options.filterOptions.onlyBreadcrumbs { + return MXBreadcrumbsRoomListDataFetcher(fetchOptions: options, session: session) + } guard let store = session?.store else { fatalError("[MXStoreRoomListDataManager] Session has no store") } diff --git a/MatrixSDK/MXRestClient.h b/MatrixSDK/MXRestClient.h index ac23d09747..2f37ed01dd 100644 --- a/MatrixSDK/MXRestClient.h +++ b/MatrixSDK/MXRestClient.h @@ -74,6 +74,7 @@ FOUNDATION_EXPORT NSString *const kMXAccountDataTypeIgnoredUserList; FOUNDATION_EXPORT NSString *const kMXAccountDataTypeUserWidgets; FOUNDATION_EXPORT NSString *const kMXAccountDataTypeIdentityServer; FOUNDATION_EXPORT NSString *const kMXAccountDataTypeAcceptedTerms; +FOUNDATION_EXPORT NSString *const kMXAccountDataTypeBreadcrumbs; FOUNDATION_EXPORT NSString *const kMXAccountDataTypeAcceptedTermsKey; /** @@ -81,6 +82,7 @@ FOUNDATION_EXPORT NSString *const kMXAccountDataTypeAcceptedTermsKey; */ FOUNDATION_EXPORT NSString *const kMXAccountDataKeyIgnoredUser; FOUNDATION_EXPORT NSString *const kMXAccountDataKeyIdentityServer; +FOUNDATION_EXPORT NSString *const kMXAccountDataTypeRecentRoomsKey; /** diff --git a/MatrixSDK/MXRestClient.m b/MatrixSDK/MXRestClient.m index 8060837d0f..a7cbf0cc09 100644 --- a/MatrixSDK/MXRestClient.m +++ b/MatrixSDK/MXRestClient.m @@ -51,6 +51,7 @@ NSString *const kMXAccountDataTypeUserWidgets = @"m.widgets"; NSString *const kMXAccountDataTypeIdentityServer = @"m.identity_server"; NSString *const kMXAccountDataTypeAcceptedTerms = @"m.accepted_terms"; +NSString *const kMXAccountDataTypeBreadcrumbs = @"im.vector.setting.breadcrumbs"; /** Account data keys @@ -58,6 +59,7 @@ NSString *const kMXAccountDataKeyIgnoredUser = @"ignored_users"; NSString *const kMXAccountDataKeyIdentityServer = @"base_url"; NSString *const kMXAccountDataTypeAcceptedTermsKey = @"accepted"; +NSString *const kMXAccountDataTypeRecentRoomsKey = @"recent_rooms"; /** Types of third party media. diff --git a/MatrixSDK/MXSession.h b/MatrixSDK/MXSession.h index 22b145c313..7aa8d486d8 100644 --- a/MatrixSDK/MXSession.h +++ b/MatrixSDK/MXSession.h @@ -224,6 +224,8 @@ FOUNDATION_EXPORT NSString *const kMXSessionAccountDataDidChangeNotification; */ FOUNDATION_EXPORT NSString *const kMXSessionAccountDataDidChangeIdentityServerNotification; +FOUNDATION_EXPORT NSString *const kMXSessionAccountDataDidChangeBreadcrumbsNotification; + /** Posted when MXSession data have been corrupted. The listener must reload the session data with a full server sync. @@ -1482,6 +1484,9 @@ typedef void (^MXOnBackgroundSyncFail)(NSError *error); success:(void (^)(MXSession *session, NSString *baseURL, NSString *accessToken))success failure:(void (^)(NSError *error))failure; +- (void)updateBreadcrumbsWithRoomWithId:(NSString *)roomId + success:(void (^)(void))success + failure:(void (^)(NSError *error))failure; #pragma mark - Homeserver information diff --git a/MatrixSDK/MXSession.m b/MatrixSDK/MXSession.m index 7534524075..15b602e47e 100644 --- a/MatrixSDK/MXSession.m +++ b/MatrixSDK/MXSession.m @@ -61,6 +61,7 @@ NSString *const kMXSessionVirtualRoomsDidChangeNotification = @"kMXSessionVirtualRoomsDidChangeNotification"; NSString *const kMXSessionAccountDataDidChangeNotification = @"kMXSessionAccountDataDidChangeNotification"; NSString *const kMXSessionAccountDataDidChangeIdentityServerNotification = @"kMXSessionAccountDataDidChangeIdentityServerNotification"; +NSString *const kMXSessionAccountDataDidChangeBreadcrumbsNotification = @"kMXSessionAccountDataDidChangeBreadcrumbsNotification"; NSString *const kMXSessionDidCorruptDataNotification = @"kMXSessionDidCorruptDataNotification"; NSString *const kMXSessionCryptoDidCorruptDataNotification = @"kMXSessionCryptoDidCorruptDataNotification"; NSString *const kMXSessionNewGroupInviteNotification = @"kMXSessionNewGroupInviteNotification"; @@ -1858,6 +1859,13 @@ - (void)handleAccountData:(NSDictionary*)accountDataUpdate [self refreshIdentityServerServiceTerms]; } } + + if ([event[@"type"] isEqualToString:kMXAccountDataTypeBreadcrumbs]) + { + [[NSNotificationCenter defaultCenter] postNotificationName:kMXSessionAccountDataDidChangeBreadcrumbsNotification + object:self + userInfo:nil]; + } } [self validateAccountData]; @@ -4458,6 +4466,35 @@ - (void)prepareIdentityServiceForTermsWithDefault:(NSString *)defaultIdentitySer }]; } +- (void)updateBreadcrumbsWithRoomWithId:(NSString *)roomId + success:(void (^)(void))success + failure:(void (^)(NSError *error))failure +{ + NSDictionary *breadcrumbs = [self.accountData accountDataForEventType:kMXAccountDataTypeBreadcrumbs]; + + NSMutableArray *recentRoomIds = breadcrumbs[kMXAccountDataTypeRecentRoomsKey] ? [NSMutableArray arrayWithArray:breadcrumbs[kMXAccountDataTypeRecentRoomsKey]] : [NSMutableArray array]; + + NSInteger index = [recentRoomIds indexOfObject:roomId]; + if (index != NSNotFound) + { + [recentRoomIds removeObjectAtIndex:index]; + } + [recentRoomIds insertObject:roomId atIndex:0]; + + [self setAccountData:@{kMXAccountDataTypeRecentRoomsKey : recentRoomIds} + forType:kMXAccountDataTypeBreadcrumbs + success:^{ + if (success) + { + success(); + } + } failure:^(NSError *error) { + if (failure) + { + failure(error); + } + }]; +} #pragma mark - Homeserver information - (MXWellKnown *)homeserverWellknown diff --git a/changelog.d/6407.change b/changelog.d/6407.change new file mode 100644 index 0000000000..420e71fd13 --- /dev/null +++ b/changelog.d/6407.change @@ -0,0 +1 @@ +App Layout: Added breadcrumbs data fetcher and updated room summary data type to reflect new needs From b68d0632f8b925e8ffd5062ca13496a5b36ff0b4 Mon Sep 17 00:00:00 2001 From: Gil Eluard Date: Tue, 2 Aug 2022 18:23:48 +0200 Subject: [PATCH 17/21] Rooms without an unread badge show up in "unread" tab (#1540) * Rooms without an unread badge show up in "unread" tab - Excluded room summaries without notifications from unread list --- MatrixSDK/Data/MXRoomSummary.m | 2 +- changelog.d/6511.bugfix | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/6511.bugfix diff --git a/MatrixSDK/Data/MXRoomSummary.m b/MatrixSDK/Data/MXRoomSummary.m index 8cde4381e9..d3155ea5ca 100644 --- a/MatrixSDK/Data/MXRoomSummary.m +++ b/MatrixSDK/Data/MXRoomSummary.m @@ -1106,7 +1106,7 @@ - (MXRoomSummaryDataTypes)calculateDataTypes { result |= MXRoomSummaryDataTypesConferenceUser; } - if (self.hasAnyUnread) + if (self.hasAnyNotification) { result |= MXRoomSummaryDataTypesUnread; } diff --git a/changelog.d/6511.bugfix b/changelog.d/6511.bugfix new file mode 100644 index 0000000000..8b31f6050f --- /dev/null +++ b/changelog.d/6511.bugfix @@ -0,0 +1 @@ +App Layout: exclude room summaries without notifications from unread list From 56a23ee78b098423c88cb14917e4bcae26158ba7 Mon Sep 17 00:00:00 2001 From: Gil Eluard Date: Fri, 5 Aug 2022 13:38:59 +0200 Subject: [PATCH 18/21] Implement new space selector bottom sheet (#1541) * Delight: Edit layout experiment #6079 --- MatrixSDK/Space/MXSpace.swift | 11 ++++++++++- MatrixSDK/Space/MXSpaceNotificationCounter.swift | 2 +- MatrixSDK/Space/MXSpaceService.swift | 7 +++++++ changelog.d/6410.change | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 changelog.d/6410.change diff --git a/MatrixSDK/Space/MXSpace.swift b/MatrixSDK/Space/MXSpace.swift index 136fe043f7..6c1533c436 100644 --- a/MatrixSDK/Space/MXSpace.swift +++ b/MatrixSDK/Space/MXSpace.swift @@ -333,13 +333,22 @@ public class MXSpace: NSObject { return } let userPowerLevel = powerLevels.powerLevelOfUser(withUserID: userId) - let minimumPowerLevel = powerLevels.events["m.space.child"] as? Int ?? powerLevels.stateDefault + let minimumPowerLevel = self.minimumPowerLevelForAddingRoom(with: powerLevels) let canAddRoom = userPowerLevel >= minimumPowerLevel completion(canAddRoom) } } + /// Returns the mimnimum power level required to add a room to this space + /// - Parameters: + /// - powerLevels: power levels of the room related to the space + /// + /// - Returns: the mimnimum power level required to add a room to this space + public func minimumPowerLevelForAddingRoom(with powerLevels: MXRoomPowerLevels) -> Int { + return powerLevels.events["m.space.child"] as? Int ?? powerLevels.stateDefault + } + // MARK: - Private private func updateChildRooms(from space: MXSpace, with directRoomsPerMember: [String : [String]]) { diff --git a/MatrixSDK/Space/MXSpaceNotificationCounter.swift b/MatrixSDK/Space/MXSpaceNotificationCounter.swift index 34bb5d49f5..fa5cdf1ead 100644 --- a/MatrixSDK/Space/MXSpaceNotificationCounter.swift +++ b/MatrixSDK/Space/MXSpaceNotificationCounter.swift @@ -87,7 +87,7 @@ public class MXSpaceNotificationCounter: NSObject { room.roomId } - let spaceIds: [String] = self.session.spaceService.rootSpaceSummaries.compactMap { summary in + let spaceIds: [String] = self.session.spaceService.spaceSummaries.compactMap { summary in summary.roomId } diff --git a/MatrixSDK/Space/MXSpaceService.swift b/MatrixSDK/Space/MXSpaceService.swift index c78e75f3c9..58d9b21535 100644 --- a/MatrixSDK/Space/MXSpaceService.swift +++ b/MatrixSDK/Space/MXSpaceService.swift @@ -90,6 +90,13 @@ public class MXSpaceService: NSObject { /// The instance of `MXSpaceNotificationCounter` that computes the number of unread messages for each space public let notificationCounter: MXSpaceNotificationCounter + /// List of `MXSpace` instances of the high level spaces. + public var rootSpaces: [MXSpace] { + return self.graph.rootSpaceIds.compactMap { spaceId in + self.getSpace(withId: spaceId) + } + } + /// List of `MXRoomSummary` of the high level spaces. public var rootSpaceSummaries: [MXRoomSummary] { return self.graph.rootSpaceIds.compactMap { spaceId in diff --git a/changelog.d/6410.change b/changelog.d/6410.change new file mode 100644 index 0000000000..80d4fe027c --- /dev/null +++ b/changelog.d/6410.change @@ -0,0 +1 @@ +App Layout: added MXSpace.minimumPowerLevelForAddingRoom() and MXSpaceService.rootSpaces From c9df696152918b3f3ca284bf37c634202f5fbedc Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Mon, 8 Aug 2022 15:24:16 +0200 Subject: [PATCH 19/21] MXBeaconAggregations: Add debug log when MXBeaconInfoSummary associated to a stopped beacon info is not found. --- .../Aggregations/LocationSharing/MXBeaconAggregations.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MatrixSDK/Aggregations/LocationSharing/MXBeaconAggregations.swift b/MatrixSDK/Aggregations/LocationSharing/MXBeaconAggregations.swift index bfa3e6a6ec..943370228f 100644 --- a/MatrixSDK/Aggregations/LocationSharing/MXBeaconAggregations.swift +++ b/MatrixSDK/Aggregations/LocationSharing/MXBeaconAggregations.swift @@ -257,6 +257,8 @@ public class MXBeaconAggregations: NSObject { existingBeaconInfoSummary.updateWithBeaconInfo(beaconInfo) beaconInfoSummary = existingBeaconInfoSummary + } else { + MXLog.error("[MXBeaconAggregations] Fails to find beacon info summary associated to stopped beacon info event id: \(eventId)") } } else if let existingBeaconInfoSummary = self.getBeaconInfoSummary(withIdentifier: eventId, inRoomWithId: roomId) { From 471f72042f6dddde1224c0b3b2230c7ad741ab55 Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 9 Aug 2022 10:49:07 +0100 Subject: [PATCH 20/21] version++ --- CHANGES.md | 14 ++++++++++++++ MatrixSDK.podspec | 2 +- MatrixSDK/MatrixSDKVersion.m | 2 +- changelog.d/6407.change | 1 - changelog.d/6410.change | 1 - changelog.d/6481.bugfix | 1 - changelog.d/6511.bugfix | 1 - changelog.d/pr-1537.change | 1 - 8 files changed, 16 insertions(+), 7 deletions(-) delete mode 100644 changelog.d/6407.change delete mode 100644 changelog.d/6410.change delete mode 100644 changelog.d/6481.bugfix delete mode 100644 changelog.d/6511.bugfix delete mode 100644 changelog.d/pr-1537.change diff --git a/CHANGES.md b/CHANGES.md index 8a6c585b89..219b1c407e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,17 @@ +## Changes in 0.23.14 (2022-08-09) + +🙌 Improvements + +- CI: Enable integration tests on GitHub actions ([#1537](https://github.com/matrix-org/matrix-ios-sdk/pull/1537)) +- App Layout: Added breadcrumbs data fetcher and updated room summary data type to reflect new needs ([#6407](https://github.com/vector-im/element-ios/issues/6407)) +- App Layout: added MXSpace.minimumPowerLevelForAddingRoom() and MXSpaceService.rootSpaces ([#6410](https://github.com/vector-im/element-ios/issues/6410)) + +🐛 Bugfixes + +- MXRestClient: Send an empty dictionary when calling /join to be spec compliant. ([#6481](https://github.com/vector-im/element-ios/issues/6481)) +- App Layout: exclude room summaries without notifications from unread list ([#6511](https://github.com/vector-im/element-ios/issues/6511)) + + ## Changes in 0.23.13 (2022-07-26) 🙌 Improvements diff --git a/MatrixSDK.podspec b/MatrixSDK.podspec index 28ed3f5739..246e372012 100644 --- a/MatrixSDK.podspec +++ b/MatrixSDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "MatrixSDK" - s.version = "0.23.13" + s.version = "0.23.14" s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)" s.description = <<-DESC diff --git a/MatrixSDK/MatrixSDKVersion.m b/MatrixSDK/MatrixSDKVersion.m index 84a8fdafa9..985e8334de 100644 --- a/MatrixSDK/MatrixSDKVersion.m +++ b/MatrixSDK/MatrixSDKVersion.m @@ -16,4 +16,4 @@ #import -NSString *const MatrixSDKVersion = @"0.23.13"; +NSString *const MatrixSDKVersion = @"0.23.14"; diff --git a/changelog.d/6407.change b/changelog.d/6407.change deleted file mode 100644 index 420e71fd13..0000000000 --- a/changelog.d/6407.change +++ /dev/null @@ -1 +0,0 @@ -App Layout: Added breadcrumbs data fetcher and updated room summary data type to reflect new needs diff --git a/changelog.d/6410.change b/changelog.d/6410.change deleted file mode 100644 index 80d4fe027c..0000000000 --- a/changelog.d/6410.change +++ /dev/null @@ -1 +0,0 @@ -App Layout: added MXSpace.minimumPowerLevelForAddingRoom() and MXSpaceService.rootSpaces diff --git a/changelog.d/6481.bugfix b/changelog.d/6481.bugfix deleted file mode 100644 index 8b2e49a307..0000000000 --- a/changelog.d/6481.bugfix +++ /dev/null @@ -1 +0,0 @@ -MXRestClient: Send an empty dictionary when calling /join to be spec compliant. \ No newline at end of file diff --git a/changelog.d/6511.bugfix b/changelog.d/6511.bugfix deleted file mode 100644 index 8b31f6050f..0000000000 --- a/changelog.d/6511.bugfix +++ /dev/null @@ -1 +0,0 @@ -App Layout: exclude room summaries without notifications from unread list diff --git a/changelog.d/pr-1537.change b/changelog.d/pr-1537.change deleted file mode 100644 index dab4f7adad..0000000000 --- a/changelog.d/pr-1537.change +++ /dev/null @@ -1 +0,0 @@ -CI: Enable integration tests on GitHub actions \ No newline at end of file From 431a5ae30af43c6ea5e940a35605b005a0cddbfb Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 9 Aug 2022 11:37:20 +0100 Subject: [PATCH 21/21] finish version++