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:
Vishesh Handa
2020-07-26 12:29:21 +02:00
parent 4e40814825
commit b9aeb430fd

View File

@ -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;
}