-
Notifications
You must be signed in to change notification settings - Fork 235
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
Obfuscated account id #299
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,7 +99,6 @@ class FlutterInappPurchase { | |
/// | ||
/// `iOS` also returns subscriptions. | ||
Future<List<IAPItem>> getProducts(List<String> skus) async { | ||
if (skus == null || skus.contains(null)) return []; | ||
skus = skus.toList(); | ||
if (_platform.isAndroid) { | ||
dynamic result = await _channel.invokeMethod( | ||
|
@@ -128,7 +127,6 @@ class FlutterInappPurchase { | |
/// | ||
/// `iOS` also returns non-subscription products. | ||
Future<List<IAPItem>> getSubscriptions(List<String> skus) async { | ||
if (skus == null || skus.contains(null)) return []; | ||
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. No use as List can't be null and any element of it can't be null as well |
||
skus = skus.toList(); | ||
if (_platform.isAndroid) { | ||
dynamic result = await _channel.invokeMethod( | ||
|
@@ -219,28 +217,29 @@ class FlutterInappPurchase { | |
|
||
/// Request a purchase on `Android` or `iOS`. | ||
/// Result will be received in `purchaseUpdated` listener or `purchaseError` listener. | ||
/// | ||
/// | ||
/// Check [AndroidProrationMode] for valid proration values | ||
/// Identical to [requestSubscription] on `iOS`. | ||
Future requestPurchase( | ||
String sku, { | ||
String? obfuscatedAccountIdAndroid, | ||
String? obfuscatedProfileIdAndroid, | ||
String? obfuscatedAccountId, | ||
String? purchaseTokenAndroid, | ||
String? obfuscatedProfileIdAndroid, | ||
}) async { | ||
if (_platform.isAndroid) { | ||
return await _channel.invokeMethod('buyItemByType', <String, dynamic>{ | ||
'type': EnumUtil.getValueString(_TypeInApp.inapp), | ||
'sku': sku, | ||
'oldSku': null, | ||
'prorationMode': -1, | ||
'obfuscatedAccountId': obfuscatedAccountIdAndroid, | ||
'obfuscatedAccountId': obfuscatedAccountId, | ||
'obfuscatedProfileId': obfuscatedProfileIdAndroid, | ||
'purchaseToken': purchaseTokenAndroid, | ||
}); | ||
} else if (_platform.isIOS) { | ||
return await _channel.invokeMethod('buyProduct', <String, dynamic>{ | ||
'sku': sku, | ||
'forUser': obfuscatedAccountId, | ||
}); | ||
} | ||
throw PlatformException( | ||
|
@@ -251,7 +250,7 @@ class FlutterInappPurchase { | |
/// Result will be received in `purchaseUpdated` listener or `purchaseError` listener. | ||
/// | ||
/// **NOTICE** second parameter is required on `Android`. | ||
/// | ||
/// | ||
/// Check [AndroidProrationMode] for valid proration values | ||
/// Identical to [requestPurchase] on `iOS`. | ||
Future requestSubscription( | ||
|
@@ -506,7 +505,6 @@ class FlutterInappPurchase { | |
Duration duration: const Duration(days: 30), | ||
Duration grace: const Duration(days: 3), | ||
}) async { | ||
assert(sku != null); | ||
if (_platform.isIOS) { | ||
var history = | ||
await (getPurchaseHistory() as FutureOr<List<PurchasedItem>>); | ||
|
@@ -548,9 +546,6 @@ class FlutterInappPurchase { | |
required Map<String, String> receiptBody, | ||
bool isTest = true, | ||
}) async { | ||
assert(receiptBody != null); | ||
assert(isTest != null); | ||
|
||
final String url = isTest | ||
? 'https://sandbox.itunes.apple.com/verifyReceipt' | ||
: 'https://buy.itunes.apple.com/verifyReceipt'; | ||
|
@@ -587,11 +582,6 @@ class FlutterInappPurchase { | |
required String accessToken, | ||
bool isSubscription = false, | ||
}) async { | ||
assert(packageName != null); | ||
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. no use for null safety version |
||
assert(productId != null); | ||
assert(productToken != null); | ||
assert(accessToken != null); | ||
|
||
final String type = isSubscription ? 'subscriptions' : 'products'; | ||
final String url = | ||
'https://www.googleapis.com/androidpublisher/v3/applications/$packageName/purchases/$type/$productId/tokens/$productToken?access_token=$accessToken'; | ||
|
@@ -642,7 +632,7 @@ class FlutterInappPurchase { | |
throw new ArgumentError('Unknown method ${call.method}'); | ||
} | ||
return Future.value(null); | ||
} as Future<dynamic> Function(MethodCall)?); | ||
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. redundant |
||
}); | ||
} | ||
|
||
Future _removePurchaseListener() async { | ||
|
@@ -663,7 +653,7 @@ class FlutterInappPurchase { | |
|
||
/// A list of valid values for ProrationMode parameter | ||
/// https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.ProrationMode | ||
class AndroidProrationMode{ | ||
class AndroidProrationMode { | ||
/// Replacement takes effect when the old plan expires, and the new price will be charged at the same time. | ||
/// https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.ProrationMode#DEFERRED | ||
static const int DEFERRED = 4; | ||
|
@@ -682,4 +672,4 @@ class AndroidProrationMode{ | |
|
||
/// https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.ProrationMode#unknown_subscription_upgrade_downgrade_policy | ||
static const int UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0; | ||
} | ||
} |
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.
No use as List can't be null and any element of it can't be null as well