diff options
| author | Christian Cleberg <[email protected]> | 2026-04-19 15:02:43 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-19 15:02:43 -0500 |
| commit | 2199384f887cf5634f3fdcf651eeb9c2c7ed457a (patch) | |
| tree | 20953cc3be5e628618c121ffdd77775f1fbbddee /Hutch/Views/More/AboutView.swift | |
| parent | 7d5ca0607c091f76aa29cd6fa8c76cfeb1e02ac8 (diff) | |
| download | hutch-2199384f887cf5634f3fdcf651eeb9c2c7ed457a.tar.gz hutch-2199384f887cf5634f3fdcf651eeb9c2c7ed457a.tar.bz2 hutch-2199384f887cf5634f3fdcf651eeb9c2c7ed457a.zip | |
fix: finish half-completed storekit implementation
Diffstat (limited to 'Hutch/Views/More/AboutView.swift')
| -rw-r--r-- | Hutch/Views/More/AboutView.swift | 71 |
1 files changed, 64 insertions, 7 deletions
diff --git a/Hutch/Views/More/AboutView.swift b/Hutch/Views/More/AboutView.swift index 887bef1..106c8d2 100644 --- a/Hutch/Views/More/AboutView.swift +++ b/Hutch/Views/More/AboutView.swift @@ -93,12 +93,18 @@ struct AboutView: View { Section { if storeViewModel.isLoading { - ProgressView() + ProgressView("Loading tip options…") .themedRow() } else if storeViewModel.products.isEmpty { - Text("Tips unavailable") - .foregroundStyle(.secondary) - .themedRow() + VStack(alignment: .leading, spacing: 8) { + Text("Tips unavailable") + .font(.headline) + Text(storeViewModel.errorMessage ?? "Hutch couldn't load tip products from the App Store yet.") + .font(.subheadline) + .foregroundStyle(.secondary) + } + .padding(.vertical, 4) + .themedRow() } else { ForEach(storeViewModel.products, id: \.id) { product in Button { @@ -107,15 +113,49 @@ struct AboutView: View { } } label: { HStack { - Text(product.displayName) + VStack(alignment: .leading, spacing: 2) { + Text(product.displayName) + Text(product.id) + .font(.caption) + .foregroundStyle(.secondary) + } Spacer() - Text(product.displayPrice) - .foregroundStyle(.secondary) + if storeViewModel.isPurchasing(product) { + ProgressView() + .controlSize(.small) + } else { + Text(product.displayPrice) + .foregroundStyle(.secondary) + } } } + .disabled(storeViewModel.purchasingProductID != nil || storeViewModel.isRestoringPurchases) + .themedRow() + } + } + + if let errorMessage = storeViewModel.errorMessage { + Text(errorMessage) + .font(.footnote) + .foregroundStyle(.secondary) .themedRow() + } + + Button("Retry Loading Tips") { + Task { + await storeViewModel.loadProducts() + } + } + .disabled(storeViewModel.isLoading || storeViewModel.purchasingProductID != nil) + .themedRow() + + Button(storeViewModel.isRestoringPurchases ? "Syncing Purchases…" : "Restore / Sync Purchases") { + Task { + await storeViewModel.restorePurchases() } } + .disabled(storeViewModel.isLoading || storeViewModel.purchasingProductID != nil || storeViewModel.isRestoringPurchases) + .themedRow() } header: { Text("Support Development") } footer: { @@ -139,6 +179,23 @@ struct AboutView: View { .themedList() .navigationTitle("About") .navigationBarTitleDisplayMode(.inline) + .alert( + "Store Message", + isPresented: Binding( + get: { storeViewModel.statusMessage != nil }, + set: { isPresented in + if !isPresented { + storeViewModel.clearStatusMessage() + } + } + ) + ) { + Button("OK") { + storeViewModel.clearStatusMessage() + } + } message: { + Text(storeViewModel.statusMessage ?? "") + } .task { await storeViewModel.loadProducts() } |
