mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 01:37:40 +00:00
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
This commit is contained in:
parent
39c40255d3
commit
455efeb91f
5 changed files with 22 additions and 10 deletions
|
@ -210,7 +210,7 @@ class AppState extends State<App> 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<App> 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<App> 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) {
|
||||
|
|
|
@ -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<void>(
|
||||
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,
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo>
|
||||
|
|
Loading…
Reference in a new issue