Improve checks to support IAP

This commit is contained in:
Hillel Coren 2023-07-31 13:06:13 +03:00
parent 50ff6a76cc
commit a32c1fab29
5 changed files with 9 additions and 6 deletions

View File

@ -111,6 +111,8 @@ abstract class AccountEntity
@BuiltValueField(wireName: 'payment_id')
String get paymentId;
bool get canMakeIAP => !hasIapPlan && paymentId.isEmpty;
bool get isUpdateAvailable {
if (disableAutoUpdate) {
return false;

View File

@ -151,7 +151,8 @@ class EditScaffold extends StatelessWidget {
onTap: () async {
if (bannerClick != null) {
bannerClick();
} else if (supportsInAppPurchase()) {
} else if (supportsInAppPurchase() &&
account.canMakeIAP) {
showDialog<void>(
context: context,
builder: (context) => UpgradeDialog(),

View File

@ -340,7 +340,8 @@ class _InvoiceEmailViewState extends State<InvoiceEmailView>
),
),
onPressed: () {
if (supportsInAppPurchase()) {
if (supportsInAppPurchase() &&
state.account.canMakeIAP) {
showDialog<void>(
context: context,
builder: (context) => UpgradeDialog(),

View File

@ -432,7 +432,8 @@ class ReportsScreen extends StatelessWidget {
AppButton(
label: localization.upgrade.toUpperCase(),
onPressed: () {
if (supportsInAppPurchase()) {
if (supportsInAppPurchase() &&
state.account.canMakeIAP) {
showDialog<void>(
context: context,
builder: (context) => UpgradeDialog(),

View File

@ -389,9 +389,7 @@ class _AccountOverview extends StatelessWidget {
),
),
onPressed: () {
if (supportsInAppPurchase() &&
!account.hasIapPlan &&
account.paymentId.isEmpty) {
if (supportsInAppPurchase() && account.canMakeIAP) {
showDialog<void>(
context: context,
builder: (context) => UpgradeDialog(),