Skip to content
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

[in_app_purchase_storekit] Add support for purchase and transactions #7574

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

LouiseHsu
Copy link
Contributor

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

List which issues are fixed by this PR. You must list at least one issue.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@LouiseHsu LouiseHsu changed the title pigeon stuff [in_app_purchase_storekit] Add support for purchase and transactions Sep 4, 2024
@LouiseHsu LouiseHsu marked this pull request as ready for review September 27, 2024 18:34
@@ -27,6 +27,10 @@ public class InAppPurchasePlugin: NSObject, FlutterPlugin, InAppPurchaseAPI {
// This property is optional, as it requires self to exist to be initialized.
public var paymentQueueHandler: FLTPaymentQueueHandlerProtocol?

// This should be an Task, but Task is on available >= iOS 13
var updateListenerTask: Any?
Copy link
Contributor

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?

}
case .pending:
completion(
.failure(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reduce indentation by combining these

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the formatter uncombines these

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strange. it's clearly less than 100 characters. how's your code like before the formatter?

@MainActor in
do {
let transactionsMsgs = await rawTransactions().map {
$0.convertToPigeon()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use keypath

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Keypath can’t be used on instance methods"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh you are right

}

/// Helper function to cast updateListenerTask to a task
func getUpdateListenerTask() -> Task<(), Never> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use a getter (rather than a function) in the class definition (rather than extension). And make updateListenerTask private.

@testable import in_app_purchase_storekit

@available(iOS 15.0, macOS 12.0, *)
class StoreKit2TranslatorTests: XCTestCase {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final class

Copy link
Contributor

@hellohuanlin hellohuanlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after the nits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants