mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-23 06:38:35 +02:00
CAKE-360 | added shouldShowYatPopup parameter to settings_store.dart and applied this parameter to dashboard_view_model.dart and dashboard_page.dart; added scrollbar to choose_yat_address_alert.dart; changed yat logo; fixed fetchYatAddress() method in the yat_store.dart; created class YatLink
This commit is contained in:
@@ -38,6 +38,7 @@ abstract class SettingsStoreBase with Store {
|
||||
@required Map<WalletType, Node> nodes,
|
||||
@required TransactionPriority initialBitcoinTransactionPriority,
|
||||
@required TransactionPriority initialMoneroTransactionPriority,
|
||||
@required this.shouldShowYatPopup,
|
||||
@required this.isBitcoinBuyEnabled,
|
||||
this.actionlistDisplayMode}) {
|
||||
fiatCurrency = initialFiatCurrency;
|
||||
@@ -59,6 +60,11 @@ abstract class SettingsStoreBase with Store {
|
||||
(FiatCurrency fiatCurrency) => sharedPreferences.setString(
|
||||
PreferencesKey.currentFiatCurrencyKey, fiatCurrency.serialize()));
|
||||
|
||||
reaction(
|
||||
(_) => shouldShowYatPopup,
|
||||
(bool shouldShowYatPopup) => sharedPreferences
|
||||
.setBool(PreferencesKey.shouldShowYatPopup, shouldShowYatPopup));
|
||||
|
||||
priority.observe((change) {
|
||||
final key = change.key == WalletType.monero
|
||||
? PreferencesKey.moneroTransactionPriority
|
||||
@@ -110,6 +116,9 @@ abstract class SettingsStoreBase with Store {
|
||||
@observable
|
||||
FiatCurrency fiatCurrency;
|
||||
|
||||
@observable
|
||||
bool shouldShowYatPopup;
|
||||
|
||||
@observable
|
||||
ObservableList<ActionListDisplayMode> actionlistDisplayMode;
|
||||
|
||||
@@ -217,6 +226,8 @@ abstract class SettingsStoreBase with Store {
|
||||
final bitcoinElectrumServer = nodeSource.get(bitcoinElectrumServerId);
|
||||
final litecoinElectrumServer = nodeSource.get(litecoinElectrumServerId);
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
final shouldShowYatPopup =
|
||||
sharedPreferences.getBool(PreferencesKey.shouldShowYatPopup) ?? true;
|
||||
|
||||
return SettingsStore(
|
||||
sharedPreferences: sharedPreferences,
|
||||
@@ -236,7 +247,8 @@ abstract class SettingsStoreBase with Store {
|
||||
initialPinLength: pinLength,
|
||||
initialLanguageCode: savedLanguageCode,
|
||||
initialMoneroTransactionPriority: moneroTransactionPriority,
|
||||
initialBitcoinTransactionPriority: bitcoinTransactionPriority);
|
||||
initialBitcoinTransactionPriority: bitcoinTransactionPriority,
|
||||
shouldShowYatPopup: shouldShowYatPopup);
|
||||
}
|
||||
|
||||
Future<void> reload(
|
||||
@@ -270,6 +282,7 @@ abstract class SettingsStoreBase with Store {
|
||||
pinCodeLength = settings.pinCodeLength;
|
||||
languageCode = settings.languageCode;
|
||||
appVersion = settings.appVersion;
|
||||
shouldShowYatPopup = settings.shouldShowYatPopup;
|
||||
}
|
||||
|
||||
Future<void> _saveCurrentNode(Node node, WalletType walletType) async {
|
||||
|
||||
@@ -15,18 +15,24 @@ import 'package:http/http.dart';
|
||||
|
||||
part 'yat_store.g.dart';
|
||||
|
||||
const baseDevUrl = 'https://yat.fyi';
|
||||
const baseReleaseUrl = 'https://y.at';
|
||||
const signInSuffix = '/partner/CW/link-email';
|
||||
const createSuffix = '/create';
|
||||
const queryParameter = '?addresses=';
|
||||
const requestDevUrl = 'https://a.yat.fyi/emoji_id/';
|
||||
const requestReleaseUrl = 'https://a.y.at/emoji_id/';
|
||||
const isYatDevMode = true;
|
||||
class YatLink {
|
||||
static const baseDevUrl = 'https://yat.fyi';
|
||||
static const baseReleaseUrl = 'https://y.at';
|
||||
static const signInSuffix = '/partner/CW/link-email';
|
||||
static const createSuffix = '/create';
|
||||
static const queryParameter = '?addresses=';
|
||||
static const requestDevUrl = 'https://a.yat.fyi/emoji_id/';
|
||||
static const requestReleaseUrl = 'https://a.y.at/emoji_id/';
|
||||
static const isDevMode = true;
|
||||
static const tags = <String, List<String>>{"XMR" : ['0x1001', '0x1002'],
|
||||
"BTC" : ['0x1003'], "LTC" : ['0x3fff']};
|
||||
}
|
||||
|
||||
Future<List<String>> fetchYatAddress(String emojiId, String ticker) async {
|
||||
final requestURL = isYatDevMode ? requestDevUrl : requestReleaseUrl;
|
||||
final url = requestURL + emojiId + '/' + ticker.toUpperCase();
|
||||
final requestURL = YatLink.isDevMode
|
||||
? YatLink.requestDevUrl
|
||||
: YatLink.requestReleaseUrl;
|
||||
final url = requestURL + emojiId;
|
||||
final response = await get(url);
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
@@ -41,11 +47,18 @@ Future<List<String>> fetchYatAddress(String emojiId, String ticker) async {
|
||||
}
|
||||
|
||||
final List<String> addresses = [];
|
||||
final currency = ticker.toUpperCase();
|
||||
|
||||
for (var elem in result) {
|
||||
final yatAddress = elem['data'] as String;
|
||||
if (yatAddress?.isNotEmpty ?? false) {
|
||||
addresses.add(yatAddress);
|
||||
final tag = elem['tag'] as String;
|
||||
if (tag?.isEmpty ?? true) {
|
||||
continue;
|
||||
}
|
||||
if (YatLink.tags[currency]?.contains(tag) ?? false) {
|
||||
final yatAddress = elem['data'] as String;
|
||||
if (yatAddress?.isNotEmpty ?? false) {
|
||||
addresses.add(yatAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,8 +136,8 @@ abstract class YatStoreBase with Store {
|
||||
}
|
||||
|
||||
parameters += subaddress.address.startsWith('4')
|
||||
? '0x1001%3D'
|
||||
: '0x1002%3D';
|
||||
? YatLink.tags["XMR"].first + '%3D'
|
||||
: YatLink.tags["XMR"].last + '%3D';
|
||||
|
||||
parameters += subaddress.address;
|
||||
});
|
||||
@@ -141,7 +154,7 @@ abstract class YatStoreBase with Store {
|
||||
isFirstAddress = !isFirstAddress;
|
||||
}
|
||||
|
||||
parameters += '0x1003%3D' + record.address;
|
||||
parameters += YatLink.tags["BTC"].first + '%3D' + record.address;
|
||||
});
|
||||
break;
|
||||
case WalletType.litecoin:
|
||||
@@ -155,7 +168,7 @@ abstract class YatStoreBase with Store {
|
||||
isFirstAddress = !isFirstAddress;
|
||||
}
|
||||
|
||||
parameters += '0x3fff%3D' + record.address;
|
||||
parameters += YatLink.tags["LTC"].first + '%3D' + record.address;
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user