CAKE-356 | replaced yatAddress to emoji in yat_store.dart, wallet_address_list_view_model.dart and qr_widget.dart; added _fetchEmojiFromUri method to main.dart; changed url for yat service in the yat_alert.dart
OleksandrSobol committed
Sep 7, 2021 at 19:43 UTC
455efeb91f1be1beef859ec5dc471b90b5420a11
5 files changed
+22
-10
lib/main.dart
+14
-2
@@ -210,7 +210,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
210
}
211
print('got initial uri: $uri');
212
if (!mounted) return;
213
- yatStore.yatAddress = 'Yat address'; // FIXME
213
+ _fetchEmojiFromUri(uri, yatStore);
214
} catch (e) {
215
if (!mounted) return;
216
print(e.toString());
@@ -222,7 +222,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
222
stream = getUriLinksStream().listen((Uri uri) {
223
if (!mounted) return;
224
print('got uri: $uri');
225
- yatStore.yatAddress = 'Yat address'; // FIXME
225
+ _fetchEmojiFromUri(uri, yatStore);
226
}, onError: (Object error) {
227
if (!mounted) return;
228
print('Error: $error');
@@ -230,6 +230,18 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
230
}
231
}
232
233
+ void _fetchEmojiFromUri(Uri uri, YatStore yatStore) {
234
+ final queryParameters = uri.queryParameters;
235
+ if (queryParameters == null || queryParameters.isEmpty) {
236
+ return;
237
+ }
238
+ final emoji = queryParameters['eid'];
239
+ if (emoji == null || emoji.isEmpty) {
240
+ return;
241
+ }
242
+ yatStore.emoji = emoji;
243
+ }
244
+
245
@override
246
Widget build(BuildContext context) {
247
return Observer(builder: (BuildContext context) {
lib/src/screens/receive/widgets/qr_widget.dart
+3
-3
@@ -135,14 +135,14 @@ class QRWidget extends StatelessWidget {
135
))),
136
),
137
Observer(builder: (_) {
138
- return addressListViewModel.yatAddress.isNotEmpty
138
+ return addressListViewModel.emoji.isNotEmpty
139
? Padding(
140
padding: EdgeInsets.only(bottom: 10),
141
child: Builder(
142
builder: (context) => GestureDetector(
143
onTap: () {
144
Clipboard.setData(ClipboardData(
145
- text: addressListViewModel.yatAddress));
145
+ text: addressListViewModel.emoji));
146
showBar<void>(
147
context, S.of(context).copied_to_clipboard);
148
},
@@ -161,7 +161,7 @@ class QRWidget extends StatelessWidget {
161
Padding(
162
padding: EdgeInsets.only(top: 5),
163
child: Text(
164
- addressListViewModel.yatAddress,
164
+ addressListViewModel.emoji,
165
textAlign: TextAlign.center,
166
style: TextStyle(
167
fontSize: 13,
lib/src/screens/yat/yat_alert.dart
+2
-2
@@ -10,8 +10,8 @@ import 'package:url_launcher/url_launcher.dart';
10
11
class YatAlert extends StatelessWidget {
12
static const aspectRatioImage = 1.133;
13
- static const _baseUrl = 'https://yat.fyi';
14
- static const _signInSuffix = '/sign-in';
13
+ static const _baseUrl = 'https://y.at';
14
+ static const _signInSuffix = '/partner/CW/link';
15
static const _createSuffix = '/create';
16
final image = Image.asset('assets/images/yat_crypto.png');
17
lib/store/yat_store.dart
+2
-2
@@ -5,8 +5,8 @@ part 'yat_store.g.dart';
5
class YatStore = YatStoreBase with _$YatStore;
6
7
abstract class YatStoreBase with Store {
8
- YatStoreBase() : yatAddress = '';
8
+ YatStoreBase() : emoji = '';
9
10
@observable
11
- String yatAddress;
11
+ String emoji;
12
}
\ No newline at end of file
lib/view_model/wallet_address_list/wallet_address_list_view_model.dart
+1
-1
@@ -155,7 +155,7 @@ abstract class WalletAddressListViewModelBase with Store {
155
bool get hasAddressList => _wallet.type == WalletType.monero;
156
157
@computed
158
- String get yatAddress => yatStore.yatAddress;
158
+ String get emoji => yatStore.emoji;
159
160
@observable
161
WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo>