-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[in_app_purchase_storekit] Add support for purchase and transactions #7574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b126a15
ae9095a
c38b66f
268a50e
f6ec07a
aa36dfd
8724d40
a6cbd98
b75eec7
4d2fd59
aeef979
acf499f
c3c7204
9021b6f
666df56
97b746f
add5bf5
06b42d0
0701d2a
8f225c0
2c6efdb
72ce51c
2e940fe
442c158
f48510b
6076bf1
d8dcad2
9c2893b
1a74fb7
1b688ae
74c2de3
71c9a1b
582156b
e6bec70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,10 @@ | |
|
|
||
| @available(iOS 15.0, macOS 12.0, *) | ||
| extension InAppPurchasePlugin: InAppPurchase2API { | ||
| var updateListenerTaskAsTask: Task<(), Never> { | ||
| return self.updateListenerTask as! Task<(), Never> | ||
| } | ||
|
|
||
| // MARK: - Pigeon Functions | ||
|
|
||
| /// Wrapper method around StoreKit2's canMakePayments() method | ||
|
|
@@ -94,10 +98,10 @@ extension InAppPurchasePlugin: InAppPurchase2API { | |
| Task { | ||
| @MainActor in | ||
| do { | ||
| let transactionsMessages = await rawTransactions().map { | ||
| let transactionsMsgs = await rawTransactions().map { | ||
| $0.convertToPigeon() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: use keypath
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Keypath can’t be used on instance methods"
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh you are right |
||
| } | ||
| completion(.success(transactionsMessages)) | ||
| completion(.success(transactionsMsgs)) | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -130,7 +134,7 @@ extension InAppPurchasePlugin: InAppPurchase2API { | |
|
|
||
| /// Stop subscribing to Transaction.updates | ||
| func stopListeningToTransactions() throws { | ||
| getUpdateListenerTask().cancel() | ||
| updateListenerTaskAsTask.cancel() | ||
| } | ||
|
|
||
| /// Sends an transaction back to Dart. Access these transactions with `purchaseStream` | ||
|
|
@@ -173,9 +177,4 @@ extension InAppPurchasePlugin: InAppPurchase2API { | |
| } | ||
| return nil | ||
| } | ||
|
|
||
| /// Helper function to cast updateListenerTask to a task | ||
| func getUpdateListenerTask() -> Task<(), Never> { | ||
| return self.updateListenerTask as! Task<(), Never> | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you try out that getter trick discussed yesterday?