diff --git a/lib/main.dart b/lib/main.dart index 58b99bc3e..64260877e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -210,7 +210,7 @@ class AppState extends State with SingleTickerProviderStateMixin { } print('got initial uri: $uri'); if (!mounted) return; - yatStore.yatAddress = 'Yat address'; // FIXME + _fetchEmojiFromUri(uri, yatStore); } catch (e) { if (!mounted) return; print(e.toString()); @@ -222,7 +222,7 @@ class AppState extends State with SingleTickerProviderStateMixin { stream = getUriLinksStream().listen((Uri uri) { if (!mounted) return; print('got uri: $uri'); - yatStore.yatAddress = 'Yat address'; // FIXME + _fetchEmojiFromUri(uri, yatStore); }, onError: (Object error) { if (!mounted) return; print('Error: $error'); @@ -230,6 +230,18 @@ class AppState extends State with SingleTickerProviderStateMixin { } } + void _fetchEmojiFromUri(Uri uri, YatStore yatStore) { + final queryParameters = uri.queryParameters; + if (queryParameters == null || queryParameters.isEmpty) { + return; + } + final emoji = queryParameters['eid']; + if (emoji == null || emoji.isEmpty) { + return; + } + yatStore.emoji = emoji; + } + @override Widget build(BuildContext context) { return Observer(builder: (BuildContext context) { diff --git a/lib/src/screens/receive/widgets/qr_widget.dart b/lib/src/screens/receive/widgets/qr_widget.dart index 360a9cea0..ee8506181 100644 --- a/lib/src/screens/receive/widgets/qr_widget.dart +++ b/lib/src/screens/receive/widgets/qr_widget.dart @@ -135,14 +135,14 @@ class QRWidget extends StatelessWidget { ))), ), Observer(builder: (_) { - return addressListViewModel.yatAddress.isNotEmpty + return addressListViewModel.emoji.isNotEmpty ? Padding( padding: EdgeInsets.only(bottom: 10), child: Builder( builder: (context) => GestureDetector( onTap: () { Clipboard.setData(ClipboardData( - text: addressListViewModel.yatAddress)); + text: addressListViewModel.emoji)); showBar( context, S.of(context).copied_to_clipboard); }, @@ -161,7 +161,7 @@ class QRWidget extends StatelessWidget { Padding( padding: EdgeInsets.only(top: 5), child: Text( - addressListViewModel.yatAddress, + addressListViewModel.emoji, textAlign: TextAlign.center, style: TextStyle( fontSize: 13, diff --git a/lib/src/screens/yat/yat_alert.dart b/lib/src/screens/yat/yat_alert.dart index 294dccb75..f67f0cf91 100644 --- a/lib/src/screens/yat/yat_alert.dart +++ b/lib/src/screens/yat/yat_alert.dart @@ -10,8 +10,8 @@ import 'package:url_launcher/url_launcher.dart'; class YatAlert extends StatelessWidget { static const aspectRatioImage = 1.133; - static const _baseUrl = 'https://yat.fyi'; - static const _signInSuffix = '/sign-in'; + static const _baseUrl = 'https://y.at'; + static const _signInSuffix = '/partner/CW/link'; static const _createSuffix = '/create'; final image = Image.asset('assets/images/yat_crypto.png'); diff --git a/lib/store/yat_store.dart b/lib/store/yat_store.dart index d57f6bfee..fdd107cf1 100644 --- a/lib/store/yat_store.dart +++ b/lib/store/yat_store.dart @@ -5,8 +5,8 @@ part 'yat_store.g.dart'; class YatStore = YatStoreBase with _$YatStore; abstract class YatStoreBase with Store { - YatStoreBase() : yatAddress = ''; + YatStoreBase() : emoji = ''; @observable - String yatAddress; + String emoji; } \ No newline at end of file diff --git a/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart b/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart index 9cc57aeb0..e5ed063e9 100644 --- a/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart +++ b/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart @@ -155,7 +155,7 @@ abstract class WalletAddressListViewModelBase with Store { bool get hasAddressList => _wallet.type == WalletType.monero; @computed - String get yatAddress => yatStore.yatAddress; + String get emoji => yatStore.emoji; @observable WalletBase, TransactionInfo>