mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-03 17:40:43 +00:00
minor fix (#1371)
This commit is contained in:
parent
291aa710c6
commit
d4b317b3a0
1 changed files with 36 additions and 36 deletions
|
@ -155,7 +155,7 @@ class MoonPayProvider extends BuyProvider {
|
||||||
'baseCurrencyAmount': amount ?? '0',
|
'baseCurrencyAmount': amount ?? '0',
|
||||||
'currencyCode': currencyCode,
|
'currencyCode': currencyCode,
|
||||||
'walletAddress': walletAddress,
|
'walletAddress': walletAddress,
|
||||||
'lockAmount': 'true',
|
'lockAmount': 'false',
|
||||||
'showAllCurrencies': 'false',
|
'showAllCurrencies': 'false',
|
||||||
'showWalletAddressForm': 'false',
|
'showWalletAddressForm': 'false',
|
||||||
'enabledPaymentMethods':
|
'enabledPaymentMethods':
|
||||||
|
@ -256,44 +256,44 @@ class MoonPayProvider extends BuyProvider {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> launchProvider(BuildContext context, bool? isBuyAction) async {
|
Future<void> launchProvider(BuildContext context, bool? isBuyAction) async {
|
||||||
// try {
|
try {
|
||||||
late final Uri uri;
|
late final Uri uri;
|
||||||
if (isBuyAction ?? true) {
|
if (isBuyAction ?? true) {
|
||||||
uri = await requestBuyMoonPayUrl(
|
uri = await requestBuyMoonPayUrl(
|
||||||
currency: wallet.currency,
|
currency: wallet.currency,
|
||||||
walletAddress: wallet.walletAddresses.address,
|
walletAddress: wallet.walletAddresses.address,
|
||||||
settingsStore: _settingsStore,
|
settingsStore: _settingsStore,
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
uri = await requestSellMoonPayUrl(
|
|
||||||
currency: wallet.currency,
|
|
||||||
refundWalletAddress: wallet.walletAddresses.address,
|
|
||||||
settingsStore: _settingsStore,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (await canLaunchUrl(uri)) {
|
|
||||||
if (DeviceInfo.instance.isMobile) {
|
|
||||||
Navigator.of(context).pushNamed(Routes.webViewPage, arguments: ['MoonPay', uri]);
|
|
||||||
} else {
|
} else {
|
||||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
uri = await requestSellMoonPayUrl(
|
||||||
|
currency: wallet.currency,
|
||||||
|
refundWalletAddress: wallet.walletAddresses.address,
|
||||||
|
settingsStore: _settingsStore,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
throw Exception('Could not launch URL');
|
if (await canLaunchUrl(uri)) {
|
||||||
|
if (DeviceInfo.instance.isMobile) {
|
||||||
|
Navigator.of(context).pushNamed(Routes.webViewPage, arguments: ['MoonPay', uri]);
|
||||||
|
} else {
|
||||||
|
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw Exception('Could not launch URL');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
await showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertWithOneAction(
|
||||||
|
alertTitle: 'MoonPay',
|
||||||
|
alertContent: 'The MoonPay service is currently unavailable: $e',
|
||||||
|
buttonText: S.of(context).ok,
|
||||||
|
buttonAction: () => Navigator.of(context).pop(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// } catch (e) {
|
|
||||||
// await showDialog<void>(
|
|
||||||
// context: context,
|
|
||||||
// builder: (BuildContext context) {
|
|
||||||
// return AlertWithOneAction(
|
|
||||||
// alertTitle: 'MoonPay',
|
|
||||||
// alertContent: 'The MoonPay service is currently unavailable: $e',
|
|
||||||
// buttonText: S.of(context).ok,
|
|
||||||
// buttonAction: () => Navigator.of(context).pop(),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String _normalizeCurrency(CryptoCurrency currency) {
|
String _normalizeCurrency(CryptoCurrency currency) {
|
||||||
|
|
Loading…
Reference in a new issue