minor fix (#1371)
Matthew Fosse committed
Apr 8, 2024 at 10:42 UTC
d4b317b3a0ee77245666651aad4638f9d2c3700c
1 file changed
+35
-35
lib/buy/moonpay/moonpay_provider.dart
+35
-35
@@ -155,7 +155,7 @@ class MoonPayProvider extends BuyProvider {
155
'baseCurrencyAmount': amount ?? '0',
156
'currencyCode': currencyCode,
157
'walletAddress': walletAddress,
158
- 'lockAmount': 'true',
158
+ 'lockAmount': 'false',
159
'showAllCurrencies': 'false',
160
'showWalletAddressForm': 'false',
161
'enabledPaymentMethods':
@@ -256,44 +256,44 @@ class MoonPayProvider extends BuyProvider {
256
257
@override
258
Future<void> launchProvider(BuildContext context, bool? isBuyAction) async {
259
- // try {
260
- late final Uri uri;
261
- if (isBuyAction ?? true) {
262
- uri = await requestBuyMoonPayUrl(
263
- currency: wallet.currency,
264
- walletAddress: wallet.walletAddresses.address,
265
- settingsStore: _settingsStore,
266
- );
267
- } else {
268
- uri = await requestSellMoonPayUrl(
269
- currency: wallet.currency,
270
- refundWalletAddress: wallet.walletAddresses.address,
271
- settingsStore: _settingsStore,
272
- );
273
- }
259
+ try {
260
+ late final Uri uri;
261
+ if (isBuyAction ?? true) {
262
+ uri = await requestBuyMoonPayUrl(
263
+ currency: wallet.currency,
264
+ walletAddress: wallet.walletAddresses.address,
265
+ settingsStore: _settingsStore,
266
+ );
267
+ } else {
268
+ uri = await requestSellMoonPayUrl(
269
+ currency: wallet.currency,
270
+ refundWalletAddress: wallet.walletAddresses.address,
271
+ settingsStore: _settingsStore,
272
+ );
273
+ }
274
275
- if (await canLaunchUrl(uri)) {
276
- if (DeviceInfo.instance.isMobile) {
277
- Navigator.of(context).pushNamed(Routes.webViewPage, arguments: ['MoonPay', uri]);
275
+ if (await canLaunchUrl(uri)) {
276
+ if (DeviceInfo.instance.isMobile) {
277
+ Navigator.of(context).pushNamed(Routes.webViewPage, arguments: ['MoonPay', uri]);
278
+ } else {
279
+ await launchUrl(uri, mode: LaunchMode.externalApplication);
280
+ }
281
} else {
279
- await launchUrl(uri, mode: LaunchMode.externalApplication);
282
+ throw Exception('Could not launch URL');
283
}
281
- } else {
282
- throw Exception('Could not launch URL');
284
+ } catch (e) {
285
+ await showDialog<void>(
286
+ context: context,
287
+ builder: (BuildContext context) {
288
+ return AlertWithOneAction(
289
+ alertTitle: 'MoonPay',
290
+ alertContent: 'The MoonPay service is currently unavailable: $e',
291
+ buttonText: S.of(context).ok,
292
+ buttonAction: () => Navigator.of(context).pop(),
293
+ );
294
+ },
295
+ );
296
}
284
- // } catch (e) {
285
- // await showDialog<void>(
286
- // context: context,
287
- // builder: (BuildContext context) {
288
- // return AlertWithOneAction(
289
- // alertTitle: 'MoonPay',
290
- // alertContent: 'The MoonPay service is currently unavailable: $e',
291
- // buttonText: S.of(context).ok,
292
- // buttonAction: () => Navigator.of(context).pop(),
293
- // );
294
- // },
295
- // );
296
- // }
297
}
298
299
String _normalizeCurrency(CryptoCurrency currency) {