diff --git a/RevenueCatUI/CustomerCenter/Views/CustomerCenterView.swift b/RevenueCatUI/CustomerCenter/Views/CustomerCenterView.swift index 53970e3c96..853cd5ca8c 100644 --- a/RevenueCatUI/CustomerCenter/Views/CustomerCenterView.swift +++ b/RevenueCatUI/CustomerCenter/Views/CustomerCenterView.swift @@ -71,7 +71,7 @@ private extension CustomerCenterView { func destinationView(configuration: CustomerCenterConfigData) -> some View { if viewModel.hasSubscriptions { if viewModel.subscriptionsAreFromApple, - let screen = configuration[.management] { + let screen = configuration.screens[.management] { ManageSubscriptionsView(screen: screen) } else { WrongPlatformView() diff --git a/RevenueCatUI/CustomerCenter/Views/ManageSubscriptionsView.swift b/RevenueCatUI/CustomerCenter/Views/ManageSubscriptionsView.swift index 4b4f24bac8..4aee4f7911 100644 --- a/RevenueCatUI/CustomerCenter/Views/ManageSubscriptionsView.swift +++ b/RevenueCatUI/CustomerCenter/Views/ManageSubscriptionsView.swift @@ -181,7 +181,7 @@ struct ManageSubscriptionsView_Previews: PreviewProvider { static var previews: some View { let viewModel = ManageSubscriptionsViewModel( - screen: CustomerCenterConfigTestData.customerCenterData[.management]!, + screen: CustomerCenterConfigTestData.customerCenterData.screens[.management]!, subscriptionInformation: CustomerCenterConfigTestData.subscriptionInformation) ManageSubscriptionsView(viewModel: viewModel) } diff --git a/Tests/RevenueCatUITests/CustomerCenter/ManageSubscriptionsViewModelTests.swift b/Tests/RevenueCatUITests/CustomerCenter/ManageSubscriptionsViewModelTests.swift index 678731c12a..b3e29bb134 100644 --- a/Tests/RevenueCatUITests/CustomerCenter/ManageSubscriptionsViewModelTests.swift +++ b/Tests/RevenueCatUITests/CustomerCenter/ManageSubscriptionsViewModelTests.swift @@ -173,7 +173,8 @@ final class MockManageSubscriptionsPurchases: ManageSubscriptionsPurchaseType { @available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) private extension ManageSubscriptionsViewModelTests { - static let screen: CustomerCenterConfigData.Screen = CustomerCenterConfigTestData.customerCenterData[.management]! + static let screen: CustomerCenterConfigData.Screen = + CustomerCenterConfigTestData.customerCenterData.screens[.management]! static func createMockProduct() -> StoreProduct { // Using SK1 products because they can be mocked, but CustomerCenterViewModel diff --git a/Tests/UnitTests/Networking/Backend/BackendGetCustomerCenterConfigTests.swift b/Tests/UnitTests/Networking/Backend/BackendGetCustomerCenterConfigTests.swift index fcb67994be..4d4594133e 100644 --- a/Tests/UnitTests/Networking/Backend/BackendGetCustomerCenterConfigTests.swift +++ b/Tests/UnitTests/Networking/Backend/BackendGetCustomerCenterConfigTests.swift @@ -56,7 +56,7 @@ class BackendGetCustomerCenterConfigTests: BaseBackendTests { expect(result).to(beSuccess()) expect(self.httpClient.calls).to(haveCount(1)) - expect(self.httpClient.calls[0].headers["X-Supported-Locales"]) == "en_EN,es_ES" + expect(self.httpClient.calls[0].headers["X-Preferred-Locales"]) == "en_EN,es_ES" } func testGetCustomerCenterConfigCallsHTTPMethodWithRandomDelay() { @@ -281,11 +281,11 @@ private extension BackendGetCustomerCenterConfigTests { "localized_strings": [ "cancel": "Cancel", "back": "Back" - ], + ] as [String: Any], "supported": [ "en_US" - ] - ], + ] as [Any] + ] as [String: Any], "screens": [ "MANAGEMENT": [ "paths": [ @@ -293,21 +293,21 @@ private extension BackendGetCustomerCenterConfigTests { "id": "ownmsldfow", "title": "Didn't receive purchase", "type": "MISSING_PURCHASE" - ], + ] as [String: Any], [ "id": "nwodkdnfaoeb", "promotional_offer": [ "ios_offer_id": "rc-refund-offer", "eligible": true - ], + ] as [String: Any], "title": "Request a refund", "type": "REFUND_REQUEST" - ], + ] as [String: Any], [ "id": "nfoaiodifj9", "title": "Change plans", "type": "CHANGE_PLANS" - ], + ] as [String: Any], [ "feedback_survey": [ "options": [ @@ -316,62 +316,62 @@ private extension BackendGetCustomerCenterConfigTests { "promotional_offer": [ "ios_offer_id": "rc-cancel-offer", "eligible": false - ], + ] as [String: Any], "title": "Too expensive" - ], + ] as [String: Any], [ "id": "qklpadsfj", "promotional_offer": [ "ios_offer_id": "rc-cancel-offer", "eligible": false - ], + ] as [String: Any], "title": "Don't use the app" - ], + ] as [String: Any], [ "id": "jargnapocps", "title": "Bought by mistake" - ] - ], + ] as [String: Any] + ] as [Any], "title": "Why are you cancelling?" - ], + ] as [String: Any], "id": "jnkasldfhas", "title": "Cancel subscription", "type": "CANCEL" - ] - ], + ] as [String: Any] + ] as [Any], "title": "How can we help?", "type": "MANAGEMENT" - ], + ] as [String: Any], "NO_ACTIVE": [ "paths": [ [ "id": "9q9719171o", "title": "Check purchases", "type": "MISSING_PURCHASE" - ] - ], + ] as [String: Any] + ] as [Any], "subtitle": "We can try checking your account for any previous purchases", "title": "No subscriptions found", "type": "NO_ACTIVE" - ] - ], + ] as [String: Any] + ] as [String: Any], "appearance": [ "dark": [ "accent_color": "#ffffff", "background_color": "#000000", "text_color": "#000000" - ], + ] as [String: Any], "light": [ "accent_color": "#000000", "background_color": "#ffffff", "text_color": "#ffffff" - ], + ] as [String: Any], "mode": "CUSTOM" - ], + ] as [String: Any], "support": [ "email": "support@revenuecat.com" - ] - ] + ] as [String: Any] + ] as [String: Any] ] }