Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.debugRevenueCatOverlay: added Locale #3539

Merged
merged 4 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Sources/Support/DebugUI/DebugContentViews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ internal struct DebugSummaryView: View {
LabeledContent("Observer mode", value: config.observerMode.description)
LabeledContent("Sandbox", value: config.sandbox.description)
LabeledContent("StoreKit 2", value: config.storeKit2Enabled ? "on" : "off")
LabeledContent("Locale", value: config.locale.display)
LabeledContent("Offline Customer Info",
value: config.offlineCustomerInfoSupport ? "enabled" : "disabled")
LabeledContent("Entitlement Verification Mode", value: config.verificationMode)
Expand Down Expand Up @@ -454,6 +455,16 @@ private struct DebugJSONView<Value: Encodable & Transferable>: View {

}

// MARK: - Locale

private extension Locale {

var display: String {
return "\(self.identifier) (\(self.rc_currencyCode ?? "unknown"))"
}

}

// MARK: - Transferable

@available(iOS 16.0, macOS 13.0, *)
Expand Down
2 changes: 2 additions & 0 deletions Sources/Support/DebugUI/DebugViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ final class DebugViewModel: ObservableObject {
var observerMode: Bool
var sandbox: Bool
var storeKit2Enabled: Bool
var locale: Locale
var offlineCustomerInfoSupport: Bool
var verificationMode: String
var receiptURL: URL?
Expand Down Expand Up @@ -152,6 +153,7 @@ private extension DebugViewModel.Configuration {
observerMode: purchases.observerMode,
sandbox: purchases.isSandbox,
storeKit2Enabled: purchases.storeKit2Setting.isEnabledAndAvailable,
locale: .autoupdatingCurrent,
offlineCustomerInfoSupport: purchases.offlineCustomerInfoEnabled,
verificationMode: purchases.responseVerificationMode.display,
receiptURL: purchases.receiptURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class DebugViewSwiftUITests: TestCase {
observerMode: false,
sandbox: true,
storeKit2Enabled: true,
locale: .init(identifier: "en_US"),
offlineCustomerInfoSupport: true,
verificationMode: "Enforced",
receiptURL: URL(string: "file://receipt")
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct OfferingsList: View {
Text(error.description)

case .none:
ProgressView()
SwiftUI.ProgressView()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't compiling after #3526. I figured I'd fix it here instead of making another PR for one line.

}
}

Expand Down