Apple IAP

This commit is contained in:
Hillel Coren 2022-07-20 11:55:52 +03:00
parent 65a206ba6f
commit 1ab508420d
2 changed files with 22 additions and 21 deletions

View File

@ -10,7 +10,6 @@ import 'package:flutter/services.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
import 'package:invoiceninja_flutter/redux/auth/auth_actions.dart';
import 'package:invoiceninja_flutter/redux/settings/settings_actions.dart';
import 'package:invoiceninja_flutter/ui/app/upgrade_dialog.dart';
import 'package:invoiceninja_flutter/utils/app_review.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
@ -384,8 +383,7 @@ class MenuDrawer extends StatelessWidget {
},
),
),
if (true ||
state.userCompany.isOwner &&
if (state.userCompany.isOwner &&
state.isHosted &&
!isPaidAccount(context) &&
!isApple() &&
@ -397,6 +395,8 @@ class MenuDrawer extends StatelessWidget {
: '',
child: ListTile(
dense: true,
contentPadding:
const EdgeInsets.only(left: 12),
tileColor: Colors.green,
leading: IconButton(
onPressed: () => null,

View File

@ -161,15 +161,16 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
title: Text(localization.upgrade),
content: Column(
children: [
Expanded(child: Stack(children: stack)),
],
),
actions: [
if (!_loading)
TextButton(onPressed: () {
TextButton(
onPressed: () {
_inAppPurchase.restorePurchases();
}, child: Text(localization.restorePurchases)),
},
child: Text(localization.restorePurchases)),
TextButton(
child: Text(localization.termsOfService),
onPressed: () => launch(kTermsOfServiceURL),
@ -288,17 +289,17 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
final store = StoreProvider.of<AppState>(context);
final state = store.state;
final url = (state.isStaging ? kAppStagingUrl : kAppProductionUrl) + '/admin/subscription';
final url = (state.isStaging ? kAppStagingUrl : kAppProductionUrl) +
'/admin/subscription';
/*
await WebClient().post(url, state.credentials.token, data: jsonEncode({
await WebClient().post(url, state.credentials.token,
data: jsonEncode({
'inapp_transaction_id': purchaseDetails.purchaseID,
'account_id': state.account.id,
'plan': '',
'plan_term': '',
'plan_paid': (int.parse(purchase.transactionDate) / 1000).floor(),
'plan': purchaseDetails.productID,
'plan_paid':
(int.parse(purchaseDetails.transactionDate) / 1000).floor(),
}));
*/
}
void handleError(IAPError error) {