Skip to content

Commit

Permalink
clean up and lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vegaro committed Jun 27, 2024
1 parent 7e2bb76 commit 821016e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 94 deletions.
4 changes: 3 additions & 1 deletion Sources/CustomerCenter/CustomerCenterConfigData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import Foundation

// swiftlint:disable missing_docs
// swiftlint:disable nesting
public struct CustomerCenterConfigData {

public let id: String
Expand All @@ -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?) {
Expand Down
1 change: 0 additions & 1 deletion Sources/Networking/CustomerCenterConfigAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ class CustomerCenterConfigAPI {
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 }
Expand Down
90 changes: 0 additions & 90 deletions Sources/Networking/Responses/CustomerCenterConfigResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"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 {}
Expand Down

0 comments on commit 821016e

Please sign in to comment.