Temporarily fetch unstoppable domains only on mobile

This commit is contained in:
OmarHatem 2023-01-26 20:53:26 +02:00
parent 132033207e
commit adfebe6940

View file

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
const channel = MethodChannel('com.cake_wallet/native_utils'); const channel = MethodChannel('com.cake_wallet/native_utils');
@ -6,13 +8,18 @@ Future<String> fetchUnstoppableDomainAddress(String domain, String ticker) async
var address = ''; var address = '';
try { try {
address = await channel.invokeMethod<String>( if (Platform.isAndroid || Platform.isIOS) {
'getUnstoppableDomainAddress', address = await channel.invokeMethod<String>(
<String, String> { 'getUnstoppableDomainAddress',
'domain' : domain, <String, String> {
'ticker' : ticker 'domain' : domain,
} 'ticker' : ticker
) ?? ''; }
) ?? '';
} else {
// TODO: Integrate with Unstoppable domains resolution API
return address;
}
} catch (e) { } catch (e) {
print('Unstoppable domain error: ${e.toString()}'); print('Unstoppable domain error: ${e.toString()}');
address = ''; address = '';