Apple IAP
This commit is contained in:
parent
65a206ba6f
commit
1ab508420d
|
|
@ -10,7 +10,6 @@ import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_redux/flutter_redux.dart';
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/auth/auth_actions.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/ui/app/upgrade_dialog.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/app_review.dart';
|
import 'package:invoiceninja_flutter/utils/app_review.dart';
|
||||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
|
|
@ -384,12 +383,11 @@ class MenuDrawer extends StatelessWidget {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (true ||
|
if (state.userCompany.isOwner &&
|
||||||
state.userCompany.isOwner &&
|
state.isHosted &&
|
||||||
state.isHosted &&
|
!isPaidAccount(context) &&
|
||||||
!isPaidAccount(context) &&
|
!isApple() &&
|
||||||
!isApple() &&
|
kReleaseMode)
|
||||||
kReleaseMode)
|
|
||||||
Material(
|
Material(
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: state.isMenuCollapsed
|
message: state.isMenuCollapsed
|
||||||
|
|
@ -397,6 +395,8 @@ class MenuDrawer extends StatelessWidget {
|
||||||
: '',
|
: '',
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
dense: true,
|
dense: true,
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.only(left: 12),
|
||||||
tileColor: Colors.green,
|
tileColor: Colors.green,
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () => null,
|
onPressed: () => null,
|
||||||
|
|
|
||||||
|
|
@ -161,15 +161,16 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
|
||||||
title: Text(localization.upgrade),
|
title: Text(localization.upgrade),
|
||||||
content: Column(
|
content: Column(
|
||||||
children: [
|
children: [
|
||||||
|
|
||||||
Expanded(child: Stack(children: stack)),
|
Expanded(child: Stack(children: stack)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
if (!_loading)
|
if (!_loading)
|
||||||
TextButton(onPressed: () {
|
TextButton(
|
||||||
_inAppPurchase.restorePurchases();
|
onPressed: () {
|
||||||
}, child: Text(localization.restorePurchases)),
|
_inAppPurchase.restorePurchases();
|
||||||
|
},
|
||||||
|
child: Text(localization.restorePurchases)),
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(localization.termsOfService),
|
child: Text(localization.termsOfService),
|
||||||
onPressed: () => launch(kTermsOfServiceURL),
|
onPressed: () => launch(kTermsOfServiceURL),
|
||||||
|
|
@ -288,17 +289,17 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
|
||||||
|
|
||||||
final store = StoreProvider.of<AppState>(context);
|
final store = StoreProvider.of<AppState>(context);
|
||||||
final state = store.state;
|
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,
|
||||||
await WebClient().post(url, state.credentials.token, data: jsonEncode({
|
data: jsonEncode({
|
||||||
'inapp_transaction_id': purchaseDetails.purchaseID,
|
'inapp_transaction_id': purchaseDetails.purchaseID,
|
||||||
'account_id': state.account.id,
|
'account_id': state.account.id,
|
||||||
'plan': '',
|
'plan': purchaseDetails.productID,
|
||||||
'plan_term': '',
|
'plan_paid':
|
||||||
'plan_paid': (int.parse(purchase.transactionDate) / 1000).floor(),
|
(int.parse(purchaseDetails.transactionDate) / 1000).floor(),
|
||||||
}));
|
}));
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleError(IAPError error) {
|
void handleError(IAPError error) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue