From 821016e5740dba68ade437150c2b05ac29df390c Mon Sep 17 00:00:00 2001 From: Cesar de la Vega Date: Mon, 17 Jun 2024 15:57:01 +0200 Subject: [PATCH] clean up and lint fix --- .../CustomerCenterConfigData.swift | 4 +- .../Networking/CustomerCenterConfigAPI.swift | 1 - .../GetCustomerCenterConfigOperation.swift | 8 +- .../CustomerCenterConfigResponse.swift | 90 ------------------- 4 files changed, 9 insertions(+), 94 deletions(-) diff --git a/Sources/CustomerCenter/CustomerCenterConfigData.swift b/Sources/CustomerCenter/CustomerCenterConfigData.swift index 45eb55fad1..d052107d14 100644 --- a/Sources/CustomerCenter/CustomerCenterConfigData.swift +++ b/Sources/CustomerCenter/CustomerCenterConfigData.swift @@ -15,6 +15,8 @@ import Foundation +// swiftlint:disable missing_docs +// swiftlint:disable nesting public struct CustomerCenterConfigData { public let id: String @@ -36,7 +38,7 @@ public struct CustomerCenterConfigData { public let type: PathType public let detail: PathDetail? - public init(id: String, + public init(id: String, title: String, type: PathType, detail: PathDetail?) { diff --git a/Sources/Networking/CustomerCenterConfigAPI.swift b/Sources/Networking/CustomerCenterConfigAPI.swift index d1ca0cb47f..a46b42430f 100644 --- a/Sources/Networking/CustomerCenterConfigAPI.swift +++ b/Sources/Networking/CustomerCenterConfigAPI.swift @@ -48,4 +48,3 @@ class CustomerCenterConfigAPI { } } - diff --git a/Sources/Networking/Operations/GetCustomerCenterConfigOperation.swift b/Sources/Networking/Operations/GetCustomerCenterConfigOperation.swift index db106f794c..605bc5e82a 100644 --- a/Sources/Networking/Operations/GetCustomerCenterConfigOperation.swift +++ b/Sources/Networking/Operations/GetCustomerCenterConfigOperation.swift @@ -55,7 +55,9 @@ private extension GetCustomerCenterConfigOperation { let appUserID = self.configuration.appUserID guard appUserID.isNotEmpty else { - self.customerCenterConfigCallbackCache.performOnAllItemsAndRemoveFromCache(withCacheable: self) { callback in + self.customerCenterConfigCallbackCache.performOnAllItemsAndRemoveFromCache( + withCacheable: self + ) { callback in callback.completion(.failure(.missingAppUserID())) } completion() @@ -70,7 +72,9 @@ private extension GetCustomerCenterConfigOperation { completion() } - self.customerCenterConfigCallbackCache.performOnAllItemsAndRemoveFromCache(withCacheable: self) { callback in + self.customerCenterConfigCallbackCache.performOnAllItemsAndRemoveFromCache( + withCacheable: self + ) { callback in callback.completion( response .map { $0.body } diff --git a/Sources/Networking/Responses/CustomerCenterConfigResponse.swift b/Sources/Networking/Responses/CustomerCenterConfigResponse.swift index c174970c3a..002e11d70d 100644 --- a/Sources/Networking/Responses/CustomerCenterConfigResponse.swift +++ b/Sources/Networking/Responses/CustomerCenterConfigResponse.swift @@ -88,96 +88,6 @@ struct CustomerCenterConfigResponse { } - enum TestData { - - static let customerCenterConfigResponse: CustomerCenterConfigResponse? = { - let jsonData = - """ - { - "id": "ccenter_lasdlfalaowpwp", - "locale": "en_US", - "paths": [ - { - "id": "ownmsldfow", - "title": "Didn't receive purchase", - "type": "MISSING_PURCHASE" - }, - { - "id": "nwodkdnfaoeb", - "title": "Request a refund", - "type": "REFUND_REQUEST", - "promotionalOffer": { - "iosOfferId": "rc-refund-offer", - "eligibility": { - "first_seen": "> 30" - } - } - }, - { - "id": "nfoaiodifj9", - "title": "Change plans", - "type": "CHANGE_PLANS" - }, - { - "id": "jnkasldfhas", - "title": "Cancel subscription", - "type": "CANCEL", - "feedbackSurvey": { - "title": "Why are you cancelling?", - "options": [ - { - "id": "iewrthals", - "title": "Too expensive", - "promotionalOffer": { - "iosOfferId": "rc-cancel-offer", - "eligibility": { - "first_seen": "> 14" - } - } - }, - { - "id": "qklpadsfj", - "title": "Don't use the app", - "promotionalOffer": { - "iosOfferId": "rc-cancel-offer", - "eligibility": { - "first_seen": "> 7" - } - } - }, - { - "id": "jargnapocps", - "title": "Bought by mistake" - } - ] - } - } - ], - "title": "How can we help?", - "supportEmail": "support@revenuecat.com", - "appearance": { - "mode": "SYSTEM", - "light": { - "accentColor": "#000000" - }, - "dark": { - "accentColor": "#ffffff" - } - } - } - """ - - do { - guard let data = jsonData.data(using: .utf8, allowLossyConversion: false) else { return nil } - return try JSONDecoder().decode(CustomerCenterConfigResponse.self, from: data) - } catch { - print(error) - return nil - } - }() - - } - } extension CustomerCenterConfigResponse: Codable, Equatable {}