Apple IAP
This commit is contained in:
parent
c41d48cc24
commit
579d96bc93
|
|
@ -11,6 +11,7 @@ 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/redux/settings/settings_actions.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';
|
||||||
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
||||||
|
|
@ -383,7 +384,8 @@ class MenuDrawer extends StatelessWidget {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (state.userCompany.isOwner &&
|
if (true ||
|
||||||
|
state.userCompany.isOwner &&
|
||||||
state.isHosted &&
|
state.isHosted &&
|
||||||
!isPaidAccount(context) &&
|
!isPaidAccount(context) &&
|
||||||
!isApple() &&
|
!isApple() &&
|
||||||
|
|
@ -394,18 +396,18 @@ class MenuDrawer extends StatelessWidget {
|
||||||
? localization.upgrade
|
? localization.upgrade
|
||||||
: '',
|
: '',
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
contentPadding:
|
|
||||||
const EdgeInsets.only(left: 12),
|
|
||||||
dense: true,
|
dense: true,
|
||||||
tileColor: Colors.green,
|
tileColor: Colors.green,
|
||||||
leading: Padding(
|
leading: Padding(
|
||||||
padding: const EdgeInsets.only(left: 10),
|
padding: const EdgeInsets.only(left: 6),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.arrow_circle_up,
|
Icons.arrow_circle_up,
|
||||||
size: 22,
|
size: 22,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.only(left: 20),
|
||||||
title: state.isMenuCollapsed
|
title: state.isMenuCollapsed
|
||||||
? SizedBox()
|
? SizedBox()
|
||||||
: Text(
|
: Text(
|
||||||
|
|
@ -419,18 +421,18 @@ class MenuDrawer extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
/*
|
|
||||||
showDialog<void>(
|
showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) =>
|
builder: (BuildContext context) =>
|
||||||
UpgradeDialog());
|
UpgradeDialog());
|
||||||
*/
|
|
||||||
|
|
||||||
|
/*
|
||||||
store.dispatch(ViewSettings(
|
store.dispatch(ViewSettings(
|
||||||
clearFilter: true,
|
clearFilter: true,
|
||||||
company: company,
|
company: company,
|
||||||
user: state.user,
|
user: state.user,
|
||||||
section: kSettingsAccountManagement));
|
section: kSettingsAccountManagement));
|
||||||
|
*/
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,6 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
|
||||||
ListView(
|
ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
_buildProductList(),
|
_buildProductList(),
|
||||||
_buildRestoreButton(),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
@ -150,6 +149,15 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text(localization.upgrade),
|
title: Text(localization.upgrade),
|
||||||
content: Stack(children: stack),
|
content: Stack(children: stack),
|
||||||
|
actions: [
|
||||||
|
if (!_loading)
|
||||||
|
TextButton(onPressed: () {
|
||||||
|
_inAppPurchase.restorePurchases();
|
||||||
|
}, child: Text(localization.restorePurchases)),
|
||||||
|
TextButton(onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}, child: Text(localization.close)),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -240,32 +248,6 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
|
||||||
return Column(children: productList);
|
return Column(children: productList);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRestoreButton() {
|
|
||||||
if (_loading) {
|
|
||||||
return Container();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(4.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
style: TextButton.styleFrom(
|
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
|
||||||
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
primary: Colors.white,
|
|
||||||
),
|
|
||||||
onPressed: () => _inAppPurchase.restorePurchases(),
|
|
||||||
child: const Text('Restore purchases'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void showPendingUI() {
|
void showPendingUI() {
|
||||||
setState(() {
|
setState(() {
|
||||||
_purchasePending = true;
|
_purchasePending = true;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'en': {
|
||||||
// STARTER: lang key - do not remove comment
|
// STARTER: lang key - do not remove comment
|
||||||
|
'restore_purchases': 'Restore Purchases',
|
||||||
'activate': 'Activate',
|
'activate': 'Activate',
|
||||||
'connect_apple': 'Connect Apple',
|
'connect_apple': 'Connect Apple',
|
||||||
'disconnect_apple': 'Disconnect Apple',
|
'disconnect_apple': 'Disconnect Apple',
|
||||||
|
|
@ -76192,6 +76193,12 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
_localizedValues['en']['activate'];
|
_localizedValues['en']['activate'];
|
||||||
|
|
||||||
|
|
||||||
|
String get restorePurchases =>
|
||||||
|
_localizedValues[localeCode]['restore_purchases'] ??
|
||||||
|
_localizedValues['en']['restore_purchases'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// STARTER: lang field - do not remove comment
|
// STARTER: lang field - do not remove comment
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue