Apple IAP
This commit is contained in:
parent
f9234f2174
commit
7b9d1f865a
|
|
@ -197,11 +197,7 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
|
||||||
subtitle: Column(
|
subtitle: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
previousPurchase != null
|
TextButton(
|
||||||
? IconButton(
|
|
||||||
onPressed: () => confirmPriceChange(context),
|
|
||||||
icon: const Icon(Icons.upgrade))
|
|
||||||
: TextButton(
|
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
backgroundColor: Colors.green[800],
|
backgroundColor: Colors.green[800],
|
||||||
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
|
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
|
||||||
|
|
@ -209,24 +205,29 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
|
||||||
primary: Colors.white,
|
primary: Colors.white,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
PurchaseParam purchaseParam;
|
if (previousPurchase != null) {
|
||||||
|
confirmPriceChange(context);
|
||||||
if (Platform.isAndroid) {
|
|
||||||
purchaseParam = GooglePlayPurchaseParam(
|
|
||||||
productDetails: productDetails,
|
|
||||||
applicationUserName: account.id);
|
|
||||||
} else {
|
} else {
|
||||||
purchaseParam = PurchaseParam(
|
PurchaseParam purchaseParam;
|
||||||
productDetails: productDetails,
|
|
||||||
applicationUserName: account.id,
|
if (Platform.isAndroid) {
|
||||||
|
purchaseParam = GooglePlayPurchaseParam(
|
||||||
|
productDetails: productDetails,
|
||||||
|
applicationUserName: account.id);
|
||||||
|
} else {
|
||||||
|
purchaseParam = PurchaseParam(
|
||||||
|
productDetails: productDetails,
|
||||||
|
applicationUserName: account.id,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_inAppPurchase.buyNonConsumable(
|
||||||
|
purchaseParam: purchaseParam,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_inAppPurchase.buyNonConsumable(
|
|
||||||
purchaseParam: purchaseParam,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
child: Text(productDetails.price),
|
child: Text(previousPurchase != null
|
||||||
|
? AppLocalization.of(context).activate : productDetails.price),
|
||||||
),
|
),
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
'activate': 'Activate',
|
||||||
'connect_apple': 'Connect Apple',
|
'connect_apple': 'Connect Apple',
|
||||||
'disconnect_apple': 'Disconnect Apple',
|
'disconnect_apple': 'Disconnect Apple',
|
||||||
'disconnected_apple': 'Successfully disconnected Apple',
|
'disconnected_apple': 'Successfully disconnected Apple',
|
||||||
|
|
@ -76186,6 +76187,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
_localizedValues[localeCode]['disconnect_apple'] ??
|
_localizedValues[localeCode]['disconnect_apple'] ??
|
||||||
_localizedValues['en']['disconnect_apple'];
|
_localizedValues['en']['disconnect_apple'];
|
||||||
|
|
||||||
|
String get activate =>
|
||||||
|
_localizedValues[localeCode]['activate'] ??
|
||||||
|
_localizedValues['en']['activate'];
|
||||||
|
|
||||||
|
|
||||||
// STARTER: lang field - do not remove comment
|
// STARTER: lang field - do not remove comment
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue