Commit 68fd5fefd6

68fd5fefd688377220201dfb8b1087d389c5639e

parent: cb933c556d

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-20 00:42 UTC

Add tips on iOS

Consumable tips sh.krz.orgstar.tip.small|medium|large (0.99, 2.99,
4.99) in a Support Development section of About, for everyone with or
without orgstar+. They unlock nothing; a thank-you alert follows a
completed tip. ProStore's transaction listener finishes tips that
arrive later. Orgstar.storekit gains the three products with de, fr,
ja, es and pt-BR names. The Mac app has no tips: it is sold outside
the App Store.

CONTRIBUTING notes the App Store Connect setup; README mentions tips.

Layout: unified · split

CONTRIBUTING.org +15
@@ -52,6 +52,21 @@ On iOS, orgstar in the share sheet takes a page or text with a template; the app
52its capture sheet with it when it's next active. Shortcuts has the same "Capture to 52its capture sheet with it when it's next active. Shortcuts has the same "Capture to
53orgstar" action as on the Mac. 53orgstar" action as on the Mac.
54 54
55** In-app purchases
56
57=ios/Orgstar.storekit= is the StoreKit configuration the "Orgstar iOS" scheme runs with, so
58purchases work in Xcode without App Store Connect. It holds orgstar+
59(=sh.krz.orgstar.pro.monthly=, =.yearly=, =.lifetime=) and the consumable tips
60(=sh.krz.orgstar.tip.small=, =.medium=, =.large=, at 0.99, 2.99 and 4.99). Tips are in
61Settings ▸ About orgstar ▸ Support Development, for everyone, and unlock nothing. The Mac app
62has no tips: it is sold outside the App Store and has no StoreKit.
63
64In App Store Connect, create each tip as a Consumable with the exact product ID, a display
65name and description in every localization the app has (de, fr, ja, es-ES, pt-BR), a price
66and availability, and a review screenshot of the About screen's Support Development section.
67Submit new in-app purchases with an app version. Changes take up to an hour to reach the
68sandbox; test there with a Sandbox Apple Account (Settings ▸ Developer on the device).
69
55* Tests 70* Tests
56 71
57#+BEGIN_SRC sh 72#+BEGIN_SRC sh
README.org +3
@@ -72,6 +72,9 @@ the agenda; and Shortcuts actions.
72 72
73Anyone who installed orgstar before orgstar+ keeps every feature without buying it. 73Anyone who installed orgstar before orgstar+ keeps every feature without buying it.
74 74
75On iPhone and iPad, anyone can also leave a one-time tip in Settings ▸ About orgstar. Tips
76unlock nothing.
77
75To build from source, contribute or release (the Mac app and the App Store), see 78To build from source, contribute or release (the Mac app and the App Store), see
76[[file:CONTRIBUTING.org]]. 79[[file:CONTRIBUTING.org]].
77 80
Sources/OrgApp/Tip.swift added +10
@@ -0,0 +1,10 @@
1/// One-time consumable tips on iOS. They unlock nothing.
2public enum Tip: String, CaseIterable, Sendable {
3 case small, medium, large
4
5 /// The App Store product identifier.
6 public var productID: String { "sh.krz.orgstar.tip.\(rawValue)" }
7
8 /// Identifiers in the order the tips are listed.
9 public static let productIDs = allCases.map(\.productID)
10}
Sources/OrgstarMobile/AboutScreen.swift +2 −1
@@ -2,7 +2,7 @@
2import SwiftUI 2import SwiftUI
3import UIKit 3import UIKit
4 4
5/// The version, and where to read the manual and source, report a problem or ask for help. 5/// The version, where to read the manual and source, report a problem or ask for help, and tips.
6struct AboutScreen: View { 6struct AboutScreen: View {
7 /// The app icon in use, as `AppIcons` names it. 7 /// The app icon in use, as `AppIcons` names it.
8 let appIcon: String 8 let appIcon: String
@@ -48,6 +48,7 @@ struct AboutScreen: View {
48 } footer: { 48 } footer: {
49 Text("Reporting an issue needs a gitbay account. Without one, email \(Self.supportEmail).") 49 Text("Reporting an issue needs a gitbay account. Without one, email \(Self.supportEmail).")
50 } 50 }
51 TipSection()
51 Section { 52 Section {
52 link("Third-Party Notices", "doc.on.doc", Self.site + "third-party.html") 53 link("Third-Party Notices", "doc.on.doc", Self.site + "third-party.html")
53 link("Privacy Policy", "hand.raised", "https://krz.sh/privacy/orgstar/") 54 link("Privacy Policy", "hand.raised", "https://krz.sh/privacy/orgstar/")
Sources/OrgstarMobile/TipStore.swift added +102
@@ -0,0 +1,102 @@
1#if os(iOS)
2import OrgApp
3import StoreKit
4import SwiftUI
5
6/// Tips from the App Store. `ProStore`'s transaction listener finishes any that arrive later.
7@MainActor @Observable
8final class TipStore {
9 private(set) var products: [Product] = []
10 private(set) var isLoading = false
11 private(set) var purchasingProductID: String?
12 /// A failure, or a tip waiting for approval, shown in the section.
13 private(set) var message: String?
14 /// Set after a tip goes through; the thank-you alert clears it.
15 var thanked = false
16
17 func loadProducts() async {
18 guard !isLoading else { return }
19 isLoading = true
20 message = nil
21 defer { isLoading = false }
22 do {
23 let fetched = try await Product.products(for: Tip.productIDs)
24 products = Tip.productIDs.compactMap { id in fetched.first { $0.id == id } }
25 if products.count < Tip.productIDs.count {
26 message = String(localized: "Some tips aren't available from the App Store right now.")
27 }
28 } catch {
29 products = []
30 message = String(localized: "The App Store can't be reached right now.")
31 }
32 }
33
34 func purchase(_ product: Product) async {
35 guard purchasingProductID == nil else { return }
36 purchasingProductID = product.id
37 message = nil
38 defer { purchasingProductID = nil }
39 do {
40 switch try await product.purchase() {
41 case .success(.verified(let transaction)):
42 await transaction.finish()
43 thanked = true
44 case .success(.unverified):
45 message = String(localized: "The App Store couldn't verify the purchase.")
46 case .pending:
47 message = String(localized: "The tip is waiting for approval.")
48 case .userCancelled:
49 break
50 @unknown default:
51 break
52 }
53 } catch {
54 message = String(localized: "The purchase didn't go through. \(error.localizedDescription)")
55 }
56 }
57}
58
59/// Tips in About, for everyone, with or without orgstar+.
60struct TipSection: View {
61 @State private var store = TipStore()
62
63 var body: some View {
64 Section {
65 if store.isLoading && store.products.isEmpty {
66 ProgressView().frame(maxWidth: .infinity)
67 }
68 ForEach(store.products) { product in
69 Button { Task { await store.purchase(product) } } label: {
70 HStack {
71 Text(product.displayName)
72 Spacer()
73 if store.purchasingProductID == product.id {
74 ProgressView().controlSize(.small)
75 } else {
76 Text(product.displayPrice).monospacedDigit().foregroundStyle(.secondary)
77 }
78 }
79 }
80 .tint(.primary)
81 .disabled(store.purchasingProductID != nil)
82 }
83 if let message = store.message {
84 Text(message).foregroundStyle(.secondary)
85 if store.products.count < Tip.productIDs.count {
86 Button("Try Again") { Task { await store.loadProducts() } }.disabled(store.isLoading)
87 }
88 }
89 } header: {
90 Text("Support Development")
91 } footer: {
92 Text("Tips are one-time purchases that help pay for orgstar's development. They don't unlock anything.")
93 }
94 .task { await store.loadProducts() }
95 .alert("Thank You", isPresented: $store.thanked) {
96 Button("OK") {}
97 } message: {
98 Text("Your tip helps keep orgstar going.")
99 }
100 }
101}
102#endif
Tests/OrgAppTests/TipTests.swift added +17
@@ -0,0 +1,17 @@
1import Testing
2@testable import OrgApp
3
4struct TipTests {
5 @Test func productIDsMatchAppStoreConnectInOrder() {
6 #expect(Tip.productIDs == [
7 "sh.krz.orgstar.tip.small",
8 "sh.krz.orgstar.tip.medium",
9 "sh.krz.orgstar.tip.large",
10 ])
11 }
12
13 @Test func productIDsAreNotOrgstarPlus() {
14 // Tips must never count as an orgstar+ purchase.
15 #expect(Tip.productIDs.allSatisfy { !$0.hasPrefix("sh.krz.orgstar.pro.") })
16 }
17}
ios/Orgstar.storekit +120
@@ -26,6 +26,126 @@
26 "productID": "sh.krz.orgstar.pro.lifetime", 26 "productID": "sh.krz.orgstar.pro.lifetime",
27 "referenceName": "orgstar+ Lifetime", 27 "referenceName": "orgstar+ Lifetime",
28 "type": "NonConsumable" 28 "type": "NonConsumable"
29 },
30 {
31 "displayPrice": "0.99",
32 "familyShareable": false,
33 "internalID": "6700000010",
34 "localizations": [
35 {
36 "description": "A one-time tip that supports orgstar",
37 "displayName": "Small Tip",
38 "locale": "en_US"
39 },
40 {
41 "description": "Ein einmaliges Trinkgeld zur Unterstützung von orgstar",
42 "displayName": "Kleines Trinkgeld",
43 "locale": "de"
44 },
45 {
46 "description": "Un pourboire unique pour soutenir orgstar",
47 "displayName": "Petit pourboire",
48 "locale": "fr"
49 },
50 {
51 "description": "orgstarを応援する1回限りのチップ",
52 "displayName": "小さなチップ",
53 "locale": "ja"
54 },
55 {
56 "description": "Una propina única para apoyar orgstar",
57 "displayName": "Propina pequeña",
58 "locale": "es_ES"
59 },
60 {
61 "description": "Uma gorjeta única para apoiar o orgstar",
62 "displayName": "Gorjeta pequena",
63 "locale": "pt_BR"
64 }
65 ],
66 "productID": "sh.krz.orgstar.tip.small",
67 "referenceName": "Small Tip",
68 "type": "Consumable"
69 },
70 {
71 "displayPrice": "2.99",
72 "familyShareable": false,
73 "internalID": "6700000011",
74 "localizations": [
75 {
76 "description": "A one-time tip that supports orgstar",
77 "displayName": "Medium Tip",
78 "locale": "en_US"
79 },
80 {
81 "description": "Ein einmaliges Trinkgeld zur Unterstützung von orgstar",
82 "displayName": "Mittleres Trinkgeld",
83 "locale": "de"
84 },
85 {
86 "description": "Un pourboire unique pour soutenir orgstar",
87 "displayName": "Pourboire moyen",
88 "locale": "fr"
89 },
90 {
91 "description": "orgstarを応援する1回限りのチップ",
92 "displayName": "中くらいのチップ",
93 "locale": "ja"
94 },
95 {
96 "description": "Una propina única para apoyar orgstar",
97 "displayName": "Propina mediana",
98 "locale": "es_ES"
99 },
100 {
101 "description": "Uma gorjeta única para apoiar o orgstar",
102 "displayName": "Gorjeta média",
103 "locale": "pt_BR"
104 }
105 ],
106 "productID": "sh.krz.orgstar.tip.medium",
107 "referenceName": "Medium Tip",
108 "type": "Consumable"
109 },
110 {
111 "displayPrice": "4.99",
112 "familyShareable": false,
113 "internalID": "6700000012",
114 "localizations": [
115 {
116 "description": "A one-time tip that supports orgstar",
117 "displayName": "Large Tip",
118 "locale": "en_US"
119 },
120 {
121 "description": "Ein einmaliges Trinkgeld zur Unterstützung von orgstar",
122 "displayName": "Großes Trinkgeld",
123 "locale": "de"
124 },
125 {
126 "description": "Un pourboire unique pour soutenir orgstar",
127 "displayName": "Gros pourboire",
128 "locale": "fr"
129 },
130 {
131 "description": "orgstarを応援する1回限りのチップ",
132 "displayName": "大きなチップ",
133 "locale": "ja"
134 },
135 {
136 "description": "Una propina única para apoyar orgstar",
137 "displayName": "Propina grande",
138 "locale": "es_ES"
139 },
140 {
141 "description": "Uma gorjeta única para apoiar o orgstar",
142 "displayName": "Gorjeta grande",
143 "locale": "pt_BR"
144 }
145 ],
146 "productID": "sh.krz.orgstar.tip.large",
147 "referenceName": "Large Tip",
148 "type": "Consumable"
29 } 149 }
30 ], 150 ],
31 "settings": { 151 "settings": {
l10n/Localizable.xcstrings +340
@@ -27482,6 +27482,40 @@
27482 } 27482 }
27483 } 27483 }
27484 }, 27484 },
27485 "Some tips aren't available from the App Store right now.": {
27486 "localizations": {
27487 "de": {
27488 "stringUnit": {
27489 "state": "translated",
27490 "value": "Einige Trinkgelder sind gerade nicht im App Store verfügbar."
27491 }
27492 },
27493 "es": {
27494 "stringUnit": {
27495 "state": "translated",
27496 "value": "Algunas propinas no están disponibles en la App Store en este momento."
27497 }
27498 },
27499 "fr": {
27500 "stringUnit": {
27501 "state": "translated",
27502 "value": "Certains pourboires ne sont pas disponibles sur l'App Store pour le moment."
27503 }
27504 },
27505 "ja": {
27506 "stringUnit": {
27507 "state": "translated",
27508 "value": "一部のチップは現在App Storeで利用できません。"
27509 }
27510 },
27511 "pt-BR": {
27512 "stringUnit": {
27513 "state": "translated",
27514 "value": "Algumas gorjetas não estão disponíveis na App Store no momento."
27515 }
27516 }
27517 }
27518 },
27485 "Sort Entries": { 27519 "Sort Entries": {
27486 "comment": "Command title", 27520 "comment": "Command title",
27487 "localizations": { 27521 "localizations": {
@@ -28418,6 +28452,40 @@
28418 } 28452 }
28419 } 28453 }
28420 }, 28454 },
28455 "Support Development": {
28456 "localizations": {
28457 "de": {
28458 "stringUnit": {
28459 "state": "translated",
28460 "value": "Entwicklung unterstützen"
28461 }
28462 },
28463 "es": {
28464 "stringUnit": {
28465 "state": "translated",
28466 "value": "Apoyar el desarrollo"
28467 }
28468 },
28469 "fr": {
28470 "stringUnit": {
28471 "state": "translated",
28472 "value": "Soutenir le développement"
28473 }
28474 },
28475 "ja": {
28476 "stringUnit": {
28477 "state": "translated",
28478 "value": "開発を応援"
28479 }
28480 },
28481 "pt-BR": {
28482 "stringUnit": {
28483 "state": "translated",
28484 "value": "Apoiar o desenvolvimento"
28485 }
28486 }
28487 }
28488 },
28421 "Switch to Buffer…": { 28489 "Switch to Buffer…": {
28422 "comment": "Command title", 28490 "comment": "Command title",
28423 "localizations": { 28491 "localizations": {
@@ -29379,6 +29447,108 @@
29379 } 29447 }
29380 } 29448 }
29381 }, 29449 },
29450 "Thank You": {
29451 "localizations": {
29452 "de": {
29453 "stringUnit": {
29454 "state": "translated",
29455 "value": "Danke"
29456 }
29457 },
29458 "es": {
29459 "stringUnit": {
29460 "state": "translated",
29461 "value": "Gracias"
29462 }
29463 },
29464 "fr": {
29465 "stringUnit": {
29466 "state": "translated",
29467 "value": "Merci"
29468 }
29469 },
29470 "ja": {
29471 "stringUnit": {
29472 "state": "translated",
29473 "value": "ありがとうございます"
29474 }
29475 },
29476 "pt-BR": {
29477 "stringUnit": {
29478 "state": "translated",
29479 "value": "Obrigado"
29480 }
29481 }
29482 }
29483 },
29484 "The App Store can't be reached right now.": {
29485 "localizations": {
29486 "de": {
29487 "stringUnit": {
29488 "state": "translated",
29489 "value": "Der App Store ist gerade nicht erreichbar."
29490 }
29491 },
29492 "es": {
29493 "stringUnit": {
29494 "state": "translated",
29495 "value": "No se puede acceder a la App Store en este momento."
29496 }
29497 },
29498 "fr": {
29499 "stringUnit": {
29500 "state": "translated",
29501 "value": "L'App Store est inaccessible pour le moment."
29502 }
29503 },
29504 "ja": {
29505 "stringUnit": {
29506 "state": "translated",
29507 "value": "現在App Storeに接続できません。"
29508 }
29509 },
29510 "pt-BR": {
29511 "stringUnit": {
29512 "state": "translated",
29513 "value": "Não é possível acessar a App Store no momento."
29514 }
29515 }
29516 }
29517 },
29518 "The App Store couldn't verify the purchase.": {
29519 "localizations": {
29520 "de": {
29521 "stringUnit": {
29522 "state": "translated",
29523 "value": "Der App Store konnte den Kauf nicht bestätigen."
29524 }
29525 },
29526 "es": {
29527 "stringUnit": {
29528 "state": "translated",
29529 "value": "La App Store no pudo verificar la compra."
29530 }
29531 },
29532 "fr": {
29533 "stringUnit": {
29534 "state": "translated",
29535 "value": "L'App Store n'a pas pu vérifier l'achat."
29536 }
29537 },
29538 "ja": {
29539 "stringUnit": {
29540 "state": "translated",
29541 "value": "App Storeで購入を確認できませんでした。"
29542 }
29543 },
29544 "pt-BR": {
29545 "stringUnit": {
29546 "state": "translated",
29547 "value": "A App Store não conseguiu verificar a compra."
29548 }
29549 }
29550 }
29551 },
29382 "The Watch app needs orgstar+. Get it in orgstar on your iPhone, in Settings.": { 29552 "The Watch app needs orgstar+. Get it in orgstar on your iPhone, in Settings.": {
29383 "localizations": { 29553 "localizations": {
29384 "de": { 29554 "de": {
@@ -29753,6 +29923,40 @@
29753 } 29923 }
29754 } 29924 }
29755 }, 29925 },
29926 "The purchase didn't go through. %@": {
29927 "localizations": {
29928 "de": {
29929 "stringUnit": {
29930 "state": "translated",
29931 "value": "Der Kauf wurde nicht abgeschlossen. %@"
29932 }
29933 },
29934 "es": {
29935 "stringUnit": {
29936 "state": "translated",
29937 "value": "La compra no se completó. %@"
29938 }
29939 },
29940 "fr": {
29941 "stringUnit": {
29942 "state": "translated",
29943 "value": "L'achat n'a pas abouti. %@"
29944 }
29945 },
29946 "ja": {
29947 "stringUnit": {
29948 "state": "translated",
29949 "value": "購入を完了できませんでした。%@"
29950 }
29951 },
29952 "pt-BR": {
29953 "stringUnit": {
29954 "state": "translated",
29955 "value": "A compra não foi concluída. %@"
29956 }
29957 }
29958 }
29959 },
29756 "The running clock and its time so far.": { 29960 "The running clock and its time so far.": {
29757 "localizations": { 29961 "localizations": {
29758 "de": { 29962 "de": {
@@ -29855,6 +30059,40 @@
29855 } 30059 }
29856 } 30060 }
29857 }, 30061 },
30062 "The tip is waiting for approval.": {
30063 "localizations": {
30064 "de": {
30065 "stringUnit": {
30066 "state": "translated",
30067 "value": "Das Trinkgeld wartet auf Genehmigung."
30068 }
30069 },
30070 "es": {
30071 "stringUnit": {
30072 "state": "translated",
30073 "value": "La propina está pendiente de aprobación."
30074 }
30075 },
30076 "fr": {
30077 "stringUnit": {
30078 "state": "translated",
30079 "value": "Le pourboire est en attente d'approbation."
30080 }
30081 },
30082 "ja": {
30083 "stringUnit": {
30084 "state": "translated",
30085 "value": "チップは承認待ちです。"
30086 }
30087 },
30088 "pt-BR": {
30089 "stringUnit": {
30090 "state": "translated",
30091 "value": "A gorjeta está aguardando aprovação."
30092 }
30093 }
30094 }
30095 },
29858 "The whole file is removed. Files in iCloud Drive go to Recently Deleted in the Files app.": { 30096 "The whole file is removed. Files in iCloud Drive go to Recently Deleted in the Files app.": {
29859 "localizations": { 30097 "localizations": {
29860 "de": { 30098 "de": {
@@ -30130,6 +30368,40 @@
30130 } 30368 }
30131 } 30369 }
30132 }, 30370 },
30371 "Tips are one-time purchases that help pay for orgstar's development. They don't unlock anything.": {
30372 "localizations": {
30373 "de": {
30374 "stringUnit": {
30375 "state": "translated",
30376 "value": "Trinkgelder sind einmalige Käufe, die die Entwicklung von orgstar finanzieren. Sie schalten nichts frei."
30377 }
30378 },
30379 "es": {
30380 "stringUnit": {
30381 "state": "translated",
30382 "value": "Las propinas son compras únicas que ayudan a financiar el desarrollo de orgstar. No desbloquean nada."
30383 }
30384 },
30385 "fr": {
30386 "stringUnit": {
30387 "state": "translated",
30388 "value": "Les pourboires sont des achats uniques qui aident à financer le développement d'orgstar. Ils ne débloquent rien."
30389 }
30390 },
30391 "ja": {
30392 "stringUnit": {
30393 "state": "translated",
30394 "value": "チップはorgstarの開発を支える1回限りの購入です。機能は何も追加されません。"
30395 }
30396 },
30397 "pt-BR": {
30398 "stringUnit": {
30399 "state": "translated",
30400 "value": "As gorjetas são compras únicas que ajudam a financiar o desenvolvimento do orgstar. Elas não desbloqueiam nada."
30401 }
30402 }
30403 }
30404 },
30133 "Title": { 30405 "Title": {
30134 "localizations": { 30406 "localizations": {
30135 "de": { 30407 "de": {
@@ -30650,6 +30922,40 @@
30650 } 30922 }
30651 } 30923 }
30652 }, 30924 },
30925 "Try Again": {
30926 "localizations": {
30927 "de": {
30928 "stringUnit": {
30929 "state": "translated",
30930 "value": "Erneut versuchen"
30931 }
30932 },
30933 "es": {
30934 "stringUnit": {
30935 "state": "translated",
30936 "value": "Reintentar"
30937 }
30938 },
30939 "fr": {
30940 "stringUnit": {
30941 "state": "translated",
30942 "value": "Réessayer"
30943 }
30944 },
30945 "ja": {
30946 "stringUnit": {
30947 "state": "translated",
30948 "value": "もう一度試す"
30949 }
30950 },
30951 "pt-BR": {
30952 "stringUnit": {
30953 "state": "translated",
30954 "value": "Tentar novamente"
30955 }
30956 }
30957 }
30958 },
30653 "Turn Auto Fill On or Off": { 30959 "Turn Auto Fill On or Off": {
30654 "comment": "Command title", 30960 "comment": "Command title",
30655 "localizations": { 30961 "localizations": {
@@ -32399,6 +32705,40 @@
32399 } 32705 }
32400 } 32706 }
32401 }, 32707 },
32708 "Your tip helps keep orgstar going.": {
32709 "localizations": {
32710 "de": {
32711 "stringUnit": {
32712 "state": "translated",
32713 "value": "Dein Trinkgeld hilft, orgstar weiterzuentwickeln."
32714 }
32715 },
32716 "es": {
32717 "stringUnit": {
32718 "state": "translated",
32719 "value": "Tu propina ayuda a que orgstar siga adelante."
32720 }
32721 },
32722 "fr": {
32723 "stringUnit": {
32724 "state": "translated",
32725 "value": "Votre pourboire aide orgstar à continuer."
32726 }
32727 },
32728 "ja": {
32729 "stringUnit": {
32730 "state": "translated",
32731 "value": "あなたのチップがorgstarの開発を支えます。"
32732 }
32733 },
32734 "pt-BR": {
32735 "stringUnit": {
32736 "state": "translated",
32737 "value": "Sua gorjeta ajuda o orgstar a continuar."
32738 }
32739 }
32740 }
32741 },
32402 "[%@]": { 32742 "[%@]": {
32403 "shouldTranslate": false 32743 "shouldTranslate": false
32404 }, 32744 },