Skip to content

Commit

Permalink
remove LocalizedString
Browse files Browse the repository at this point in the history
  • Loading branch information
vegaro committed Jun 17, 2024
1 parent b9cc7df commit 25222e9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
15 changes: 4 additions & 11 deletions RevenueCatUI/CustomerCenter/Data/CustomerCenterConfigData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct CustomerCenterConfigData {

let id: String
let paths: [HelpPath]
let title: LocalizedString
let title: String

enum HelpPathType: String {
case missingPurchase = "MISSING_PURCHASE"
Expand All @@ -40,30 +40,23 @@ struct CustomerCenterConfigData {
struct HelpPath {

let id: String
let title: LocalizedString
let title: String
let type: HelpPathType
let detail: HelpPathDetail?

}

struct LocalizedString {

// swiftlint:disable:next identifier_name
let en_US: String

}

struct FeedbackSurvey {

let title: LocalizedString
let title: String
let options: [FeedbackSurveyOption]

}

struct FeedbackSurveyOption {

let id: String
let title: LocalizedString
let title: String

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,46 +26,46 @@ enum CustomerCenterConfigTestData {
paths: [
.init(
id: "1",
title: .init(en_US: "Didn't receive purchase"),
title: "Didn't receive purchase",
type: .missingPurchase,
detail: nil
),
.init(
id: "2",
title: .init(en_US: "Request a refund"),
title: "Request a refund",
type: .refundRequest,
detail: nil
),
.init(
id: "3",
title: .init(en_US: "Change plans"),
title: "Change plans",
type: .changePlans,
detail: nil
),
.init(
id: "4",
title: .init(en_US: "Cancel subscription"),
title: "Cancel subscription",
type: .cancel,
detail: .feedbackSurvey(.init(
title: .init(en_US: "Why are you cancelling?"),
title: "Why are you cancelling?",
options: [
.init(
id: "1",
title: CustomerCenterConfigData.LocalizedString(en_US: "Too expensive")
title: "Too expensive"
),
.init(
id: "2",
title: CustomerCenterConfigData.LocalizedString(en_US: "Don't use the app")
title: "Don't use the app"
),
.init(
id: "3",
title: CustomerCenterConfigData.LocalizedString(en_US: "Bought by mistake")
title: "Bought by mistake"
)
]
))
)
],
title: .init(en_US: "How can we help?")
title: "How can we help?"
)

static let subscriptionInformation: SubscriptionInformation = .init(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct HeaderView: View {

var body: some View {
if let configuration = viewModel.configuration {
Text(configuration.title.en_US)
Text(configuration.title)
.font(.title)
.padding()
}
Expand Down Expand Up @@ -157,7 +157,7 @@ struct ManageSubscriptionsButtonsView: View {
#endif
}
ForEach(filteredPaths, id: \.id) { path in
Button(path.title.en_US) {
Button(path.title) {
self.viewModel.handleAction(for: path)
}
.restorePurchasesAlert(isPresented: $viewModel.showRestoreAlert)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ManageSubscriptionsViewModelTests: TestCase {

expect(viewModel.state) == .notLoaded
expect(viewModel.subscriptionInformation).to(beNil())
expect(viewModel.refundRequestStatus).to(beNil())
expect(viewModel.refundRequestStatusMessage).to(beNil())
expect(viewModel.configuration).to(beNil())
expect(viewModel.showRestoreAlert) == false
expect(viewModel.isLoaded) == false
Expand Down

0 comments on commit 25222e9

Please sign in to comment.