From 8aa107401da8ccfbcdf3fb2f5172603dbbf6662e Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Tue, 2 Jan 2024 23:46:28 +0100 Subject: [PATCH 01/12] Remove remote feature flag dynamic card attribute and all the code related to it --- .../Blog Dashboard/Models/DashboardCard.swift | 17 ++--------------- .../Service/BlogDashboardRemoteEntity.swift | 2 -- .../Service/BlogDashboardService.swift | 7 +------ ...shboard-200-with-multiple-dynamic-cards.json | 3 --- ...ashboard-200-with-only-one-dynamic-card.json | 1 - 5 files changed, 3 insertions(+), 27 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Models/DashboardCard.swift b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Models/DashboardCard.swift index 1068063e1ab6..b349e248bb95 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Models/DashboardCard.swift +++ b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Models/DashboardCard.swift @@ -147,21 +147,8 @@ enum DashboardCard: String, CaseIterable { } } - static func shouldShowDynamicCard( - for blog: Blog, - payload: DashboardDynamicCardModel.Payload, - remoteFeatureFlagStore: RemoteFeatureFlagStore, - isJetpack: Bool = AppConfiguration.isJetpack - ) -> Bool { - let remoteFeatureFlagEnabled = { - guard let key = payload.remoteFeatureFlag else { - return true - } - return remoteFeatureFlagStore.value(for: key) ?? false - }() - return isJetpack - && RemoteDashboardCard.dynamic.supported(by: blog) - && remoteFeatureFlagEnabled + static func shouldShowDynamicCard(for blog: Blog, isJetpack: Bool = AppConfiguration.isJetpack) -> Bool { + isJetpack && RemoteDashboardCard.dynamic.supported(by: blog) } private func shouldShowRemoteCard(apiResponse: BlogDashboardRemoteEntity?) -> Bool { diff --git a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardRemoteEntity.swift b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardRemoteEntity.swift index 864184d32edb..3adc0af744b9 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardRemoteEntity.swift +++ b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardRemoteEntity.swift @@ -57,7 +57,6 @@ extension BlogDashboardRemoteEntity { struct BlogDashboardDynamic: Decodable, Hashable { let id: String - let remoteFeatureFlag: String? let title: String? let featuredImage: String? let url: String? @@ -79,7 +78,6 @@ extension BlogDashboardRemoteEntity { private enum CodingKeys: String, CodingKey { case id case title - case remoteFeatureFlag = "remote_feature_flag" case featuredImage = "featured_image" case url case action diff --git a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardService.swift b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardService.swift index a60b58666451..8337eaf973e5 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardService.swift +++ b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardService.swift @@ -7,7 +7,6 @@ final class BlogDashboardService { private let persistence: BlogDashboardPersistence private let postsParser: BlogDashboardPostsParser private let repository: UserPersistentRepository - private let remoteFeatureFlagStore: RemoteFeatureFlagStore private let isJetpack: Bool private let isDotComAvailable: Bool private let shouldShowJetpackFeatures: Bool @@ -20,8 +19,7 @@ final class BlogDashboardService { remoteService: DashboardServiceRemote? = nil, persistence: BlogDashboardPersistence = BlogDashboardPersistence(), repository: UserPersistentRepository = UserDefaults.standard, - postsParser: BlogDashboardPostsParser? = nil, - remoteFeatureFlagStore: RemoteFeatureFlagStore = .init() + postsParser: BlogDashboardPostsParser? = nil ) { self.isJetpack = isJetpack self.isDotComAvailable = isDotComAvailable @@ -30,7 +28,6 @@ final class BlogDashboardService { self.persistence = persistence self.repository = repository self.postsParser = postsParser ?? BlogDashboardPostsParser(managedObjectContext: managedObjectContext) - self.remoteFeatureFlagStore = remoteFeatureFlagStore } /// Fetch cards from remote @@ -187,8 +184,6 @@ private extension BlogDashboardService { let model = DashboardDynamicCardModel(payload: payload, dotComID: dotComID) let shouldShow = DashboardCard.shouldShowDynamicCard( for: blog, - payload: payload, - remoteFeatureFlagStore: remoteFeatureFlagStore, isJetpack: isJetpack ) guard shouldShow, personalizationService.isEnabled(model) else { diff --git a/WordPress/WordPressTest/Test Data/Dashboard/dashboard-200-with-multiple-dynamic-cards.json b/WordPress/WordPressTest/Test Data/Dashboard/dashboard-200-with-multiple-dynamic-cards.json index 51800bfc5d63..ac08a9ac021e 100644 --- a/WordPress/WordPressTest/Test Data/Dashboard/dashboard-200-with-multiple-dynamic-cards.json +++ b/WordPress/WordPressTest/Test Data/Dashboard/dashboard-200-with-multiple-dynamic-cards.json @@ -3,7 +3,6 @@ { "id": "id_12345", "title": "Title 12345", - "remote_feature_flag": "feature_flag_12345", "featured_image": "https://example.com/image12345", "url": "https://example.com/url12345", "action": "Action 12345", @@ -24,7 +23,6 @@ { "id": "id_67890", "title": "Title 67890", - "remote_feature_flag": "feature_flag_67890", "featured_image": "https://example.com/image67890", "url": "https://example.com/url67890", "action": "Action 67890", @@ -45,7 +43,6 @@ { "id": "id_13579", "title": "Title 13579", - "remote_feature_flag": "feature_flag_13579", "featured_image": "https://example.com/image13579", "url": "https://example.com/url13579", "action": "Action 13579", diff --git a/WordPress/WordPressTest/Test Data/Dashboard/dashboard-200-with-only-one-dynamic-card.json b/WordPress/WordPressTest/Test Data/Dashboard/dashboard-200-with-only-one-dynamic-card.json index 88e239b41588..bac329cfc092 100644 --- a/WordPress/WordPressTest/Test Data/Dashboard/dashboard-200-with-only-one-dynamic-card.json +++ b/WordPress/WordPressTest/Test Data/Dashboard/dashboard-200-with-only-one-dynamic-card.json @@ -3,7 +3,6 @@ { "id": "id_12345", "title": "Title 12345", - "remote_feature_flag": "feature_flag_12345", "featured_image": "https://example.com/image12345", "url": "https://example.com/url12345", "action": "Action 12345", From 798e9442b22b612861f9f81810226eb3f2bb84a2 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Wed, 3 Jan 2024 00:11:03 +0100 Subject: [PATCH 02/12] Fix failing dynamic cards unit tests --- .../Dashboard/BlogDashboardServiceTests.swift | 31 ++----------------- ...DashboardDynamicCardCoordinatorTests.swift | 1 - 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/WordPress/WordPressTest/Dashboard/BlogDashboardServiceTests.swift b/WordPress/WordPressTest/Dashboard/BlogDashboardServiceTests.swift index fa82e6b4eea2..c9c981dc1f29 100644 --- a/WordPress/WordPressTest/Dashboard/BlogDashboardServiceTests.swift +++ b/WordPress/WordPressTest/Dashboard/BlogDashboardServiceTests.swift @@ -11,7 +11,6 @@ class BlogDashboardServiceTests: CoreDataTestCase { private var persistenceMock: BlogDashboardPersistenceMock! private var repositoryMock: InMemoryUserDefaults! private var postsParserMock: BlogDashboardPostsParserMock! - private var remoteFeatureFlagStore: RemoteFeatureFlagStoreMock! private let featureFlags = FeatureFlagOverrideStore() private let wpComID = 123456 @@ -28,7 +27,6 @@ class BlogDashboardServiceTests: CoreDataTestCase { persistenceMock = BlogDashboardPersistenceMock() repositoryMock = InMemoryUserDefaults() postsParserMock = BlogDashboardPostsParserMock(managedObjectContext: mainContext) - remoteFeatureFlagStore = RemoteFeatureFlagStoreMock() service = BlogDashboardService( managedObjectContext: mainContext, // Notice these three boolean make the test run as if the app was Jetpack. @@ -43,8 +41,7 @@ class BlogDashboardServiceTests: CoreDataTestCase { remoteService: remoteServiceMock, persistence: persistenceMock, repository: repositoryMock, - postsParser: postsParserMock, - remoteFeatureFlagStore: remoteFeatureFlagStore + postsParser: postsParserMock ) // The state of the world these tests assume relies on certain feature flags. @@ -413,10 +410,9 @@ class BlogDashboardServiceTests: CoreDataTestCase { // MARK: - Dynamic Cards - func testCardsPresenceWhenAllCardsFeatureFlagsAreEnabled() throws { + func testCardsPresenceWhenFeatureFlagIsEnabled() throws { let expect = expectation(description: "2 dynamic cards at the top and one at the bottom should be present") remoteServiceMock.respondWith = .withMultipleDynamicCards - remoteFeatureFlagStore.enabledFeatureFlags = ["feature_flag_12345", "feature_flag_67890", "feature_flag_13579"] let blog = newTestBlog(id: wpComID, context: mainContext) @@ -430,28 +426,9 @@ class BlogDashboardServiceTests: CoreDataTestCase { waitForExpectations(timeout: 3, handler: nil) } - func testCardsPresenceWhenSomeCardsFeatureFlagsAreEnabled() throws { - let expect = expectation(description: "2 dynamic cards at the top and one at the bottom should be present") - remoteServiceMock.respondWith = .withMultipleDynamicCards - remoteFeatureFlagStore.enabledFeatureFlags = ["feature_flag_12345"] - remoteFeatureFlagStore.disabledFeatureFlag = ["feature_flag_67890"] - - let blog = newTestBlog(id: wpComID, context: mainContext) - - service.fetch(blog: blog) { cards in - let numberOfDynamicCards = cards.compactMap { $0.dynamic() }.count - XCTAssertEqual(numberOfDynamicCards, 1) - XCTAssertEqual(cards[0].dynamic()?.payload.id, "id_12345") - expect.fulfill() - } - - waitForExpectations(timeout: 3, handler: nil) - } - - func testCardsAbsenceWhenRemoteFeatureFlagIsDisabled() throws { + func testCardsAbsenceWhenFeatureFlagIsDisabled() throws { let expect = expectation(description: "No dynamic card should be present") remoteServiceMock.respondWith = .withMultipleDynamicCards - remoteFeatureFlagStore.enabledFeatureFlags = ["feature_flag_12345", "feature_flag_67890", "feature_flag_13579"] try featureFlags.override(RemoteFeatureFlag.dynamicDashboardCards, withValue: false) let blog = newTestBlog(id: wpComID, context: mainContext) @@ -468,7 +445,6 @@ class BlogDashboardServiceTests: CoreDataTestCase { func testDecodingWithDynamicCards() throws { let expect = expectation(description: "Dynamic card should be successfully decoded") remoteServiceMock.respondWith = .withOnlyOneDynamicCard - remoteFeatureFlagStore.enabledFeatureFlags = ["feature_flag_12345"] try featureFlags.override(RemoteFeatureFlag.dynamicDashboardCards, withValue: true) let blog = newTestBlog(id: wpComID, context: mainContext) @@ -479,7 +455,6 @@ class BlogDashboardServiceTests: CoreDataTestCase { let payload = card.payload let expected = BlogDashboardRemoteEntity.BlogDashboardDynamic( id: "id_12345", - remoteFeatureFlag: "feature_flag_12345", title: "Title 12345", featuredImage: "https://example.com/image12345", url: "https://example.com/url12345", diff --git a/WordPress/WordPressTest/Dashboard/Dynamic Cards/BlogDashboardDynamicCardCoordinatorTests.swift b/WordPress/WordPressTest/Dashboard/Dynamic Cards/BlogDashboardDynamicCardCoordinatorTests.swift index 8895ac9aadb6..08916d578e08 100644 --- a/WordPress/WordPressTest/Dashboard/Dynamic Cards/BlogDashboardDynamicCardCoordinatorTests.swift +++ b/WordPress/WordPressTest/Dashboard/Dynamic Cards/BlogDashboardDynamicCardCoordinatorTests.swift @@ -156,7 +156,6 @@ final class BlogDashboardDynamicCardCoordinatorTests: XCTestCase { ) -> BlogDashboardDynamicCardCoordinator { let payload = DashboardDynamicCardModel.Payload( id: id, - remoteFeatureFlag: "default", title: "Domain Management", featuredImage: "https://wordpress.com", url: url, From 674dddfb8cb0e86f8077a47c2a967feff79427db Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Wed, 3 Jan 2024 19:07:42 +0100 Subject: [PATCH 03/12] Pass devide id when calling dashboard cards endpoint --- Podfile | 6 ++--- .../Stores/RemoteFeatureFlagStore.swift | 26 +++++++++---------- .../Service/BlogDashboardService.swift | 8 ++++-- .../Dashboard/BlogDashboardServiceTests.swift | 17 ++++++++++-- .../RemoteFeatureFlagStoreMock.swift | 4 ++- 5 files changed, 40 insertions(+), 21 deletions(-) diff --git a/Podfile b/Podfile index f8e73a0cc86c..1eeaf33e0c23 100644 --- a/Podfile +++ b/Podfile @@ -51,11 +51,11 @@ end def wordpress_kit # Anything compatible with 8.9, starting from 8.9.1 which has a breaking change fix - pod 'WordPressKit', '~> 9.0', '>= 9.0.2' - # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: '' + # pod 'WordPressKit', '~> 9.0' + # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: '32b5a9fdd097b82934a5ce679c915a1fc3f21848' # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: 'trunk' # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', tag: '' - # pod 'WordPressKit', path: '../WordPressKit-iOS' + pod 'WordPressKit', path: '../WordPressKit-iOS' end def kanvas diff --git a/WordPress/Classes/Stores/RemoteFeatureFlagStore.swift b/WordPress/Classes/Stores/RemoteFeatureFlagStore.swift index f1484ca9ba19..dc41c17d7087 100644 --- a/WordPress/Classes/Stores/RemoteFeatureFlagStore.swift +++ b/WordPress/Classes/Stores/RemoteFeatureFlagStore.swift @@ -17,6 +17,19 @@ class RemoteFeatureFlagStore { return queue }() + /// The `deviceID` ensures we retain a stable set of Feature Flags between updates. If there are staged rollouts or other dynamic changes + /// happening server-side we don't want out flags to change on each fetch, so we provide an anonymous ID to manage this. + public var deviceID: String { + guard let deviceID = persistenceStore.string(forKey: Constants.DeviceIdKey) else { + DDLogInfo("🚩 Unable to find existing device ID – generating a new one") + let newID = UUID().uuidString + persistenceStore.set(newID, forKey: Constants.DeviceIdKey) + return newID + } + + return deviceID + } + init(queue: DispatchQueue = .remoteFeatureFlagStoreQueue, persistenceStore: UserPersistentRepository = UserDefaults.standard) { self.queue = queue @@ -63,19 +76,6 @@ extension RemoteFeatureFlagStore { typealias FetchCallback = () -> Void - /// The `deviceID` ensures we retain a stable set of Feature Flags between updates. If there are staged rollouts or other dynamic changes - /// happening server-side we don't want out flags to change on each fetch, so we provide an anonymous ID to manage this. - private var deviceID: String { - guard let deviceID = persistenceStore.string(forKey: Constants.DeviceIdKey) else { - DDLogInfo("🚩 Unable to find existing device ID – generating a new one") - let newID = UUID().uuidString - persistenceStore.set(newID, forKey: Constants.DeviceIdKey) - return newID - } - - return deviceID - } - /// The local cache stores feature flags between runs so that the most recently fetched set are ready to go as soon as this object is instantiated. private var cache: [String: Bool] { get { diff --git a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardService.swift b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardService.swift index 8337eaf973e5..141056448f91 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardService.swift +++ b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardService.swift @@ -10,6 +10,7 @@ final class BlogDashboardService { private let isJetpack: Bool private let isDotComAvailable: Bool private let shouldShowJetpackFeatures: Bool + private let remoteFeatureFlagStore: RemoteFeatureFlagStore init( managedObjectContext: NSManagedObjectContext, @@ -19,7 +20,8 @@ final class BlogDashboardService { remoteService: DashboardServiceRemote? = nil, persistence: BlogDashboardPersistence = BlogDashboardPersistence(), repository: UserPersistentRepository = UserDefaults.standard, - postsParser: BlogDashboardPostsParser? = nil + postsParser: BlogDashboardPostsParser? = nil, + remoteFeatureFlagStore: RemoteFeatureFlagStore = .init() ) { self.isJetpack = isJetpack self.isDotComAvailable = isDotComAvailable @@ -28,6 +30,7 @@ final class BlogDashboardService { self.persistence = persistence self.repository = repository self.postsParser = postsParser ?? BlogDashboardPostsParser(managedObjectContext: managedObjectContext) + self.remoteFeatureFlagStore = remoteFeatureFlagStore } /// Fetch cards from remote @@ -39,8 +42,9 @@ final class BlogDashboardService { } let cardsToFetch: [String] = DashboardCard.RemoteDashboardCard.allCases.filter {$0.supported(by: blog)}.map { $0.rawValue } + let deviceID = remoteFeatureFlagStore.deviceID - remoteService.fetch(cards: cardsToFetch, forBlogID: dotComID, success: { [weak self] cardsDictionary in + remoteService.fetch(cards: cardsToFetch, forBlogID: dotComID, deviceId: deviceID, success: { [weak self] cardsDictionary in guard let cardsDictionary = self?.parseCardsForLocalContent(cardsDictionary, blog: blog) else { failure?([]) diff --git a/WordPress/WordPressTest/Dashboard/BlogDashboardServiceTests.swift b/WordPress/WordPressTest/Dashboard/BlogDashboardServiceTests.swift index c9c981dc1f29..02bdd94dfbbf 100644 --- a/WordPress/WordPressTest/Dashboard/BlogDashboardServiceTests.swift +++ b/WordPress/WordPressTest/Dashboard/BlogDashboardServiceTests.swift @@ -11,6 +11,8 @@ class BlogDashboardServiceTests: CoreDataTestCase { private var persistenceMock: BlogDashboardPersistenceMock! private var repositoryMock: InMemoryUserDefaults! private var postsParserMock: BlogDashboardPostsParserMock! + private var remoteFeatureFlagStore: RemoteFeatureFlagStoreMock! + private let featureFlags = FeatureFlagOverrideStore() private let wpComID = 123456 @@ -27,6 +29,7 @@ class BlogDashboardServiceTests: CoreDataTestCase { persistenceMock = BlogDashboardPersistenceMock() repositoryMock = InMemoryUserDefaults() postsParserMock = BlogDashboardPostsParserMock(managedObjectContext: mainContext) + remoteFeatureFlagStore = RemoteFeatureFlagStoreMock() service = BlogDashboardService( managedObjectContext: mainContext, // Notice these three boolean make the test run as if the app was Jetpack. @@ -41,7 +44,8 @@ class BlogDashboardServiceTests: CoreDataTestCase { remoteService: remoteServiceMock, persistence: persistenceMock, repository: repositoryMock, - postsParser: postsParserMock + postsParser: postsParserMock, + remoteFeatureFlagStore: remoteFeatureFlagStore ) // The state of the world these tests assume relies on certain feature flags. @@ -74,6 +78,7 @@ class BlogDashboardServiceTests: CoreDataTestCase { service.fetch(blog: blog) { _ in XCTAssertEqual(self.remoteServiceMock.didCallWithBlogID, self.wpComID) + XCTAssertEqual(self.remoteServiceMock.didCallWithDeviceId, "Test") XCTAssertEqual(self.remoteServiceMock.didRequestCards, ["todays_stats", "posts", "pages", "activity", "dynamic"]) expect.fulfill() } @@ -521,11 +526,19 @@ class DashboardServiceRemoteMock: DashboardServiceRemote { var respondWith: Response = .withDraftAndSchedulePosts var didCallWithBlogID: Int? + var didCallWithDeviceId: String? var didRequestCards: [String]? - override func fetch(cards: [String], forBlogID blogID: Int, success: @escaping (NSDictionary) -> Void, failure: @escaping (Error) -> Void) { + override func fetch( + cards: [String], + forBlogID blogID: Int, + deviceId: String, + success: @escaping (NSDictionary) -> Void, + failure: @escaping (Error) -> Void + ) { didCallWithBlogID = blogID didRequestCards = cards + didCallWithDeviceId = deviceId if let fileURL: URL = Bundle(for: BlogDashboardServiceTests.self).url(forResource: respondWith.rawValue, withExtension: nil), let data: Data = try? Data(contentsOf: fileURL), diff --git a/WordPress/WordPressTest/RemoteFeatureFlagStoreMock.swift b/WordPress/WordPressTest/RemoteFeatureFlagStoreMock.swift index 2cb63959fd14..3d85f211706e 100644 --- a/WordPress/WordPressTest/RemoteFeatureFlagStoreMock.swift +++ b/WordPress/WordPressTest/RemoteFeatureFlagStoreMock.swift @@ -14,7 +14,9 @@ class RemoteFeatureFlagStoreMock: RemoteFeatureFlagStore { var enabledFeatureFlags = Set() var disabledFeatureFlag = Set() - // MARK: - Access Remote Feature Flag Value + override var deviceID: String { + return "Test" + } override func value(for flagKey: String) -> Bool? { if enabledFeatureFlags.contains(flagKey) { From af78c4ba942a39923e4b8c73114f15368a0347e3 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Wed, 3 Jan 2024 19:09:44 +0100 Subject: [PATCH 04/12] Change WordPressKit pod branch --- Podfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Podfile b/Podfile index 1eeaf33e0c23..bfcc4ab66ec1 100644 --- a/Podfile +++ b/Podfile @@ -53,9 +53,9 @@ def wordpress_kit # Anything compatible with 8.9, starting from 8.9.1 which has a breaking change fix # pod 'WordPressKit', '~> 9.0' # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: '32b5a9fdd097b82934a5ce679c915a1fc3f21848' - # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: 'trunk' + pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: 'task/22315-backend-driven-dynamic-cards-filtering' # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', tag: '' - pod 'WordPressKit', path: '../WordPressKit-iOS' + # pod 'WordPressKit', path: '../WordPressKit-iOS' end def kanvas From 14cc431a77f48ecca6c52be22021fecabeb3bce2 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Fri, 5 Jan 2024 18:25:58 +0100 Subject: [PATCH 05/12] Fix typo in documentation --- Podfile | 2 +- WordPress/Classes/Stores/RemoteFeatureFlagStore.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Podfile b/Podfile index bfcc4ab66ec1..2706a0ee36a5 100644 --- a/Podfile +++ b/Podfile @@ -53,7 +53,7 @@ def wordpress_kit # Anything compatible with 8.9, starting from 8.9.1 which has a breaking change fix # pod 'WordPressKit', '~> 9.0' # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: '32b5a9fdd097b82934a5ce679c915a1fc3f21848' - pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: 'task/22315-backend-driven-dynamic-cards-filtering' + pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: 'trunk' # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', tag: '' # pod 'WordPressKit', path: '../WordPressKit-iOS' end diff --git a/WordPress/Classes/Stores/RemoteFeatureFlagStore.swift b/WordPress/Classes/Stores/RemoteFeatureFlagStore.swift index dc41c17d7087..4091b29a6e19 100644 --- a/WordPress/Classes/Stores/RemoteFeatureFlagStore.swift +++ b/WordPress/Classes/Stores/RemoteFeatureFlagStore.swift @@ -18,7 +18,7 @@ class RemoteFeatureFlagStore { }() /// The `deviceID` ensures we retain a stable set of Feature Flags between updates. If there are staged rollouts or other dynamic changes - /// happening server-side we don't want out flags to change on each fetch, so we provide an anonymous ID to manage this. + /// happening server-side we don't want our flags to change on each fetch, so we provide an anonymous ID to manage this. public var deviceID: String { guard let deviceID = persistenceStore.string(forKey: Constants.DeviceIdKey) else { DDLogInfo("🚩 Unable to find existing device ID – generating a new one") From 1331bbce7cefbe0eb47eb65ba0ef3f45a30931ad Mon Sep 17 00:00:00 2001 From: Hassaan El-Garem Date: Sun, 7 Jan 2024 16:18:16 +0200 Subject: [PATCH 06/12] Update: point WPKit to latest trunk commit --- Podfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Podfile b/Podfile index 2706a0ee36a5..76c50f179f1f 100644 --- a/Podfile +++ b/Podfile @@ -52,8 +52,8 @@ end def wordpress_kit # Anything compatible with 8.9, starting from 8.9.1 which has a breaking change fix # pod 'WordPressKit', '~> 9.0' - # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: '32b5a9fdd097b82934a5ce679c915a1fc3f21848' - pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: 'trunk' + pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: '87eba2549022571515f256667ce209e6604ea0e0' + # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: '' # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', tag: '' # pod 'WordPressKit', path: '../WordPressKit-iOS' end From 89c4de9b22a7b9c596f9c93911eb76ce080562b0 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Mon, 8 Jan 2024 12:47:21 +0100 Subject: [PATCH 07/12] Rebase with release/24.0 --- Podfile.lock | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index daab523c6c77..7c36c7bfd54b 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -70,7 +70,7 @@ PODS: - WordPressKit (~> 9.0.0) - WordPressShared (~> 2.1-beta) - WordPressUI (~> 1.7-beta) - - WordPressKit (9.0.2): + - WordPressKit (9.0.1): - Alamofire (~> 4.8.0) - NSObject-SafeExpectations (~> 0.0.4) - UIDeviceIdentifier (~> 2.0) @@ -121,7 +121,7 @@ DEPENDENCIES: - SwiftLint (~> 0.50) - WordPress-Editor-iOS (~> 1.19.9) - WordPressAuthenticator (>= 8.0.1, ~> 8.0) - - WordPressKit (>= 9.0.2, ~> 9.0) + - WordPressKit (from `https://github.com/wordpress-mobile/WordPressKit-iOS.git`, commit `87eba2549022571515f256667ce209e6604ea0e0`) - WordPressShared (~> 2.2) - WordPressUI (~> 1.15) - ZendeskSupportSDK (= 5.3.0) @@ -158,7 +158,6 @@ SPEC REPOS: - UIDeviceIdentifier - WordPress-Aztec-iOS - WordPress-Editor-iOS - - WordPressKit - WordPressShared - WordPressUI - wpxmlrpc @@ -177,6 +176,9 @@ EXTERNAL SOURCES: :tag: 0.2.0 Gutenberg: :podspec: https://cdn.a8c-ci.services/gutenberg-mobile/Gutenberg-v1.110.0.podspec + WordPressKit: + :commit: 87eba2549022571515f256667ce209e6604ea0e0 + :git: https://github.com/wordpress-mobile/WordPressKit-iOS.git CHECKOUT OPTIONS: FSInteractiveMap: @@ -186,6 +188,9 @@ CHECKOUT OPTIONS: :git: https://github.com/wordpress-mobile/gutenberg-mobile.git :submodules: true :tag: v1.100.2 + WordPressKit: + :commit: 87eba2549022571515f256667ce209e6604ea0e0 + :git: https://github.com/wordpress-mobile/WordPressKit-iOS.git SPEC CHECKSUMS: Alamofire: 3ec537f71edc9804815215393ae2b1a8ea33a844 @@ -218,7 +223,7 @@ SPEC CHECKSUMS: WordPress-Aztec-iOS: fbebd569c61baa252b3f5058c0a2a9a6ada686bb WordPress-Editor-iOS: bda9f7f942212589b890329a0cb22547311749ef WordPressAuthenticator: fd2e1d340680faffffd9d675fc2df5ed19e26ea2 - WordPressKit: 23d0ffb43f2ccdad2debd6799e62d39790a5ffad + WordPressKit: 304725187d755db8d5ff73a58d27eda0071771c1 WordPressShared: 87f3ee89b0a3e83106106f13a8b71605fb8eb6d2 WordPressUI: a491454affda3b0fb812812e637dc5e8f8f6bd06 wpxmlrpc: 68db063041e85d186db21f674adf08d9c70627fd @@ -231,6 +236,6 @@ SPEC CHECKSUMS: ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba ZIPFoundation: d170fa8e270b2a32bef9dcdcabff5b8f1a5deced -PODFILE CHECKSUM: 9567ce349333fd257fea44c201727b4180efb961 +PODFILE CHECKSUM: 14202243a91bedd4a83e4a73959ea3b28dc82ee6 COCOAPODS: 1.14.2 From 2167ff2c21474ecc366564b91864830dfa349b73 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Mon, 8 Jan 2024 12:52:47 +0100 Subject: [PATCH 08/12] Revert unwanted changes due to rebase --- Podfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Podfile b/Podfile index 76c50f179f1f..d21df2c7ebce 100644 --- a/Podfile +++ b/Podfile @@ -51,9 +51,9 @@ end def wordpress_kit # Anything compatible with 8.9, starting from 8.9.1 which has a breaking change fix - # pod 'WordPressKit', '~> 9.0' + # pod 'WordPressKit', '~> 9.0', '>= 9.0.2' pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: '87eba2549022571515f256667ce209e6604ea0e0' - # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: '' + # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: 'trunk' # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', tag: '' # pod 'WordPressKit', path: '../WordPressKit-iOS' end From 9227f0ce82271995c2afce3787840e58467254cc Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Mon, 8 Jan 2024 13:02:49 +0100 Subject: [PATCH 09/12] Run bundle exec pod install --- Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Podfile.lock b/Podfile.lock index 7c36c7bfd54b..086f2a30c290 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -236,6 +236,6 @@ SPEC CHECKSUMS: ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba ZIPFoundation: d170fa8e270b2a32bef9dcdcabff5b8f1a5deced -PODFILE CHECKSUM: 14202243a91bedd4a83e4a73959ea3b28dc82ee6 +PODFILE CHECKSUM: d3b259c9bf3b4aa64a7b7f2bc5909a0baeb6e1be COCOAPODS: 1.14.2 From 57075b9770f3f85932e841a1b1294601f1b29ec6 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Tue, 9 Jan 2024 03:27:52 +0100 Subject: [PATCH 10/12] Update WordPressKit pod commit --- Podfile | 2 +- Podfile.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Podfile b/Podfile index d21df2c7ebce..1cb1bbf075dd 100644 --- a/Podfile +++ b/Podfile @@ -52,7 +52,7 @@ end def wordpress_kit # Anything compatible with 8.9, starting from 8.9.1 which has a breaking change fix # pod 'WordPressKit', '~> 9.0', '>= 9.0.2' - pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: '87eba2549022571515f256667ce209e6604ea0e0' + pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: 'eab6275c5955f8fb5a15f4b01f7a197c4aae261e' # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: 'trunk' # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', tag: '' # pod 'WordPressKit', path: '../WordPressKit-iOS' diff --git a/Podfile.lock b/Podfile.lock index 086f2a30c290..ea188ff7d980 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -70,7 +70,7 @@ PODS: - WordPressKit (~> 9.0.0) - WordPressShared (~> 2.1-beta) - WordPressUI (~> 1.7-beta) - - WordPressKit (9.0.1): + - WordPressKit (9.0.2): - Alamofire (~> 4.8.0) - NSObject-SafeExpectations (~> 0.0.4) - UIDeviceIdentifier (~> 2.0) @@ -121,7 +121,7 @@ DEPENDENCIES: - SwiftLint (~> 0.50) - WordPress-Editor-iOS (~> 1.19.9) - WordPressAuthenticator (>= 8.0.1, ~> 8.0) - - WordPressKit (from `https://github.com/wordpress-mobile/WordPressKit-iOS.git`, commit `87eba2549022571515f256667ce209e6604ea0e0`) + - WordPressKit (from `https://github.com/wordpress-mobile/WordPressKit-iOS.git`, commit `eab6275c5955f8fb5a15f4b01f7a197c4aae261e`) - WordPressShared (~> 2.2) - WordPressUI (~> 1.15) - ZendeskSupportSDK (= 5.3.0) @@ -177,7 +177,7 @@ EXTERNAL SOURCES: Gutenberg: :podspec: https://cdn.a8c-ci.services/gutenberg-mobile/Gutenberg-v1.110.0.podspec WordPressKit: - :commit: 87eba2549022571515f256667ce209e6604ea0e0 + :commit: eab6275c5955f8fb5a15f4b01f7a197c4aae261e :git: https://github.com/wordpress-mobile/WordPressKit-iOS.git CHECKOUT OPTIONS: @@ -189,7 +189,7 @@ CHECKOUT OPTIONS: :submodules: true :tag: v1.100.2 WordPressKit: - :commit: 87eba2549022571515f256667ce209e6604ea0e0 + :commit: eab6275c5955f8fb5a15f4b01f7a197c4aae261e :git: https://github.com/wordpress-mobile/WordPressKit-iOS.git SPEC CHECKSUMS: @@ -223,7 +223,7 @@ SPEC CHECKSUMS: WordPress-Aztec-iOS: fbebd569c61baa252b3f5058c0a2a9a6ada686bb WordPress-Editor-iOS: bda9f7f942212589b890329a0cb22547311749ef WordPressAuthenticator: fd2e1d340680faffffd9d675fc2df5ed19e26ea2 - WordPressKit: 304725187d755db8d5ff73a58d27eda0071771c1 + WordPressKit: 23d0ffb43f2ccdad2debd6799e62d39790a5ffad WordPressShared: 87f3ee89b0a3e83106106f13a8b71605fb8eb6d2 WordPressUI: a491454affda3b0fb812812e637dc5e8f8f6bd06 wpxmlrpc: 68db063041e85d186db21f674adf08d9c70627fd @@ -236,6 +236,6 @@ SPEC CHECKSUMS: ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba ZIPFoundation: d170fa8e270b2a32bef9dcdcabff5b8f1a5deced -PODFILE CHECKSUM: d3b259c9bf3b4aa64a7b7f2bc5909a0baeb6e1be +PODFILE CHECKSUM: ad841405d522fbc6b10dc974d36e18db546137e7 COCOAPODS: 1.14.2 From ceca329b2d31ca76cdc7a619bfd3daae19738d06 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Tue, 9 Jan 2024 03:49:02 +0100 Subject: [PATCH 11/12] Fix failing unit test --- .../EEUUSCompliance/CompliancePopoverCoordinator.swift | 2 +- .../WordPressTest/Dashboard/BlogDashboardServiceTests.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WordPress/Classes/ViewRelated/EEUUSCompliance/CompliancePopoverCoordinator.swift b/WordPress/Classes/ViewRelated/EEUUSCompliance/CompliancePopoverCoordinator.swift index 6d9fd7a47256..6658186f53e8 100644 --- a/WordPress/Classes/ViewRelated/EEUUSCompliance/CompliancePopoverCoordinator.swift +++ b/WordPress/Classes/ViewRelated/EEUUSCompliance/CompliancePopoverCoordinator.swift @@ -26,7 +26,7 @@ final class CompliancePopoverCoordinator: CompliancePopoverCoordinatorProtocol { } func presentIfNeeded() { - guard FeatureFlag.compliancePopover.enabled, !defaults.didShowCompliancePopup else { + guard FeatureFlag.compliancePopover.enabled/*, !defaults.didShowCompliancePopup */else { return } complianceService.getIPCountryCode { [weak self] result in diff --git a/WordPress/WordPressTest/Dashboard/BlogDashboardServiceTests.swift b/WordPress/WordPressTest/Dashboard/BlogDashboardServiceTests.swift index 02bdd94dfbbf..64257325fce6 100644 --- a/WordPress/WordPressTest/Dashboard/BlogDashboardServiceTests.swift +++ b/WordPress/WordPressTest/Dashboard/BlogDashboardServiceTests.swift @@ -532,7 +532,7 @@ class DashboardServiceRemoteMock: DashboardServiceRemote { override func fetch( cards: [String], forBlogID blogID: Int, - deviceId: String, + deviceId: String?, success: @escaping (NSDictionary) -> Void, failure: @escaping (Error) -> Void ) { From 0b2718248c113b1edcd28078aad6718575f9df44 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 9 Jan 2024 15:06:23 +1100 Subject: [PATCH 12/12] Use stable WordPressKit version, 9.0.3 --- Podfile | 5 ++--- Podfile.lock | 15 +++++---------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Podfile b/Podfile index 1cb1bbf075dd..90ba07faffc3 100644 --- a/Podfile +++ b/Podfile @@ -50,9 +50,8 @@ def wordpress_ui end def wordpress_kit - # Anything compatible with 8.9, starting from 8.9.1 which has a breaking change fix - # pod 'WordPressKit', '~> 9.0', '>= 9.0.2' - pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: 'eab6275c5955f8fb5a15f4b01f7a197c4aae261e' + pod 'WordPressKit', '~> 9.0', '>= 9.0.3' + # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: '' # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: 'trunk' # pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', tag: '' # pod 'WordPressKit', path: '../WordPressKit-iOS' diff --git a/Podfile.lock b/Podfile.lock index ea188ff7d980..35f8ccf85a0c 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -70,7 +70,7 @@ PODS: - WordPressKit (~> 9.0.0) - WordPressShared (~> 2.1-beta) - WordPressUI (~> 1.7-beta) - - WordPressKit (9.0.2): + - WordPressKit (9.0.3): - Alamofire (~> 4.8.0) - NSObject-SafeExpectations (~> 0.0.4) - UIDeviceIdentifier (~> 2.0) @@ -121,7 +121,7 @@ DEPENDENCIES: - SwiftLint (~> 0.50) - WordPress-Editor-iOS (~> 1.19.9) - WordPressAuthenticator (>= 8.0.1, ~> 8.0) - - WordPressKit (from `https://github.com/wordpress-mobile/WordPressKit-iOS.git`, commit `eab6275c5955f8fb5a15f4b01f7a197c4aae261e`) + - WordPressKit (>= 9.0.3, ~> 9.0) - WordPressShared (~> 2.2) - WordPressUI (~> 1.15) - ZendeskSupportSDK (= 5.3.0) @@ -158,6 +158,7 @@ SPEC REPOS: - UIDeviceIdentifier - WordPress-Aztec-iOS - WordPress-Editor-iOS + - WordPressKit - WordPressShared - WordPressUI - wpxmlrpc @@ -176,9 +177,6 @@ EXTERNAL SOURCES: :tag: 0.2.0 Gutenberg: :podspec: https://cdn.a8c-ci.services/gutenberg-mobile/Gutenberg-v1.110.0.podspec - WordPressKit: - :commit: eab6275c5955f8fb5a15f4b01f7a197c4aae261e - :git: https://github.com/wordpress-mobile/WordPressKit-iOS.git CHECKOUT OPTIONS: FSInteractiveMap: @@ -188,9 +186,6 @@ CHECKOUT OPTIONS: :git: https://github.com/wordpress-mobile/gutenberg-mobile.git :submodules: true :tag: v1.100.2 - WordPressKit: - :commit: eab6275c5955f8fb5a15f4b01f7a197c4aae261e - :git: https://github.com/wordpress-mobile/WordPressKit-iOS.git SPEC CHECKSUMS: Alamofire: 3ec537f71edc9804815215393ae2b1a8ea33a844 @@ -223,7 +218,7 @@ SPEC CHECKSUMS: WordPress-Aztec-iOS: fbebd569c61baa252b3f5058c0a2a9a6ada686bb WordPress-Editor-iOS: bda9f7f942212589b890329a0cb22547311749ef WordPressAuthenticator: fd2e1d340680faffffd9d675fc2df5ed19e26ea2 - WordPressKit: 23d0ffb43f2ccdad2debd6799e62d39790a5ffad + WordPressKit: 4d41fd70b83876ee5db4617868767b33f3ae1bc4 WordPressShared: 87f3ee89b0a3e83106106f13a8b71605fb8eb6d2 WordPressUI: a491454affda3b0fb812812e637dc5e8f8f6bd06 wpxmlrpc: 68db063041e85d186db21f674adf08d9c70627fd @@ -236,6 +231,6 @@ SPEC CHECKSUMS: ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba ZIPFoundation: d170fa8e270b2a32bef9dcdcabff5b8f1a5deced -PODFILE CHECKSUM: ad841405d522fbc6b10dc974d36e18db546137e7 +PODFILE CHECKSUM: d7a42312b8249374e94aecb6021ee06d137c7cfa COCOAPODS: 1.14.2