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: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';
|
||||
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 &&
|
||||
!isPaidAccount(context) &&
|
||||
!isApple() &&
|
||||
|
|
@ -394,18 +396,18 @@ class MenuDrawer extends StatelessWidget {
|
|||
? localization.upgrade
|
||||
: '',
|
||||
child: ListTile(
|
||||
contentPadding:
|
||||
const EdgeInsets.only(left: 12),
|
||||
dense: true,
|
||||
tileColor: Colors.green,
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
padding: const EdgeInsets.only(left: 6),
|
||||
child: Icon(
|
||||
Icons.arrow_circle_up,
|
||||
size: 22,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
contentPadding:
|
||||
const EdgeInsets.only(left: 20),
|
||||
title: state.isMenuCollapsed
|
||||
? SizedBox()
|
||||
: Text(
|
||||
|
|
@ -419,18 +421,18 @@ class MenuDrawer extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
onTap: () {
|
||||
/*
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) =>
|
||||
UpgradeDialog());
|
||||
*/
|
||||
|
||||
/*
|
||||
store.dispatch(ViewSettings(
|
||||
clearFilter: true,
|
||||
company: company,
|
||||
user: state.user,
|
||||
section: kSettingsAccountManagement));
|
||||
*/
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -122,7 +122,6 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
|
|||
ListView(
|
||||
children: <Widget>[
|
||||
_buildProductList(),
|
||||
_buildRestoreButton(),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
@ -150,6 +149,15 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
|
|||
return AlertDialog(
|
||||
title: Text(localization.upgrade),
|
||||
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);
|
||||
}
|
||||
|
||||
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() {
|
||||
setState(() {
|
||||
_purchasePending = true;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'restore_purchases': 'Restore Purchases',
|
||||
'activate': 'Activate',
|
||||
'connect_apple': 'Connect Apple',
|
||||
'disconnect_apple': 'Disconnect Apple',
|
||||
|
|
@ -76192,6 +76193,12 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
_localizedValues['en']['activate'];
|
||||
|
||||
|
||||
String get restorePurchases =>
|
||||
_localizedValues[localeCode]['restore_purchases'] ??
|
||||
_localizedValues['en']['restore_purchases'];
|
||||
|
||||
|
||||
|
||||
// STARTER: lang field - do not remove comment
|
||||
|
||||
String lookup(String key) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue