mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +08:00
Handle case when we cannot get subscription status
This occurs in ios when the user is asked for their iTunes password and they press cancel. It seems with the current approach they will be asked for their password once a month. It seems a bit annoying. How can this be made better?
This commit is contained in:
19
lib/iap.dart
19
lib/iap.dart
@ -33,9 +33,22 @@ class InAppPurchases {
|
||||
}
|
||||
|
||||
static Future<void> confirmProPurchase() async {
|
||||
var sub = await _subscriptionStatus();
|
||||
if (sub == null) {
|
||||
Log.i("Failed to get subscription status");
|
||||
SubscriptionStatus sub;
|
||||
|
||||
try {
|
||||
sub = await _subscriptionStatus();
|
||||
if (sub == null) {
|
||||
Log.i("Failed to get subscription status");
|
||||
return;
|
||||
}
|
||||
} catch (e, stackTrace) {
|
||||
Log.e("Failed to get subscription status", ex: e, stacktrace: stackTrace);
|
||||
Log.i("Disabling Pro mode as it has probably expired");
|
||||
|
||||
Settings.instance.proMode = false;
|
||||
Settings.instance.proExpirationDate = "";
|
||||
Settings.instance.save();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user