-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Conversation
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.
Thanks for this!
@@ -10,7 +10,7 @@ This example initially uses a default project for CI purposes. You must | |||
replace the default project with your own so that you can review the error | |||
reports submitted to the Firebase console. | |||
|
|||
See [docs](https://firebase.google.com/docs/flutter/setup) for how to add | |||
See [docs](https://firebase.google.com/docs/flutter/setup) for how to add |
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.
I think all the changes under packages/firebase_crashlytics
should be split out into their own changes.
@@ -118,6 +117,31 @@ class _MyAppState extends State<MyApp> { | |||
'This app needs special configuration to run. Please see example/README.md for instructions.'))); | |||
} | |||
|
|||
print('xyzzy about to query past purchases'); |
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.
These debug logs should be removed.
packages/in_app_purchase/lib/src/billing_client_wrappers/purchase_wrapper.dart
Outdated
Show resolved
Hide resolved
|
||
/// Triggered when any transactions are updated. | ||
void updatedTransactions({List<SKPaymentTransactionWrapper> transactions}) { | ||
assert(_restoreCompleter != null); |
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.
What happens if we call cleanUpRestoredTransactions()
and then this triggers from a new purchase?
|
||
/// The original purchase data of this purchase. | ||
/// | ||
/// It is only available when this purchase is a restored purchase in iOS. |
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.
Do we need to nest the originalPurchase here? I think it would be cleaner if the structure of this was the same across all our platforms.
/// The response object for fetching the past purchases. | ||
/// | ||
/// An instance of this class is returned in [InAppPurchaseConnection.queryPastPurchases]. | ||
class QueryPastPurchaseResponse { |
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.
nit: I think QueryPurchaseDetails
makes a little more sense as a name here since it matches what this is returning.
packages/in_app_purchase/lib/src/in_app_purchase_connection/in_app_purchase_connection.dart
Show resolved
Hide resolved
@@ -16,6 +128,18 @@ abstract class InAppPurchaseConnection { | |||
/// Query product details list that match the given set of identifiers. | |||
Future<ProductDetailsResponse> queryProductDetails(Set<String> identifiers); | |||
|
|||
/// Query all the past purchases. | |||
/// | |||
/// The `applicationUserName` is used for iOS only and it is optional. It does not have any effects on Android. |
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.
Same thoughts above about asking people to case on this. Even if this isn't really used in Play I think it would probably be cleaner for users to just always pass this in if they also passed it in for originally making a purchase. I think it would be clearer here if we said that it is required in cases where this was passed in with the original transaction.
Future<QueryPastPurchaseResponse> queryPastPurchases( | ||
{String applicationUserName}); | ||
|
||
/// Get a refreshed purchase verification data. |
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.
This sort of rephrases the method name. Maybe mention that this is a utility in case there's an issue with getting the verification data originally, and as long as that's not null this doesn't need to be called?
…ase_wrapper.dart Co-Authored-By: cyanglaz <ychris@google.com>
…ogle_play_connection.dart Co-Authored-By: cyanglaz <ychris@google.com>
…_app_purchase_connection.dart Co-Authored-By: cyanglaz <ychris@google.com>
…_app_purchase_connection.dart Co-Authored-By: cyanglaz <ychris@google.com>
…_app_purchase_connection.dart Co-Authored-By: cyanglaz <ychris@google.com>
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.
Looking pretty good. The only thing left that I'd really like to see updated is the param type on restoreCompletedTransactionsFailed
.
return wrapper.transactionState == | ||
SKPaymentTransactionStateWrapper.restored; | ||
}).toList(); | ||
if (_restoreCompleter != null) { |
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.
subjective: I think an early return/guard clause would make this more readable.
https://testing.googleblog.com/2017/06/code-health-reduce-nesting-reduce.html
/// on Android, all purchase information should also be verified manually, with your | ||
/// server if at all possible. See [`Verify a purchase`](https://developer.android.com/google/play/billing/billing_library_overview#Verify). | ||
/// On Android, all purchase information should also be verified manually. See [`Verify a purchase`](https://developer.android.com/google/play/billing/billing_library_overview#Verify). | ||
/// |
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.
nit: This line can be deleted.
final Map<String, dynamic> message; | ||
} | ||
|
||
/// Represents the transaction details of a purchase. |
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.
Still think this one is worth adding. "Transactions" on iOS can have multiple statuses so I think it's worth pointing out which one this is.
packages/in_app_purchase/lib/src/in_app_purchase_connection/in_app_purchase_connection.dart
Outdated
Show resolved
Hide resolved
packages/in_app_purchase/lib/src/in_app_purchase_connection/in_app_purchase_connection.dart
Outdated
Show resolved
Hide resolved
packages/in_app_purchase/lib/src/in_app_purchase_connection/in_app_purchase_connection.dart
Outdated
Show resolved
Hide resolved
void restoreCompletedTransactions({Error error}); | ||
/// | ||
/// The error is represented in a Map. The map contains `errorCode` and `message` | ||
void restoreCompletedTransactionsFailed({Map<String, String> error}); |
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.
We should probably define a class with these props on it instead of using a map. The Map leaves this open to a bunch of dynamic typing kinds of bugs.
Co-Authored-By: cyanglaz <ychris@google.com>
Co-Authored-By: cyanglaz <ychris@google.com>
Co-Authored-By: cyanglaz <ychris@google.com>
…_app_purchase_connection.dart Co-Authored-By: cyanglaz <ychris@google.com>
…_app_purchase_connection.dart Co-Authored-By: cyanglaz <ychris@google.com>
…_app_purchase_connection.dart Co-Authored-By: cyanglaz <ychris@google.com>
…iap_load_purchase
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.
LGTM
Description
Adding unified IAP load purchase api.
Updated the example app to have indicators on already purchased items.
No pubspec and CHANGELOG.md is updated since this plugin is still under development.
Related Issues
flutter/flutter#26326
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?