Commit 6fa43a3d81
Verified · cmc
Sources/OrgstarMobile/ProScreen.swift +9 −3 · view
| @@ -66,10 +66,13 @@ struct ProScreen: View { | ||
| 66 | 66 | } footer: { |
| 67 | 67 | Text("Editing, the agenda, capture, clocking, tables and search stay free.") |
| 68 | 68 | } |
| 69 | if access.grant != .grandfathered, store.activeProductID != ProStore.lifetime { | |
| 69 | if showsPlans { | |
| 70 | 70 | Section { |
| 71 | if store.products.isEmpty { | |
| 71 | if store.isLoading && store.products.isEmpty { | |
| 72 | 72 | ProgressView().frame(maxWidth: .infinity) |
| 73 | } else if store.products.count < ProStore.productIDs.count, let message = store.message { | |
| 74 | Text(message).foregroundStyle(.secondary) | |
| 75 | Button("Try Again") { Task { await store.loadProducts() } } | |
| 73 | 76 | } |
| 74 | 77 | ForEach(store.products) { product in |
| 75 | 78 | Button { Task { await store.buy(product) } } label: { plan(product) } |
| @@ -90,7 +93,8 @@ struct ProScreen: View { | ||
| 90 | 93 | Link("Terms of Use", destination: URL(string: "https://www.apple.com/legal/internet-services/itunes/dev/stdeula/")!) |
| 91 | 94 | Link("Privacy Policy", destination: URL(string: "https://krz.sh/privacy/orgstar/")!) |
| 92 | 95 | } |
| 93 | if let message = store.message { | |
| 96 | // A purchase's or restore's message; a failed load shows under the plans. | |
| 97 | if let message = store.message, !showsPlans || store.products.count == ProStore.productIDs.count { | |
| 94 | 98 | Section { Text(message).foregroundStyle(.secondary) } |
| 95 | 99 | } |
| 96 | 100 | } |
| @@ -100,6 +104,8 @@ struct ProScreen: View { | ||
| 100 | 104 | .task { await store.loadProducts() } |
| 101 | 105 | } |
| 102 | 106 | |
| 107 | private var showsPlans: Bool { access.grant != .grandfathered && store.activeProductID != ProStore.lifetime } | |
| 108 | ||
| 103 | 109 | /// One plan: its name, an optional savings tag, what it bills, and its price. |
| 104 | 110 | private func plan(_ product: Product) -> some View { |
| 105 | 111 | HStack(alignment: .firstTextBaseline) { |