File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,17 +27,12 @@ struct RestorePurchasesButton: View {
2727 Button ( action: {
2828 Task {
2929 restoringPurchase = true
30- do {
31- try await store. restorePurchases ( )
32- restoringPurchase = false
33- if store. purchasedProductIDs. count > 0 {
34- popupDismissHandle ? ( )
35- } else if showError ( error: store. storeError) == true {
36- NotifyAlert . alert ( title: store. storeError? . description ( locale: locale) ?? noPurchaseTitle, message: " " )
37- }
38- } catch {
39- restoringPurchase = false
40- NotifyAlert . alert ( title: restoreFailedTitle, message: error. localizedDescription)
30+ await store. restorePurchases ( )
31+ restoringPurchase = false
32+ if store. purchasedProductIDs. count > 0 {
33+ popupDismissHandle ? ( )
34+ } else if showError ( error: store. storeError) == true {
35+ NotifyAlert . alert ( title: store. storeError? . description ( locale: locale) ?? noPurchaseTitle, message: " " )
4136 }
4237 }
4338 } , label: {
Original file line number Diff line number Diff line change @@ -110,8 +110,7 @@ public final class StoreContext: ObservableObject {
110110
111111 do {
112112 // 同步 App Store 状态
113- let result = try await AppStore . sync ( )
114- print ( " AppStore.sync: " , result)
113+ try await AppStore . sync ( )
115114 // 更新购买状态
116115 await updatePurchasedProducts ( )
117116
Original file line number Diff line number Diff line change @@ -110,15 +110,10 @@ public struct StoreKitHelperSelectionView: View {
110110 let purchaseFailed = String . localizedString ( key: " purchase_failed " , locale: locale)
111111 Task {
112112 buyingProductID = product. id
113- do {
114- try await store. purchase ( product)
115- buyingProductID = nil
116- if store. isPurchased ( product. id) == true {
117- popupDismissHandle ? ( )
118- }
119- } catch {
120- buyingProductID = nil
121- NotifyAlert . alert ( title: purchaseFailed, message: error. localizedDescription)
113+ await store. purchase ( product)
114+ buyingProductID = nil
115+ if store. isPurchased ( product. id) == true {
116+ popupDismissHandle ? ( )
122117 }
123118 }
124119 }
Original file line number Diff line number Diff line change @@ -84,15 +84,10 @@ struct ProductsLoadList: View {
8484 let purchaseFailed = String . localizedString ( key: " purchase_failed " , locale: locale)
8585 Task {
8686 buyingProductID = product. id
87- do {
88- try await store. purchase ( product)
89- buyingProductID = nil
90- if store. isPurchased ( product. id) == true {
91- popupDismissHandle ? ( )
92- }
93- } catch {
94- buyingProductID = nil
95- NotifyAlert . alert ( title: purchaseFailed, message: error. localizedDescription)
87+ await store. purchase ( product)
88+ buyingProductID = nil
89+ if store. isPurchased ( product. id) == true {
90+ popupDismissHandle ? ( )
9691 }
9792 }
9893 }
You can’t perform that action at this time.
0 commit comments