mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +08:00
IAP: Do not check for pro mode on boot
If the user has freshly installed the app, they can click on the Purchase Pro Mode button and that will put them in Pro mode if already bought. This is being done, because otherwise the experience in ios is shitty as the moment the app is launched, the user is asked for their iTunes password.
This commit is contained in:
@ -97,7 +97,7 @@ class JournalApp extends StatefulWidget {
|
||||
),
|
||||
);
|
||||
|
||||
InAppPurchases.confirmProPurchase();
|
||||
InAppPurchases.confirmProPurchaseBoot();
|
||||
|
||||
runApp(EasyLocalization(
|
||||
child: app,
|
||||
|
12
lib/iap.dart
12
lib/iap.dart
@ -9,12 +9,16 @@ import 'package:http/http.dart' as http;
|
||||
import 'package:gitjournal/settings.dart';
|
||||
|
||||
class InAppPurchases {
|
||||
static Future<void> confirmProPurchase() async {
|
||||
static Future<void> confirmProPurchaseBoot() async {
|
||||
if (Settings.instance.proMode == false) {
|
||||
Log.i("confirmProPurchaseBoot: Pro Mode is false");
|
||||
return;
|
||||
}
|
||||
|
||||
var currentDt = DateTime.now().toUtc().toIso8601String();
|
||||
var exp = Settings.instance.proExpirationDate;
|
||||
|
||||
Log.i("Checking if ProMode should be enabled. Exp: $exp");
|
||||
|
||||
if (exp != null && exp.isNotEmpty && exp.compareTo(currentDt) > 0) {
|
||||
Log.i("Not checking PurchaseInfo as exp = $exp and cur = $currentDt");
|
||||
return;
|
||||
@ -25,6 +29,10 @@ class InAppPurchases {
|
||||
return;
|
||||
}
|
||||
|
||||
return confirmProPurchase();
|
||||
}
|
||||
|
||||
static Future<void> confirmProPurchase() async {
|
||||
var sub = await _subscriptionStatus();
|
||||
if (sub == null) {
|
||||
Log.i("Failed to get subscription status");
|
||||
|
Reference in New Issue
Block a user