mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
Cw 533 add the sell option from on ramper (#1251)
* add sell option from onramper * minor fix * fix default sell param
This commit is contained in:
parent
133fa2987a
commit
26cde6a193
3 changed files with 9 additions and 7 deletions
|
@ -179,7 +179,7 @@ class DFXBuyProvider extends BuyProvider {
|
||||||
if (await canLaunchUrl(uri)) {
|
if (await canLaunchUrl(uri)) {
|
||||||
if (DeviceInfo.instance.isMobile) {
|
if (DeviceInfo.instance.isMobile) {
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
.pushNamed(Routes.webViewPage, arguments: ["DFX Connect", uri]);
|
.pushNamed(Routes.webViewPage, arguments: [title, uri]);
|
||||||
} else {
|
} else {
|
||||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ class OnRamperBuyProvider extends BuyProvider {
|
||||||
return color.value.toRadixString(16).replaceAll(RegExp(r'^ff'), "");
|
return color.value.toRadixString(16).replaceAll(RegExp(r'^ff'), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
Uri requestOnramperUrl(BuildContext context) {
|
Uri requestOnramperUrl(BuildContext context, bool? isBuyAction) {
|
||||||
String primaryColor,
|
String primaryColor,
|
||||||
secondaryColor,
|
secondaryColor,
|
||||||
primaryTextColor,
|
primaryTextColor,
|
||||||
|
@ -79,23 +79,24 @@ class OnRamperBuyProvider extends BuyProvider {
|
||||||
return Uri.https(_baseUrl, '', <String, dynamic>{
|
return Uri.https(_baseUrl, '', <String, dynamic>{
|
||||||
'apiKey': _apiKey,
|
'apiKey': _apiKey,
|
||||||
'defaultCrypto': _normalizeCryptoCurrency,
|
'defaultCrypto': _normalizeCryptoCurrency,
|
||||||
|
'sell_defaultCrypto': _normalizeCryptoCurrency,
|
||||||
'networkWallets': '${networkName}:${wallet.walletAddresses.address}',
|
'networkWallets': '${networkName}:${wallet.walletAddresses.address}',
|
||||||
'supportSell': "false",
|
|
||||||
'supportSwap': "false",
|
'supportSwap': "false",
|
||||||
'primaryColor': primaryColor,
|
'primaryColor': primaryColor,
|
||||||
'secondaryColor': secondaryColor,
|
'secondaryColor': secondaryColor,
|
||||||
'primaryTextColor': primaryTextColor,
|
'primaryTextColor': primaryTextColor,
|
||||||
'secondaryTextColor': secondaryTextColor,
|
'secondaryTextColor': secondaryTextColor,
|
||||||
'containerColor': containerColor,
|
'containerColor': containerColor,
|
||||||
'cardColor': cardColor
|
'cardColor': cardColor,
|
||||||
|
'mode': isBuyAction == true ? 'buy' : 'sell',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> launchProvider(BuildContext context, bool? isBuyAction) async {
|
Future<void> launchProvider(BuildContext context, bool? isBuyAction) async {
|
||||||
final uri = requestOnramperUrl(context);
|
final uri = requestOnramperUrl(context, isBuyAction);
|
||||||
if (DeviceInfo.instance.isMobile) {
|
if (DeviceInfo.instance.isMobile) {
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
.pushNamed(Routes.webViewPage, arguments: [S.of(context).buy, uri]);
|
.pushNamed(Routes.webViewPage, arguments: [title, uri]);
|
||||||
} else {
|
} else {
|
||||||
await launchUrl(uri);
|
await launchUrl(uri);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,8 @@ class ProvidersHelper {
|
||||||
return [ProviderType.askEachTime, ProviderType.dfx];
|
return [ProviderType.askEachTime, ProviderType.dfx];
|
||||||
case WalletType.bitcoin:
|
case WalletType.bitcoin:
|
||||||
case WalletType.ethereum:
|
case WalletType.ethereum:
|
||||||
return [ProviderType.askEachTime, ProviderType.moonpaySell, ProviderType.dfx];
|
return [ProviderType.askEachTime, ProviderType.onramper,
|
||||||
|
ProviderType.moonpaySell, ProviderType.dfx];
|
||||||
case WalletType.litecoin:
|
case WalletType.litecoin:
|
||||||
case WalletType.bitcoinCash:
|
case WalletType.bitcoinCash:
|
||||||
return [ProviderType.askEachTime, ProviderType.moonpaySell];
|
return [ProviderType.askEachTime, ProviderType.moonpaySell];
|
||||||
|
|
Loading…
Reference in a new issue