mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +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 (DeviceInfo.instance.isMobile) {
|
||||
Navigator.of(context)
|
||||
.pushNamed(Routes.webViewPage, arguments: ["DFX Connect", uri]);
|
||||
.pushNamed(Routes.webViewPage, arguments: [title, uri]);
|
||||
} else {
|
||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class OnRamperBuyProvider extends BuyProvider {
|
|||
return color.value.toRadixString(16).replaceAll(RegExp(r'^ff'), "");
|
||||
}
|
||||
|
||||
Uri requestOnramperUrl(BuildContext context) {
|
||||
Uri requestOnramperUrl(BuildContext context, bool? isBuyAction) {
|
||||
String primaryColor,
|
||||
secondaryColor,
|
||||
primaryTextColor,
|
||||
|
@ -79,23 +79,24 @@ class OnRamperBuyProvider extends BuyProvider {
|
|||
return Uri.https(_baseUrl, '', <String, dynamic>{
|
||||
'apiKey': _apiKey,
|
||||
'defaultCrypto': _normalizeCryptoCurrency,
|
||||
'sell_defaultCrypto': _normalizeCryptoCurrency,
|
||||
'networkWallets': '${networkName}:${wallet.walletAddresses.address}',
|
||||
'supportSell': "false",
|
||||
'supportSwap': "false",
|
||||
'primaryColor': primaryColor,
|
||||
'secondaryColor': secondaryColor,
|
||||
'primaryTextColor': primaryTextColor,
|
||||
'secondaryTextColor': secondaryTextColor,
|
||||
'containerColor': containerColor,
|
||||
'cardColor': cardColor
|
||||
'cardColor': cardColor,
|
||||
'mode': isBuyAction == true ? 'buy' : 'sell',
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> launchProvider(BuildContext context, bool? isBuyAction) async {
|
||||
final uri = requestOnramperUrl(context);
|
||||
final uri = requestOnramperUrl(context, isBuyAction);
|
||||
if (DeviceInfo.instance.isMobile) {
|
||||
Navigator.of(context)
|
||||
.pushNamed(Routes.webViewPage, arguments: [S.of(context).buy, uri]);
|
||||
.pushNamed(Routes.webViewPage, arguments: [title, uri]);
|
||||
} else {
|
||||
await launchUrl(uri);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,8 @@ class ProvidersHelper {
|
|||
return [ProviderType.askEachTime, ProviderType.dfx];
|
||||
case WalletType.bitcoin:
|
||||
case WalletType.ethereum:
|
||||
return [ProviderType.askEachTime, ProviderType.moonpaySell, ProviderType.dfx];
|
||||
return [ProviderType.askEachTime, ProviderType.onramper,
|
||||
ProviderType.moonpaySell, ProviderType.dfx];
|
||||
case WalletType.litecoin:
|
||||
case WalletType.bitcoinCash:
|
||||
return [ProviderType.askEachTime, ProviderType.moonpaySell];
|
||||
|
|
Loading…
Reference in a new issue