Skip to content

Commit 0efb70d

Browse files
committed
doc: update document.
1 parent e292e5b commit 0efb70d

File tree

4 files changed

+41
-37
lines changed

4 files changed

+41
-37
lines changed

!examples/InAppPurchaseManager/InAppPurchaseManager/SubscriptionView.swift

+37-35
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,49 @@ struct SubscriptionView: View {
1515
let privacyPolicy = URL(string: "https://wangchujiang.com/copybook-generator/privacy-policy.html")!
1616
let termsOfService = URL(string: "https://wangchujiang.com/copybook-generator/terms-of-service.html")!
1717
var body: some View {
18-
if !subscriptions.products.isEmpty {
19-
VStack {
20-
SubscriptionStoreView(productIDs: subscriptions.productIDs)
21-
.storeButton(.visible, for: .policies)
22-
.subscriptionStorePolicyDestination(url: privacyPolicy, for: .privacyPolicy)
23-
.subscriptionStorePolicyDestination(url: termsOfService, for: .termsOfService)
24-
.onInAppPurchaseCompletion(perform: { product, result in
25-
if case .success(.success(let transaction)) = result {
26-
print("Purchased successfully: \(transaction.signedDate)")
27-
await subscriptions.updatePurchasedProducts()
18+
NavigationStack {
19+
if !subscriptions.products.isEmpty {
20+
VStack {
21+
SubscriptionStoreView(productIDs: subscriptions.productIDs)
22+
.storeButton(.visible, for: .policies)
23+
.subscriptionStorePolicyDestination(url: privacyPolicy, for: .privacyPolicy)
24+
.subscriptionStorePolicyDestination(url: termsOfService, for: .termsOfService)
25+
.onInAppPurchaseCompletion(perform: { product, result in
26+
if case .success(.success(let transaction)) = result {
27+
print("Purchased successfully: \(transaction.signedDate)")
28+
await subscriptions.updatePurchasedProducts()
29+
dismiss()
30+
} else {
31+
print("Something else happened")
32+
}
33+
})
34+
Button(action: {
35+
Task {
36+
await subscriptions.restorePurchases()
2837
dismiss()
29-
} else {
30-
print("Something else happened")
3138
}
39+
}, label: {
40+
Text("Restore Subscription")
3241
})
33-
Button(action: {
34-
Task {
35-
await subscriptions.restorePurchases()
36-
dismiss()
42+
#if os(macOS)
43+
.buttonStyle(.link)
44+
#endif
45+
.offset(y: -22)
46+
}
47+
.background(.background)
48+
.frame(minWidth: 320, minHeight: 580)
49+
.frame(maxWidth: 450)
50+
} else {
51+
VStack {
52+
if message.isEmpty {
53+
ProgressView().progressViewStyle(.circular).scaleEffect(1).ignoresSafeArea(.all)
54+
} else {
55+
Text(message).foregroundStyle(.red)
3756
}
38-
}, label: {
39-
Text("Restore Subscription")
40-
})
41-
#if os(macOS)
42-
.buttonStyle(.link)
43-
#endif
44-
.offset(y: -22)
45-
}
46-
.background(.background)
47-
.frame(minWidth: 320, minHeight: 580)
48-
.frame(maxWidth: 450)
49-
} else {
50-
VStack {
51-
if message.isEmpty {
52-
ProgressView().progressViewStyle(.circular).scaleEffect(1).ignoresSafeArea(.all)
53-
} else {
54-
Text(message).foregroundStyle(.red)
5557
}
58+
.padding(.horizontal)
59+
.frame(minWidth: 230, minHeight: 120)
5660
}
57-
.padding(.horizontal)
58-
.frame(minWidth: 230, minHeight: 120)
5961
}
6062
}
6163
}

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
<p>
88
<a href="./README.zh.md">中文</a> •
99
<a href="#frequently-asked-questions">FAQ</a> •
10-
<a target="_blank" href="https://wangchujiang.com/#/contact">Contact & Support</a>
10+
<a target="_blank" href="https://wangchujiang.com/#/contact">Contact & Support</a> •
11+
<a href="https://github.com/jaywcjlove/devtutor/releases">Changelog</a>
1112
</p>
1213
<p>
1314
<a target="_blank" href="https://apps.apple.com/app/devtutor/id6471227008" title="DevTutor for SwiftUI AppStore"><img alt="DevTutor for SwiftUI AppStore" src="https://jaywcjlove.github.io/sb/download/macos.svg" height="51">

README.zh.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
<p>
88
<a href="./README.md">English</a> •
99
<a href="#常见问题解答">常见问题</a> •
10-
<a target="_blank" href="https://wangchujiang.com/#/contact">联系&支持</a>
10+
<a target="_blank" href="https://wangchujiang.com/#/contact">联系&支持</a> •
11+
<a href="https://github.com/jaywcjlove/devtutor/releases">变更日志</a>
1112
</p>
1213
<p>
1314
<a target="_blank" href="https://apps.apple.com/app/devtutor/id6471227008" title="DevTutor AppStore"><img alt="DevTutor AppStore" src="https://jaywcjlove.github.io/sb/download/macos.svg" height="51">

0 commit comments

Comments
 (0)