From 46fe178b08c5f93aacde3ee7eba39c6785c52959 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Mon, 2 Jan 2023 11:44:33 -0700 Subject: [PATCH 01/45] loading animation on changing receive currency --- lib/pages/exchange_view/exchange_form.dart | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/pages/exchange_view/exchange_form.dart b/lib/pages/exchange_view/exchange_form.dart index 251e0b8ef..fb7915969 100644 --- a/lib/pages/exchange_view/exchange_form.dart +++ b/lib/pages/exchange_view/exchange_form.dart @@ -246,6 +246,29 @@ class _ExchangeFormState extends ConsumerState { fromTicker: ref.read(exchangeFormStateProvider).fromTicker ?? "", onSelected: (to) => ref.read(exchangeFormStateProvider).updateTo(to, true)); + + unawaited( + showDialog( + context: context, + barrierDismissible: false, + builder: (_) => WillPopScope( + onWillPop: () async => false, + child: Container( + color: Theme.of(context) + .extension()! + .overlay + .withOpacity(0.6), + child: const CustomLoadingOverlay( + message: "Updating exchange rate", + eventBus: null, + ), + ), + ), + ), + ); + + await Future.delayed(const Duration(milliseconds: 300)); + Navigator.of(context).pop(); } else { final fromTicker = ref.read(exchangeFormStateProvider).fromTicker ?? ""; final toTicker = ref.read(exchangeFormStateProvider).toTicker ?? ""; From 66e9f87c0f2621c69f300d934f36c98584975e63 Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 2 Jan 2023 16:43:04 -0600 Subject: [PATCH 02/45] increase xmr/wow autosave timer period --- lib/services/coins/monero/monero_wallet.dart | 2 +- lib/services/coins/wownero/wownero_wallet.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/services/coins/monero/monero_wallet.dart b/lib/services/coins/monero/monero_wallet.dart index f0869259b..96fb2ee7f 100644 --- a/lib/services/coins/monero/monero_wallet.dart +++ b/lib/services/coins/monero/monero_wallet.dart @@ -781,7 +781,7 @@ class MoneroWallet extends CoinServiceAPI { await refresh(); _autoSaveTimer?.cancel(); _autoSaveTimer = Timer.periodic( - const Duration(seconds: 93), + const Duration(seconds: 193), (_) async => await walletBase?.save(), ); } else { diff --git a/lib/services/coins/wownero/wownero_wallet.dart b/lib/services/coins/wownero/wownero_wallet.dart index d21ebab8c..1f9a3dd96 100644 --- a/lib/services/coins/wownero/wownero_wallet.dart +++ b/lib/services/coins/wownero/wownero_wallet.dart @@ -812,7 +812,7 @@ class WowneroWallet extends CoinServiceAPI { await refresh(); _autoSaveTimer?.cancel(); _autoSaveTimer = Timer.periodic( - const Duration(seconds: 93), + const Duration(seconds: 193), (_) async => await walletBase?.save(), ); } else { From b3ff38adb74b9525e6a8d2f964f44609e1664d8b Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 2 Jan 2023 16:43:39 -0600 Subject: [PATCH 03/45] check and update ui if xmr/wow data found during re/scan --- lib/services/coins/monero/monero_wallet.dart | 43 +++++++++++++++++++ .../coins/wownero/wownero_wallet.dart | 43 +++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/lib/services/coins/monero/monero_wallet.dart b/lib/services/coins/monero/monero_wallet.dart index 96fb2ee7f..d9c6ae42b 100644 --- a/lib/services/coins/monero/monero_wallet.dart +++ b/lib/services/coins/monero/monero_wallet.dart @@ -1119,6 +1119,7 @@ class MoneroWallet extends CoinServiceAPI { print("============================="); print("New Block! :: $walletName"); print("============================="); + _refreshTxDataHelper(); } void onNewTransaction() { @@ -1136,6 +1137,48 @@ class MoneroWallet extends CoinServiceAPI { ); } + bool _txRefreshLock = false; + int _lastCheckedHeight = -1; + int _txCount = 0; + + Future _refreshTxDataHelper() async { + if (_txRefreshLock) return; + _txRefreshLock = true; + + final syncStatus = walletBase?.syncStatus; + + if (syncStatus != null && syncStatus is SyncingSyncStatus) { + final int blocksLeft = syncStatus.blocksLeft; + final tenKChange = blocksLeft ~/ 10000; + + // only refresh transactions periodically during a sync + if (_lastCheckedHeight == -1 || tenKChange < _lastCheckedHeight) { + _lastCheckedHeight = tenKChange; + await _refreshTxData(); + } + } else { + await _refreshTxData(); + } + + _txRefreshLock = false; + } + + Future _refreshTxData() async { + final txnData = await _fetchTransactionData(); + final count = txnData.getAllTransactions().length; + + if (count > _txCount) { + _txCount = count; + _transactionData = Future(() => txnData); + GlobalEventBus.instance.fire( + UpdatedInBackgroundEvent( + "New transaction data found in $walletId $walletName!", + walletId, + ), + ); + } + } + void syncStatusChanged() async { final syncStatus = walletBase?.syncStatus; if (syncStatus != null) { diff --git a/lib/services/coins/wownero/wownero_wallet.dart b/lib/services/coins/wownero/wownero_wallet.dart index 1f9a3dd96..7abd64f48 100644 --- a/lib/services/coins/wownero/wownero_wallet.dart +++ b/lib/services/coins/wownero/wownero_wallet.dart @@ -1163,6 +1163,49 @@ class WowneroWallet extends CoinServiceAPI { print("============================="); print("New Wownero Block! :: $walletName"); print("============================="); + _refreshTxDataHelper(); + } + + bool _txRefreshLock = false; + int _lastCheckedHeight = -1; + int _txCount = 0; + + Future _refreshTxDataHelper() async { + if (_txRefreshLock) return; + _txRefreshLock = true; + + final syncStatus = walletBase?.syncStatus; + + if (syncStatus != null && syncStatus is SyncingSyncStatus) { + final int blocksLeft = syncStatus.blocksLeft; + final tenKChange = blocksLeft ~/ 10000; + + // only refresh transactions periodically during a sync + if (_lastCheckedHeight == -1 || tenKChange < _lastCheckedHeight) { + _lastCheckedHeight = tenKChange; + await _refreshTxData(); + } + } else { + await _refreshTxData(); + } + + _txRefreshLock = false; + } + + Future _refreshTxData() async { + final txnData = await _fetchTransactionData(); + final count = txnData.getAllTransactions().length; + + if (count > _txCount) { + _txCount = count; + _transactionData = Future(() => txnData); + GlobalEventBus.instance.fire( + UpdatedInBackgroundEvent( + "New transaction data found in $walletId $walletName!", + walletId, + ), + ); + } } void onNewTransaction() { From fb95052f96f4a75bec501ca7aa24cd39a55b2d4e Mon Sep 17 00:00:00 2001 From: sneurlax Date: Mon, 2 Jan 2023 17:08:44 -0600 Subject: [PATCH 04/45] Use pre-Windows flutter_libmonero (#287) * ref update: user flutter_libmonero#xmr-prewindows for testing merge flutter_libmonero#xmr-prewindows to staging and then main and update ref again for production * cherrypick xmr-listener-callback changes instead of merging which brings windows changes along with it * pubspec update --- crypto_plugins/flutter_libmonero | 2 +- pubspec.lock | 45 ++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/crypto_plugins/flutter_libmonero b/crypto_plugins/flutter_libmonero index 66eaa2f3c..201ebc2ca 160000 --- a/crypto_plugins/flutter_libmonero +++ b/crypto_plugins/flutter_libmonero @@ -1 +1 @@ -Subproject commit 66eaa2f3c7133f1dbf0b1fc950e7a9e3cc611185 +Subproject commit 201ebc2ca4ef003b2b264af47467868a00fcbd73 diff --git a/pubspec.lock b/pubspec.lock index ecc0bdf8d..e8f875d35 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -42,7 +42,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.3.0" + version: "3.1.11" args: dependency: transitive description: @@ -63,7 +63,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.9.0" + version: "2.8.2" barcode_scan2: dependency: "direct main" description: @@ -190,7 +190,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.1" + version: "1.2.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.1" checked_yaml: dependency: transitive description: @@ -211,7 +218,7 @@ packages: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.1" + version: "1.1.0" code_builder: dependency: transitive description: @@ -281,7 +288,7 @@ packages: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "1.5.0" + version: "1.2.0" cross_file: dependency: transitive description: @@ -435,7 +442,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.3.0" ffi: dependency: "direct main" description: @@ -864,21 +871,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.12" + version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" + version: "0.1.4" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.7.0" mime: dependency: transitive description: @@ -990,7 +997,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.8.1" path_drawing: dependency: transitive description: @@ -1366,7 +1373,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.9.0" + version: "1.8.2" stack_trace: dependency: transitive description: @@ -1410,7 +1417,7 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.1" + version: "1.1.0" string_validator: dependency: "direct main" description: @@ -1424,35 +1431,35 @@ packages: name: sync_http url: "https://pub.dartlang.org" source: hosted - version: "0.3.1" + version: "0.3.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.1" + version: "1.2.0" test: dependency: transitive description: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.21.4" + version: "1.21.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.12" + version: "0.4.9" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.4.16" + version: "0.4.13" time: dependency: transitive description: @@ -1501,7 +1508,7 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.3.0" universal_io: dependency: transitive description: @@ -1585,7 +1592,7 @@ packages: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "9.0.0" + version: "8.2.2" wakelock: dependency: "direct main" description: From a661e3acbc936c436ba143a7fb25125dcebaf399 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Wed, 4 Jan 2023 18:19:36 -0700 Subject: [PATCH 05/45] added oled-black-theme selector + prep oledBlack theme file --- assets/svg/oled-black-theme.svg | 28 ++ assets/svg/oledBlack/oled-black-theme.svg | 28 ++ lib/utilities/assets.dart | 1 + lib/utilities/theme/oled_black_colors.dart | 311 +++++++++++++++++++++ pubspec.yaml | 1 + 5 files changed, 369 insertions(+) create mode 100644 assets/svg/oled-black-theme.svg create mode 100644 assets/svg/oledBlack/oled-black-theme.svg create mode 100644 lib/utilities/theme/oled_black_colors.dart diff --git a/assets/svg/oled-black-theme.svg b/assets/svg/oled-black-theme.svg new file mode 100644 index 000000000..70a14e115 --- /dev/null +++ b/assets/svg/oled-black-theme.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/svg/oledBlack/oled-black-theme.svg b/assets/svg/oledBlack/oled-black-theme.svg new file mode 100644 index 000000000..70a14e115 --- /dev/null +++ b/assets/svg/oledBlack/oled-black-theme.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/utilities/assets.dart b/lib/utilities/assets.dart index b02c6584e..6c421ebec 100644 --- a/lib/utilities/assets.dart +++ b/lib/utilities/assets.dart @@ -70,6 +70,7 @@ class _SVG { String txExchangeFailed(BuildContext context) => "assets/svg/${Theme.of(context).extension()!.themeType.name}/tx-exchange-icon-failed.svg"; + String get themeOledBlack => "assets/svg/oled-black-theme.svg"; String get themeOcean => "assets/svg/ocean-breeze-theme.svg"; String get themeLight => "assets/svg/light-mode.svg"; String get themeDark => "assets/svg/dark-theme.svg"; diff --git a/lib/utilities/theme/oled_black_colors.dart b/lib/utilities/theme/oled_black_colors.dart new file mode 100644 index 000000000..d55581921 --- /dev/null +++ b/lib/utilities/theme/oled_black_colors.dart @@ -0,0 +1,311 @@ +import 'package:flutter/material.dart'; +import 'package:stackwallet/utilities/theme/color_theme.dart'; + +class DarkColors extends StackColorTheme { + @override + ThemeType get themeType => ThemeType.dark; + + @override + Color get background => const Color(0xFF2A2D34); + @override + Color get backgroundAppBar => background; + @override + Gradient? get gradientBackground => null; + + @override + Color get overlay => const Color(0xFF111215); + + @override + Color get accentColorBlue => const Color(0xFF4C86E9); + @override + Color get accentColorGreen => const Color(0xFF4CC0A0); + @override + Color get accentColorYellow => const Color(0xFFF7D65D); + @override + Color get accentColorRed => const Color(0xFFD34E50); + @override + Color get accentColorOrange => const Color(0xFFFEA68D); + @override + Color get accentColorDark => const Color(0xFFF3F3F3); + + @override + Color get shadow => const Color(0x0F2D3132); + + @override + Color get textDark => const Color(0xFFF3F3F3); + @override + Color get textDark2 => const Color(0xFFDBDBDB); + @override + Color get textDark3 => const Color(0xFFEEEFF1); + @override + Color get textSubtitle1 => const Color(0xFF9E9E9E); + @override + Color get textSubtitle2 => const Color(0xFF969696); + @override + Color get textSubtitle3 => const Color(0xFFA9ACAC); + @override + Color get textSubtitle4 => const Color(0xFF8E9192); + @override + Color get textSubtitle5 => const Color(0xFF747778); + @override + Color get textSubtitle6 => const Color(0xFF414141); + @override + Color get textWhite => const Color(0xFF232323); + @override + Color get textFavoriteCard => const Color(0xFF232323); + @override + Color get textError => const Color(0xFFF37475); + + // button background + @override + Color get buttonBackPrimary => const Color(0xFF4C86E9); + @override + Color get buttonBackSecondary => const Color(0xFF444E5C); + @override + Color get buttonBackPrimaryDisabled => const Color(0xFF38517C); + @override + Color get buttonBackSecondaryDisabled => const Color(0xFF3B3F46); + @override + Color get buttonBackBorder => const Color(0xFF4C86E9); + @override + Color get buttonBackBorderDisabled => const Color(0xFF314265); + + @override + Color get numberBackDefault => const Color(0xFF484B51); + @override + Color get numpadBackDefault => const Color(0xFF4C86E9); + @override + Color get bottomNavBack => const Color(0xFF3E4148); + + // button text/element + @override + Color get buttonTextPrimary => const Color(0xFFFFFFFF); + @override + Color get buttonTextSecondary => const Color(0xFFFFFFFF); + @override + Color get buttonTextPrimaryDisabled => const Color(0xFFFFFFFF); + @override + Color get buttonTextSecondaryDisabled => const Color(0xFF6A6C71); + @override + Color get buttonTextBorder => const Color(0xFF4C86E9); + @override + Color get buttonTextDisabled => const Color(0xFF314265); + @override + Color get buttonTextBorderless => const Color(0xFF4C86E9); + @override + Color get buttonTextBorderlessDisabled => const Color(0xFFB6B6B6); + @override + Color get numberTextDefault => const Color(0xFFFFFFFF); + @override + Color get numpadTextDefault => const Color(0xFFFFFFFF); + @override + Color get bottomNavText => const Color(0xFFFFFFFF); + + // switch + @override + Color get switchBGOn => const Color(0xFF4C86E9); + @override + Color get switchBGOff => const Color(0xFFC1D9FF); + @override + Color get switchBGDisabled => const Color(0xFFB5B7BA); + @override + Color get switchCircleOn => const Color(0xFFC9DDFF); + @override + Color get switchCircleOff => const Color(0xFFFFFFFF); + @override + Color get switchCircleDisabled => const Color(0xFFFFFFFF); + + // step indicator background + @override + Color get stepIndicatorBGCheck => const Color(0xFF4C86E9); + @override + Color get stepIndicatorBGNumber => const Color(0xFF4C86E9); + @override + Color get stepIndicatorBGInactive => const Color(0xFF3B3F46); + @override + Color get stepIndicatorBGLines => const Color(0xFF4C86E9); + @override + Color get stepIndicatorBGLinesInactive => const Color(0xFF3B3F46); + @override + Color get stepIndicatorIconText => const Color(0xFFFFFFFF); + @override + Color get stepIndicatorIconNumber => const Color(0xFFFFFFFF); + @override + Color get stepIndicatorIconInactive => const Color(0xFF747474); + + // checkbox + @override + Color get checkboxBGChecked => const Color(0xFF4C86E9); + @override + Color get checkboxBorderEmpty => const Color(0xFF8E9192); + @override + Color get checkboxBGDisabled => const Color(0xFFADC7EC); + @override + Color get checkboxIconChecked => const Color(0xFFFFFFFF); + @override + Color get checkboxIconDisabled => const Color(0xFFFFFFFF); + @override + Color get checkboxTextLabel => const Color(0xFFFFFFFF); + + // snack bar + @override + Color get snackBarBackSuccess => const Color(0xFF8EF5C3); + @override + Color get snackBarBackError => const Color(0xFFFFB4A9); + @override + Color get snackBarBackInfo => const Color(0xFFB4C4FF); + @override + Color get snackBarTextSuccess => const Color(0xFF003921); + @override + Color get snackBarTextError => const Color(0xFF690001); + @override + Color get snackBarTextInfo => const Color(0xFF00297A); + + // icons + @override + Color get bottomNavIconBack => const Color(0xFF7F8185); + @override + Color get bottomNavIconIcon => const Color(0xFFFFFFFF); + + @override + Color get topNavIconPrimary => const Color(0xFFFFFFFF); + @override + Color get topNavIconGreen => const Color(0xFF4CC0A0); + @override + Color get topNavIconYellow => const Color(0xFFF7D65D); + @override + Color get topNavIconRed => const Color(0xFFD34E50); + + @override + Color get settingsIconBack => const Color(0xFFE0E3E3); + @override + Color get settingsIconIcon => const Color(0xFF232323); + @override + Color get settingsIconBack2 => const Color(0xFF94D6C4); + @override + Color get settingsIconElement => const Color(0xFF00A578); + + // text field + @override + Color get textFieldActiveBG => const Color(0xFF4C5360); + @override + Color get textFieldDefaultBG => const Color(0xFF444953); + @override + Color get textFieldErrorBG => const Color(0xFFFFB4A9); + @override + Color get textFieldSuccessBG => const Color(0xFF8EF5C3); + + @override + Color get textFieldActiveSearchIconLeft => const Color(0xFFA9ACAC); + @override + Color get textFieldDefaultSearchIconLeft => const Color(0xFFA9ACAC); + @override + Color get textFieldErrorSearchIconLeft => const Color(0xFF690001); + @override + Color get textFieldSuccessSearchIconLeft => const Color(0xFF003921); + + @override + Color get textFieldActiveText => const Color(0xFFFFFFFF); + @override + Color get textFieldDefaultText => const Color(0xFFA9ACAC); + @override + Color get textFieldErrorText => const Color(0xFF000000); + @override + Color get textFieldSuccessText => const Color(0xFF000000); + + @override + Color get textFieldActiveLabel => const Color(0xFFA9ACAC); + @override + Color get textFieldErrorLabel => const Color(0xFF690001); + @override + Color get textFieldSuccessLabel => const Color(0xFF003921); + + @override + Color get textFieldActiveSearchIconRight => const Color(0xFFC4C7C7); + @override + Color get textFieldDefaultSearchIconRight => const Color(0xFF747778); + @override + Color get textFieldErrorSearchIconRight => const Color(0xFF690001); + @override + Color get textFieldSuccessSearchIconRight => const Color(0xFF003921); + + // settings item level2 + @override + Color get settingsItem2ActiveBG => const Color(0xFF484B51); + @override + Color get settingsItem2ActiveText => const Color(0xFFFFFFFF); + @override + Color get settingsItem2ActiveSub => const Color(0xFF9E9E9E); + + // radio buttons + @override + Color get radioButtonIconBorder => const Color(0xFF4C86E9); + @override + Color get radioButtonIconBorderDisabled => const Color(0xFF9E9E9E); + @override + Color get radioButtonBorderEnabled => const Color(0xFF4C86E9); + @override + Color get radioButtonBorderDisabled => const Color(0xFFCDCDCD); + @override + Color get radioButtonIconCircle => const Color(0xFF9E9E9E); + @override + Color get radioButtonIconEnabled => const Color(0xFF4C86E9); + @override + Color get radioButtonTextEnabled => const Color(0xFF44464E); + @override + Color get radioButtonTextDisabled => const Color(0xFF44464E); + @override + Color get radioButtonLabelEnabled => const Color(0xFF8E9192); + @override + Color get radioButtonLabelDisabled => const Color(0xFF8E9192); + + // info text + @override + Color get infoItemBG => const Color(0xFF333942); + @override + Color get infoItemLabel => const Color(0xFF9E9E9E); + @override + Color get infoItemText => const Color(0xFFFFFFFF); + @override + Color get infoItemIcons => const Color(0xFF4C86E9); + + // popup + @override + Color get popupBG => const Color(0xFF333942); + + // currency list + @override + Color get currencyListItemBG => const Color(0xFF484B51); + + // bottom nav + @override + Color get stackWalletBG => const Color(0xFF35383D); + @override + Color get stackWalletMid => const Color(0xFF292D34); + @override + Color get stackWalletBottom => const Color(0xFFFFFFFF); + @override + Color get bottomNavShadow => const Color(0xFF282E33); + + @override + Color get favoriteStarActive => accentColorYellow; + @override + Color get favoriteStarInactive => textSubtitle2; + + @override + Color get splash => const Color(0x358E9192); + @override + Color get highlight => const Color(0x44A9ACAC); + @override + Color get warningForeground => snackBarTextError; + @override + Color get warningBackground => const Color(0xFFFFB4A9); + @override + Color get loadingOverlayTextColor => const Color(0xFFF7F7F7); + @override + Color get myStackContactIconBG => const Color(0x88747778); + @override + Color get textConfirmTotalAmount => const Color(0xFF003921); + @override + Color get textSelectedWordTableItem => const Color(0xFF00297A); +} diff --git a/pubspec.yaml b/pubspec.yaml index 27f63c7c6..f7d7d62b1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -337,6 +337,7 @@ flutter: - assets/svg/dark-theme.svg - assets/svg/light-mode.svg - assets/svg/ocean-breeze-theme.svg + - assets/svg/oled-black-theme.svg # light theme specific - assets/svg/light/tx-exchange-icon.svg From a62d94a60d87523928469f73142313ddcde9baef Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 5 Jan 2023 10:49:55 -0600 Subject: [PATCH 06/45] handle 0 amounts --- lib/models/paymint/transactions_model.dart | 33 ++++------------------ 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/lib/models/paymint/transactions_model.dart b/lib/models/paymint/transactions_model.dart index 6eba877c4..0a1567105 100644 --- a/lib/models/paymint/transactions_model.dart +++ b/lib/models/paymint/transactions_model.dart @@ -362,12 +362,16 @@ class Input { class Output { // @HiveField(0) final String? scriptpubkey; + // @HiveField(1) final String? scriptpubkeyAsm; + // @HiveField(2) final String? scriptpubkeyType; + // @HiveField(3) final String scriptpubkeyAddress; + // @HiveField(4) final int value; @@ -381,9 +385,6 @@ class Output { factory Output.fromJson(Map json) { // TODO determine if any of this code is needed. try { - // Particl has different tx types that need to be detected and handled here - // if (json.containsKey('scriptPubKey') as bool) { - // output is transparent final address = json["scriptPubKey"]["addresses"] == null ? json['scriptPubKey']['type'] as String : json["scriptPubKey"]["addresses"][0] as String; @@ -392,35 +393,13 @@ class Output { scriptpubkeyAsm: json['scriptPubKey']['asm'] as String?, scriptpubkeyType: json['scriptPubKey']['type'] as String?, scriptpubkeyAddress: address, - value: (Decimal.parse(json["value"].toString()) * + value: (Decimal.parse( + (json["value"] != null ? json["value"] : 0).toString()) * Decimal.fromInt(Constants.satsPerCoin(Coin .firo))) // dirty hack but we need 8 decimal places here to keep consistent data structure .toBigInt() .toInt(), ); - // } /* else if (json.containsKey('ct_fee') as bool) { - // // or type: data - // // output is blinded (CT) - // } else if (json.containsKey('rangeproof') as bool) { - // // or valueCommitment or type: anon - // // output is private (RingCT) - // } */ - // else { - // // TODO detect staking - // // TODO handle CT, RingCT, and staking accordingly - // // print("transaction not supported: ${json}"); - // return Output( - // // Return output object with null values; allows wallet history to be built - // scriptpubkey: "", - // scriptpubkeyAsm: "", - // scriptpubkeyType: "", - // scriptpubkeyAddress: "", - // value: (Decimal.parse(0.toString()) * - // Decimal.fromInt(Constants.satsPerCoin(Coin - // .firo))) // dirty hack but we need 8 decimal places here to keep consistent data structure - // .toBigInt() - // .toInt()); - // } } catch (s, e) { return Output( // Return output object with null values; allows wallet history to be built From a902c7705780ea622ce2d90ad4906bf8be786024 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 5 Jan 2023 10:50:36 -0600 Subject: [PATCH 07/45] add getAddress helper func for transactions with odd outputs OP_RETURN and some other output types can cause addresses to be placed in a list of strings or as a string under a different key; this handles that case --- lib/services/coins/coin_service.dart | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/services/coins/coin_service.dart b/lib/services/coins/coin_service.dart index a690157ee..90a25a057 100644 --- a/lib/services/coins/coin_service.dart +++ b/lib/services/coins/coin_service.dart @@ -307,4 +307,24 @@ abstract class CoinServiceAPI { // used for electrumx coins Future updateSentCachedTxData(Map txData); + + // Certain outputs return address as an array/list of strings like List ["addresses"][0], some return it as a string like String ["address"] + String? getAddress(dynamic output) { + String? address; + if (output.containsKey('scriptPubKey') as bool) { + // Make sure the key exists before using it + if (output["scriptPubKey"].containsKey('address') as bool) { + address = output["scriptPubKey"]["address"] as String?; + } else if (output["scriptPubKey"].containsKey('addresses') as bool) { + address = output["scriptPubKey"]["addresses"][0] as String?; + // TODO determine cases in which there are multiple addresses in the array + } + } /*else { + // TODO detect cases in which no scriptPubKey exists + Logging.instance.log("output type not detected; output: ${output}", + level: LogLevel.Info); + }*/ + + return address; + } } From 4d107273604e38cdd9f193cdf8dacf4162f0ed44 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 5 Jan 2023 10:50:45 -0600 Subject: [PATCH 08/45] use getAddress with BCH --- .../coins/bitcoincash/bitcoincash_wallet.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart index b18a97186..c6dc8ca03 100644 --- a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart +++ b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart @@ -1174,7 +1174,8 @@ class BitcoinCashWallet extends CoinServiceAPI { final priceData = await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency); Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero; - final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; + final locale = + Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; final String worthNow = Format.localizedStringAsFixed( value: ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) / @@ -2300,7 +2301,7 @@ class BitcoinCashWallet extends CoinServiceAPI { for (final out in tx["vout"] as List) { if (prevOut == out["n"]) { - final address = out["scriptPubKey"]["addresses"][0] as String?; + final address = getAddress(out); if (address != null) { sendersArray.add(address); } @@ -2311,7 +2312,7 @@ class BitcoinCashWallet extends CoinServiceAPI { Logging.instance.log("sendersArray: $sendersArray", level: LogLevel.Info); for (final output in txObject["vout"] as List) { - final address = output["scriptPubKey"]["addresses"][0] as String?; + final address = getAddress(output); if (address != null) { recipientsArray.add(address); } @@ -2352,7 +2353,7 @@ class BitcoinCashWallet extends CoinServiceAPI { int totalOutput = 0; for (final output in txObject["vout"] as List) { - final address = output["scriptPubKey"]["addresses"][0]; + final address = getAddress(output); final value = output["value"]; final _value = (Decimal.parse(value.toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) @@ -2377,7 +2378,7 @@ class BitcoinCashWallet extends CoinServiceAPI { // add up received tx value for (final output in txObject["vout"] as List) { - final address = output["scriptPubKey"]["addresses"][0]; + final address = getAddress(output); if (address != null) { final value = (Decimal.parse(output["value"].toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) @@ -2902,7 +2903,7 @@ class BitcoinCashWallet extends CoinServiceAPI { for (final output in tx["vout"] as List) { final n = output["n"]; if (n != null && n == utxosToUse[i].vout) { - String address = output["scriptPubKey"]["addresses"][0] as String; + String address = getAddress(output) as String; if (bitbox.Address.detectFormat(address) == bitbox.Address.formatCashAddr) { if (validateCashAddr(address)) { From fb7c58f60a0e8935e9fe3d80012ebfced7be5ebd Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 5 Jan 2023 12:12:38 -0600 Subject: [PATCH 09/45] handle 0 amounts use null operator where applicable --- lib/models/paymint/transactions_model.dart | 2 +- lib/services/coins/bitcoincash/bitcoincash_wallet.dart | 2 +- lib/services/coins/firo/firo_wallet.dart | 4 ++-- lib/services/coins/litecoin/litecoin_wallet.dart | 5 ++--- lib/services/coins/namecoin/namecoin_wallet.dart | 4 ++-- lib/services/coins/particl/particl_wallet.dart | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/models/paymint/transactions_model.dart b/lib/models/paymint/transactions_model.dart index 0a1567105..1d40ac01c 100644 --- a/lib/models/paymint/transactions_model.dart +++ b/lib/models/paymint/transactions_model.dart @@ -394,7 +394,7 @@ class Output { scriptpubkeyType: json['scriptPubKey']['type'] as String?, scriptpubkeyAddress: address, value: (Decimal.parse( - (json["value"] != null ? json["value"] : 0).toString()) * + (json["value"] ?? 0).toString()) * Decimal.fromInt(Constants.satsPerCoin(Coin .firo))) // dirty hack but we need 8 decimal places here to keep consistent data structure .toBigInt() diff --git a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart index c6dc8ca03..ebd2e2df8 100644 --- a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart +++ b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart @@ -2380,7 +2380,7 @@ class BitcoinCashWallet extends CoinServiceAPI { for (final output in txObject["vout"] as List) { final address = getAddress(output); if (address != null) { - final value = (Decimal.parse(output["value"].toString()) * + final value = (Decimal.parse((output["value"] ?? 0).toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) .toBigInt() .toInt(); diff --git a/lib/services/coins/firo/firo_wallet.dart b/lib/services/coins/firo/firo_wallet.dart index 5d29bd0a9..58ac019b0 100644 --- a/lib/services/coins/firo/firo_wallet.dart +++ b/lib/services/coins/firo/firo_wallet.dart @@ -3320,7 +3320,7 @@ class FiroWallet extends CoinServiceAPI { for (final output in txObject["vout"] as List) { final addresses = output["scriptPubKey"]["addresses"] as List?; - final value = output["value"]; + final value = output["value"] ?? 0; if (addresses != null && addresses.isNotEmpty) { final address = addresses[0] as String; if (value != null) { @@ -3359,7 +3359,7 @@ class FiroWallet extends CoinServiceAPI { final addresses = output["scriptPubKey"]["addresses"] as List?; if (addresses != null && addresses.isNotEmpty) { final address = addresses[0] as String; - final value = output["value"]; + final value = output["value"] ?? 0; // Logging.instance.log(address + value.toString()); if (allAddresses.contains(address)) { diff --git a/lib/services/coins/litecoin/litecoin_wallet.dart b/lib/services/coins/litecoin/litecoin_wallet.dart index 269f59610..f027ab2db 100644 --- a/lib/services/coins/litecoin/litecoin_wallet.dart +++ b/lib/services/coins/litecoin/litecoin_wallet.dart @@ -2565,8 +2565,7 @@ class LitecoinWallet extends CoinServiceAPI { for (final output in txObject["vout"] as List) { final String address = - output["scriptPubKey"]!["addresses"][0] as String; - final value = output["value"]!; + final value = output["value"] ?? 0; final _value = (Decimal.parse(value.toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) .toBigInt() @@ -2592,7 +2591,7 @@ class LitecoinWallet extends CoinServiceAPI { for (final output in txObject["vout"] as List) { final address = output["scriptPubKey"]["addresses"][0]; if (address != null) { - final value = (Decimal.parse(output["value"].toString()) * + final value = (Decimal.parse((output["value"] ?? 0).toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) .toBigInt() .toInt(); diff --git a/lib/services/coins/namecoin/namecoin_wallet.dart b/lib/services/coins/namecoin/namecoin_wallet.dart index 85fea61ad..f20bfa36f 100644 --- a/lib/services/coins/namecoin/namecoin_wallet.dart +++ b/lib/services/coins/namecoin/namecoin_wallet.dart @@ -2554,7 +2554,7 @@ class NamecoinWallet extends CoinServiceAPI { for (final output in txObject["vout"] as List) { Logging.instance.log(output, level: LogLevel.Info); final address = output["scriptPubKey"]["address"]; - final value = output["value"]; + final value = output["value"] ?? 0; final _value = (Decimal.parse(value.toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) .toBigInt() @@ -2583,7 +2583,7 @@ class NamecoinWallet extends CoinServiceAPI { address = output["scriptPubKey"]["address"] as String?; } if (address != null) { - final value = (Decimal.parse(output["value"].toString()) * + final value = (Decimal.parse((output["value"] ?? 0).toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) .toBigInt() .toInt(); diff --git a/lib/services/coins/particl/particl_wallet.dart b/lib/services/coins/particl/particl_wallet.dart index fe535dbf0..897f5951f 100644 --- a/lib/services/coins/particl/particl_wallet.dart +++ b/lib/services/coins/particl/particl_wallet.dart @@ -2361,7 +2361,7 @@ class ParticlWallet extends CoinServiceAPI { try { final String address = output["scriptPubKey"]!["addresses"][0] as String; - final value = output["value"]!; + final value = output["value"] ?? 0; final _value = (Decimal.parse(value.toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) .toBigInt() @@ -2419,7 +2419,7 @@ class ParticlWallet extends CoinServiceAPI { try { final address = output["scriptPubKey"]["addresses"][0]; if (address != null) { - final value = (Decimal.parse(output["value"].toString()) * + final value = (Decimal.parse((output["value"] ?? 0).toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) .toBigInt() .toInt(); From 2dbd81fd4c19804dcae1cdc1c9efdcb9eca12732 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 5 Jan 2023 12:13:26 -0600 Subject: [PATCH 10/45] use getAddress with BTC, LTC, NMC, and PART --- .../coins/bitcoin/bitcoin_wallet.dart | 13 ++++++----- .../coins/dogecoin/dogecoin_wallet.dart | 13 ++++++----- .../coins/litecoin/litecoin_wallet.dart | 13 ++++++----- .../coins/namecoin/namecoin_wallet.dart | 23 ++++++------------- .../coins/particl/particl_wallet.dart | 9 ++++---- 5 files changed, 33 insertions(+), 38 deletions(-) diff --git a/lib/services/coins/bitcoin/bitcoin_wallet.dart b/lib/services/coins/bitcoin/bitcoin_wallet.dart index 1ed87681b..bfacb6b2a 100644 --- a/lib/services/coins/bitcoin/bitcoin_wallet.dart +++ b/lib/services/coins/bitcoin/bitcoin_wallet.dart @@ -1297,7 +1297,8 @@ class BitcoinWallet extends CoinServiceAPI { final priceData = await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency); Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero; - final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; + final locale = + Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; final String worthNow = Format.localizedStringAsFixed( value: ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) / @@ -2502,7 +2503,7 @@ class BitcoinWallet extends CoinServiceAPI { for (final out in tx["vout"] as List) { if (prevOut == out["n"]) { - final address = out["scriptPubKey"]["address"] as String?; + final address = getAddress(out) as String?; if (address != null) { sendersArray.add(address); } @@ -2513,7 +2514,7 @@ class BitcoinWallet extends CoinServiceAPI { Logging.instance.log("sendersArray: $sendersArray", level: LogLevel.Info); for (final output in txObject["vout"] as List) { - final address = output["scriptPubKey"]["address"] as String?; + final address = getAddress(output); if (address != null) { recipientsArray.add(address); } @@ -2553,7 +2554,7 @@ class BitcoinWallet extends CoinServiceAPI { int totalOutput = 0; for (final output in txObject["vout"] as List) { - final String address = output["scriptPubKey"]!["address"] as String; + final String address = getAddress(output) as String; final value = output["value"]!; final _value = (Decimal.parse(value.toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) @@ -2578,7 +2579,7 @@ class BitcoinWallet extends CoinServiceAPI { // add up received tx value for (final output in txObject["vout"] as List) { - final address = output["scriptPubKey"]["address"]; + final address = getAddress(output); if (address != null) { final value = (Decimal.parse(output["value"].toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) @@ -3095,7 +3096,7 @@ class BitcoinWallet extends CoinServiceAPI { for (final output in tx["vout"] as List) { final n = output["n"]; if (n != null && n == utxosToUse[i].vout) { - final address = output["scriptPubKey"]["address"] as String; + final address = getAddress(output) as String; if (!addressTxid.containsKey(address)) { addressTxid[address] = []; } diff --git a/lib/services/coins/dogecoin/dogecoin_wallet.dart b/lib/services/coins/dogecoin/dogecoin_wallet.dart index 5b0da3fb3..f8a9809d1 100644 --- a/lib/services/coins/dogecoin/dogecoin_wallet.dart +++ b/lib/services/coins/dogecoin/dogecoin_wallet.dart @@ -1064,7 +1064,8 @@ class DogecoinWallet extends CoinServiceAPI { final priceData = await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency); Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero; - final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; + final locale = + Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; final String worthNow = Format.localizedStringAsFixed( value: ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) / @@ -2113,7 +2114,7 @@ class DogecoinWallet extends CoinServiceAPI { for (final out in tx["vout"] as List) { if (prevOut == out["n"]) { - final address = out["scriptPubKey"]["addresses"][0] as String?; + final address = getAddress(out); if (address != null) { sendersArray.add(address); } @@ -2124,7 +2125,7 @@ class DogecoinWallet extends CoinServiceAPI { Logging.instance.log("sendersArray: $sendersArray", level: LogLevel.Info); for (final output in txObject["vout"] as List) { - final address = output["scriptPubKey"]["addresses"][0] as String?; + final address = getAddress(output); if (address != null) { recipientsArray.add(address); } @@ -2164,7 +2165,7 @@ class DogecoinWallet extends CoinServiceAPI { int totalOutput = 0; for (final output in txObject["vout"] as List) { - final address = output["scriptPubKey"]["addresses"][0]; + final address = getAddress(output); final value = output["value"]; final _value = (Decimal.parse(value.toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) @@ -2189,7 +2190,7 @@ class DogecoinWallet extends CoinServiceAPI { // add up received tx value for (final output in txObject["vout"] as List) { - final address = output["scriptPubKey"]["addresses"][0]; + final address = getAddress(output); if (address != null) { final value = (Decimal.parse(output["value"].toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) @@ -2712,7 +2713,7 @@ class DogecoinWallet extends CoinServiceAPI { for (final output in tx["vout"] as List) { final n = output["n"]; if (n != null && n == utxosToUse[i].vout) { - final address = output["scriptPubKey"]["addresses"][0] as String; + final address = getAddress(output) as String; if (!addressTxid.containsKey(address)) { addressTxid[address] = []; } diff --git a/lib/services/coins/litecoin/litecoin_wallet.dart b/lib/services/coins/litecoin/litecoin_wallet.dart index f027ab2db..6379ced7c 100644 --- a/lib/services/coins/litecoin/litecoin_wallet.dart +++ b/lib/services/coins/litecoin/litecoin_wallet.dart @@ -1299,7 +1299,8 @@ class LitecoinWallet extends CoinServiceAPI { final priceData = await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency); Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero; - final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; + final locale = + Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; final String worthNow = Format.localizedStringAsFixed( value: ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) / @@ -2513,7 +2514,7 @@ class LitecoinWallet extends CoinServiceAPI { for (final out in tx["vout"] as List) { if (prevOut == out["n"]) { - final address = out["scriptPubKey"]["addresses"][0] as String?; + final address = getAddress(out) as String?; if (address != null) { sendersArray.add(address); } @@ -2524,7 +2525,7 @@ class LitecoinWallet extends CoinServiceAPI { Logging.instance.log("sendersArray: $sendersArray", level: LogLevel.Info); for (final output in txObject["vout"] as List) { - final address = output["scriptPubKey"]["addresses"][0] as String?; + final address = getAddress(output); if (address != null) { recipientsArray.add(address); } @@ -2564,7 +2565,7 @@ class LitecoinWallet extends CoinServiceAPI { int totalOutput = 0; for (final output in txObject["vout"] as List) { - final String address = + final String address = getAddress(output) as String; final value = output["value"] ?? 0; final _value = (Decimal.parse(value.toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) @@ -2589,7 +2590,7 @@ class LitecoinWallet extends CoinServiceAPI { // add up received tx value for (final output in txObject["vout"] as List) { - final address = output["scriptPubKey"]["addresses"][0]; + final address = getAddress(output); if (address != null) { final value = (Decimal.parse((output["value"] ?? 0).toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) @@ -3106,7 +3107,7 @@ class LitecoinWallet extends CoinServiceAPI { for (final output in tx["vout"] as List) { final n = output["n"]; if (n != null && n == utxosToUse[i].vout) { - final address = output["scriptPubKey"]["addresses"][0] as String; + final address = getAddress(output) as String; if (!addressTxid.containsKey(address)) { addressTxid[address] = []; } diff --git a/lib/services/coins/namecoin/namecoin_wallet.dart b/lib/services/coins/namecoin/namecoin_wallet.dart index f20bfa36f..eb0655b4f 100644 --- a/lib/services/coins/namecoin/namecoin_wallet.dart +++ b/lib/services/coins/namecoin/namecoin_wallet.dart @@ -1287,7 +1287,8 @@ class NamecoinWallet extends CoinServiceAPI { final priceData = await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency); Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero; - final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; + final locale = + Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; final String worthNow = Format.localizedStringAsFixed( value: ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) / @@ -2494,11 +2495,7 @@ class NamecoinWallet extends CoinServiceAPI { for (final out in tx["vout"] as List) { if (prevOut == out["n"]) { - String? address = out["scriptPubKey"]["address"] as String?; - if (address == null && out["scriptPubKey"]["address"] != null) { - address = out["scriptPubKey"]["address"] as String?; - } - + String? address = getAddress(out); if (address != null) { sendersArray.add(address); } @@ -2509,10 +2506,7 @@ class NamecoinWallet extends CoinServiceAPI { Logging.instance.log("sendersArray: $sendersArray", level: LogLevel.Info); for (final output in txObject["vout"] as List) { - String? address = output["scriptPubKey"]["address"] as String?; - if (address == null && output["scriptPubKey"]["address"] != null) { - address = output["scriptPubKey"]["address"] as String?; - } + String? address = getAddress(output); if (address != null) { recipientsArray.add(address); } @@ -2553,7 +2547,7 @@ class NamecoinWallet extends CoinServiceAPI { for (final output in txObject["vout"] as List) { Logging.instance.log(output, level: LogLevel.Info); - final address = output["scriptPubKey"]["address"]; + final address = getAddress(output); final value = output["value"] ?? 0; final _value = (Decimal.parse(value.toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) @@ -2578,10 +2572,7 @@ class NamecoinWallet extends CoinServiceAPI { // add up received tx value for (final output in txObject["vout"] as List) { - String? address = output["scriptPubKey"]["address"] as String?; - if (address == null && output["scriptPubKey"]["address"] != null) { - address = output["scriptPubKey"]["address"] as String?; - } + String? address = getAddress(output); if (address != null) { final value = (Decimal.parse((output["value"] ?? 0).toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) @@ -3101,7 +3092,7 @@ class NamecoinWallet extends CoinServiceAPI { for (final output in tx["vout"] as List) { final n = output["n"]; if (n != null && n == utxosToUse[i].vout) { - final address = output["scriptPubKey"]["address"] as String; + final address = getAddress(output) as String; if (!addressTxid.containsKey(address)) { addressTxid[address] = []; } diff --git a/lib/services/coins/particl/particl_wallet.dart b/lib/services/coins/particl/particl_wallet.dart index 897f5951f..ff04d0fc4 100644 --- a/lib/services/coins/particl/particl_wallet.dart +++ b/lib/services/coins/particl/particl_wallet.dart @@ -1200,7 +1200,8 @@ class ParticlWallet extends CoinServiceAPI { final priceData = await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency); Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero; - final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; + final locale = + Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; final String worthNow = Format.localizedStringAsFixed( value: ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) / @@ -2288,7 +2289,7 @@ class ParticlWallet extends CoinServiceAPI { for (final out in tx["vout"] as List) { if (prevOut == out["n"]) { - final address = out["scriptPubKey"]["addresses"][0] as String?; + final address = getAddress(out); if (address != null) { sendersArray.add(address); } @@ -2302,7 +2303,7 @@ class ParticlWallet extends CoinServiceAPI { // Particl has different tx types that need to be detected and handled here if (output.containsKey('scriptPubKey') as bool) { // Logging.instance.log("output is transparent", level: LogLevel.Info); - final address = output["scriptPubKey"]["addresses"][0] as String?; + final address = getAddress(output); if (address != null) { recipientsArray.add(address); } @@ -2417,7 +2418,7 @@ class ParticlWallet extends CoinServiceAPI { // add up received tx value for (final output in txObject["vout"] as List) { try { - final address = output["scriptPubKey"]["addresses"][0]; + final address = getAddress(output); if (address != null) { final value = (Decimal.parse((output["value"] ?? 0).toString()) * Decimal.fromInt(Constants.satsPerCoin(coin))) From 2495673f793bce0a9f74de0be42df7a19491cc4d Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 5 Jan 2023 12:13:54 -0600 Subject: [PATCH 11/45] add getAddresses helper func for Firo don't assume keys exist without checking them --- lib/services/coins/coin_service.dart | 18 ++++++++++++++++ lib/services/coins/firo/firo_wallet.dart | 26 ++++++++++++++---------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/lib/services/coins/coin_service.dart b/lib/services/coins/coin_service.dart index 90a25a057..7a43c71da 100644 --- a/lib/services/coins/coin_service.dart +++ b/lib/services/coins/coin_service.dart @@ -327,4 +327,22 @@ abstract class CoinServiceAPI { return address; } + + // Firo wants an array/list of address strings like List + List? getAddresses(dynamic output) { + List? addresses; + if (output.containsKey('scriptPubKey') as bool) { + if (output["scriptPubKey"].containsKey('addresses') as bool) { + addresses = output["scriptPubKey"]["addresses"] as List?; + } else if (output["scriptPubKey"].containsKey('address') as bool) { + addresses = [output["scriptPubKey"]["address"]]; + } + } /*else { + // TODO detect cases in which no scriptPubKey exists + Logging.instance.log("output type not detected; output: ${output}", + level: LogLevel.Info); + }*/ + + return addresses; + } } diff --git a/lib/services/coins/firo/firo_wallet.dart b/lib/services/coins/firo/firo_wallet.dart index 58ac019b0..89d912fe1 100644 --- a/lib/services/coins/firo/firo_wallet.dart +++ b/lib/services/coins/firo/firo_wallet.dart @@ -883,7 +883,8 @@ class FiroWallet extends CoinServiceAPI { @override Future updateSentCachedTxData(Map txData) async { final currentPrice = await firoPrice; - final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; + final locale = + Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; final String worthNow = Format.localizedStringAsFixed( value: ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) / @@ -1691,7 +1692,7 @@ class FiroWallet extends CoinServiceAPI { for (final output in tx["vout"] as List) { final n = output["n"]; if (n != null && n == utxosToUse[i].vout) { - final address = output["scriptPubKey"]["addresses"][0] as String; + final address = getAddress(output) as String; if (!addressTxid.containsKey(address)) { addressTxid[address] = []; @@ -2654,8 +2655,7 @@ class FiroWallet extends CoinServiceAPI { final vouts = tx["vout"] as List?; if (vouts != null && outputIndex < vouts.length) { - final address = - vouts[outputIndex]["scriptPubKey"]["addresses"][0] as String?; + final address = getAddress(vouts[outputIndex]); if (address != null) { addressesToDerive.add(address); } @@ -2756,7 +2756,8 @@ class FiroWallet extends CoinServiceAPI { var price = await firoPrice; var builtHex = txb.build(); // return builtHex; - final locale =Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; + final locale = + Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; return { "transaction": builtHex, "txid": txId, @@ -2810,7 +2811,8 @@ class FiroWallet extends CoinServiceAPI { final currentPrice = await firoPrice; // Grab the most recent information on all the joinsplits - final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; + final locale = + Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; final updatedJSplit = await getJMintTransactions(cachedElectrumXClient, joinsplits, _prefs.currency, coin, currentPrice, locale!); @@ -3249,7 +3251,8 @@ class FiroWallet extends CoinServiceAPI { final currentPrice = await firoPrice; final List> midSortedArray = []; - final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; + final locale = + Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; Logging.instance.log("refresh the txs", level: LogLevel.Info); for (final txObject in allTransactions) { @@ -3275,7 +3278,7 @@ class FiroWallet extends CoinServiceAPI { // Logging.instance.log("sendersArray: $sendersArray"); for (final output in txObject["vout"] as List) { - final addresses = output["scriptPubKey"]["addresses"] as List?; + final addresses = getAddresses(output); if (addresses != null && addresses.isNotEmpty) { recipientsArray.add(addresses[0] as String); } @@ -3319,7 +3322,7 @@ class FiroWallet extends CoinServiceAPI { } for (final output in txObject["vout"] as List) { - final addresses = output["scriptPubKey"]["addresses"] as List?; + final addresses = getAddresses(output); final value = output["value"] ?? 0; if (addresses != null && addresses.isNotEmpty) { final address = addresses[0] as String; @@ -4375,7 +4378,8 @@ class FiroWallet extends CoinServiceAPI { final lelantusEntry = await _getLelantusEntry(); final anonymitySets = await fetchAnonymitySets(); final locktime = await getBlockHead(electrumXClient); - final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; + final locale = + Platform.isWindows ? "en_US" : await Devicelocale.currentLocale; ReceivePort receivePort = await getIsolate({ "function": "createJoinSplit", @@ -4742,7 +4746,7 @@ class FiroWallet extends CoinServiceAPI { } tx["amount"] = tx["vout"][sendIndex]["value"]; - tx["address"] = tx["vout"][sendIndex]["scriptPubKey"]["addresses"][0]; + tx["address"] = getAddress(tx["vout"][sendIndex]) as String; tx["fees"] = tx["vin"][0]["nFees"]; tx["inputSize"] = tx["vin"].length; From cd7dd206521ce90f8e0cca2bce86cf64331af33e Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Thu, 5 Jan 2023 11:34:29 -0700 Subject: [PATCH 12/45] oled_black hex added --- lib/utilities/theme/oled_black_colors.dart | 233 +++++++++++---------- 1 file changed, 117 insertions(+), 116 deletions(-) diff --git a/lib/utilities/theme/oled_black_colors.dart b/lib/utilities/theme/oled_black_colors.dart index d55581921..b29dde318 100644 --- a/lib/utilities/theme/oled_black_colors.dart +++ b/lib/utilities/theme/oled_black_colors.dart @@ -6,276 +6,277 @@ class DarkColors extends StackColorTheme { ThemeType get themeType => ThemeType.dark; @override - Color get background => const Color(0xFF2A2D34); + Color get background => const Color(0xFF000000); @override Color get backgroundAppBar => background; @override Gradient? get gradientBackground => null; @override - Color get overlay => const Color(0xFF111215); + Color get overlay => const Color(0xFF121212); @override - Color get accentColorBlue => const Color(0xFF4C86E9); + Color get accentColorBlue => const Color(0xFF77A7F9); @override Color get accentColorGreen => const Color(0xFF4CC0A0); @override - Color get accentColorYellow => const Color(0xFFF7D65D); + Color get accentColorYellow => const Color(0xFFD4A51E); @override Color get accentColorRed => const Color(0xFFD34E50); @override - Color get accentColorOrange => const Color(0xFFFEA68D); + Color get accentColorOrange => const Color(0xFFDE7456); + //accent color white (0xFFDEDEDE) @override - Color get accentColorDark => const Color(0xFFF3F3F3); + Color get accentColorDark => const Color(0xFFDEDEDE); @override - Color get shadow => const Color(0x0F2D3132); + Color get shadow => const Color(0x0F2D3132); //not done yet @override - Color get textDark => const Color(0xFFF3F3F3); + Color get textDark => const Color(0xFF2D3132); @override - Color get textDark2 => const Color(0xFFDBDBDB); + Color get textDark2 => const Color(0xFFDEDEDE); @override - Color get textDark3 => const Color(0xFFEEEFF1); + Color get textDark3 => const Color(0xFFCCCCCC); @override - Color get textSubtitle1 => const Color(0xFF9E9E9E); + Color get textSubtitle1 => const Color(0xFFB2B2B2); @override - Color get textSubtitle2 => const Color(0xFF969696); + Color get textSubtitle2 => const Color(0xFFB2B2B2); @override - Color get textSubtitle3 => const Color(0xFFA9ACAC); + Color get textSubtitle3 => const Color(0xFFA0A0A0); @override - Color get textSubtitle4 => const Color(0xFF8E9192); + Color get textSubtitle4 => const Color(0xFF878A8A); @override - Color get textSubtitle5 => const Color(0xFF747778); + Color get textSubtitle5 => const Color(0xFF878A8A); @override - Color get textSubtitle6 => const Color(0xFF414141); + Color get textSubtitle6 => const Color(0xFF878A8A); @override - Color get textWhite => const Color(0xFF232323); + Color get textWhite => const Color(0xFFDEDEDE); @override - Color get textFavoriteCard => const Color(0xFF232323); + Color get textFavoriteCard => const Color(0xFFDEDEDE); @override - Color get textError => const Color(0xFFF37475); + Color get textError => const Color(0xFFCF6679); // button background @override - Color get buttonBackPrimary => const Color(0xFF4C86E9); + Color get buttonBackPrimary => const Color(0xFF6F9CE9); @override - Color get buttonBackSecondary => const Color(0xFF444E5C); + Color get buttonBackSecondary => const Color(0xFF1F1F1F); @override - Color get buttonBackPrimaryDisabled => const Color(0xFF38517C); + Color get buttonBackPrimaryDisabled => const Color(0xFF212F46); @override - Color get buttonBackSecondaryDisabled => const Color(0xFF3B3F46); + Color get buttonBackSecondaryDisabled => const Color(0xFF3D3D3D); @override - Color get buttonBackBorder => const Color(0xFF4C86E9); + Color get buttonBackBorder => const Color(0xFF6F9CE9); @override - Color get buttonBackBorderDisabled => const Color(0xFF314265); + Color get buttonBackBorderDisabled => const Color(0xFF212F46); @override - Color get numberBackDefault => const Color(0xFF484B51); + Color get numberBackDefault => const Color(0xFF242424); @override - Color get numpadBackDefault => const Color(0xFF4C86E9); + Color get numpadBackDefault => const Color(0xFF6F9CE9); @override - Color get bottomNavBack => const Color(0xFF3E4148); + Color get bottomNavBack => const Color(0xFFDEDEDE); // button text/element @override - Color get buttonTextPrimary => const Color(0xFFFFFFFF); + Color get buttonTextPrimary => const Color(0xFF000000); @override - Color get buttonTextSecondary => const Color(0xFFFFFFFF); + Color get buttonTextSecondary => const Color(0xFFDEDEDE); @override - Color get buttonTextPrimaryDisabled => const Color(0xFFFFFFFF); + Color get buttonTextPrimaryDisabled => const Color(0xFF000000); @override - Color get buttonTextSecondaryDisabled => const Color(0xFF6A6C71); + Color get buttonTextSecondaryDisabled => const Color(0xFF090909); @override - Color get buttonTextBorder => const Color(0xFF4C86E9); + Color get buttonTextBorder => const Color(0xFF6F9CE9); @override - Color get buttonTextDisabled => const Color(0xFF314265); + Color get buttonTextDisabled => const Color(0xFF000000); @override - Color get buttonTextBorderless => const Color(0xFF4C86E9); + Color get buttonTextBorderless => const Color(0xFF6F9CE9); @override - Color get buttonTextBorderlessDisabled => const Color(0xFFB6B6B6); + Color get buttonTextBorderlessDisabled => const Color(0xFF212F46); @override - Color get numberTextDefault => const Color(0xFFFFFFFF); + Color get numberTextDefault => const Color(0xFFD3D3D3); @override - Color get numpadTextDefault => const Color(0xFFFFFFFF); + Color get numpadTextDefault => const Color(0xFF000000); @override - Color get bottomNavText => const Color(0xFFFFFFFF); + Color get bottomNavText => const Color(0xFFDEDEDE); // switch @override - Color get switchBGOn => const Color(0xFF4C86E9); + Color get switchBGOn => const Color(0xFF77A7F9); @override - Color get switchBGOff => const Color(0xFFC1D9FF); + Color get switchBGOff => const Color(0xFF445C85); @override - Color get switchBGDisabled => const Color(0xFFB5B7BA); + Color get switchBGDisabled => const Color(0xFF333538); @override - Color get switchCircleOn => const Color(0xFFC9DDFF); + Color get switchCircleOn => const Color(0xFFC9DDF5); @override - Color get switchCircleOff => const Color(0xFFFFFFFF); + Color get switchCircleOff => const Color(0xFF94AAC9); @override - Color get switchCircleDisabled => const Color(0xFFFFFFFF); + Color get switchCircleDisabled => const Color(0xFF848484); // step indicator background @override - Color get stepIndicatorBGCheck => const Color(0xFF4C86E9); + Color get stepIndicatorBGCheck => const Color(0xFF77A7F9); @override - Color get stepIndicatorBGNumber => const Color(0xFF4C86E9); + Color get stepIndicatorBGNumber => const Color(0xFF77A7F9); @override Color get stepIndicatorBGInactive => const Color(0xFF3B3F46); @override - Color get stepIndicatorBGLines => const Color(0xFF4C86E9); + Color get stepIndicatorBGLines => const Color(0xFF6393E5); @override - Color get stepIndicatorBGLinesInactive => const Color(0xFF3B3F46); + Color get stepIndicatorBGLinesInactive => const Color(0xFF63676E); @override - Color get stepIndicatorIconText => const Color(0xFFFFFFFF); + Color get stepIndicatorIconText => const Color(0xFF000000); @override - Color get stepIndicatorIconNumber => const Color(0xFFFFFFFF); + Color get stepIndicatorIconNumber => const Color(0xFF000000); @override - Color get stepIndicatorIconInactive => const Color(0xFF747474); + Color get stepIndicatorIconInactive => const Color(0xFFA5A5A5); // checkbox @override - Color get checkboxBGChecked => const Color(0xFF4C86E9); + Color get checkboxBGChecked => const Color(0xFF77A7F9); @override - Color get checkboxBorderEmpty => const Color(0xFF8E9192); + Color get checkboxBorderEmpty => const Color(0xFF353536); @override - Color get checkboxBGDisabled => const Color(0xFFADC7EC); + Color get checkboxBGDisabled => const Color(0xFF5D759B); @override - Color get checkboxIconChecked => const Color(0xFFFFFFFF); + Color get checkboxIconChecked => const Color(0xFF000000); @override - Color get checkboxIconDisabled => const Color(0xFFFFFFFF); + Color get checkboxIconDisabled => const Color(0xFF000000); @override - Color get checkboxTextLabel => const Color(0xFFFFFFFF); + Color get checkboxTextLabel => const Color(0xFFDEDEDE); // snack bar @override - Color get snackBarBackSuccess => const Color(0xFF8EF5C3); + Color get snackBarBackSuccess => const Color(0xFF1F1F1F); @override - Color get snackBarBackError => const Color(0xFFFFB4A9); + Color get snackBarBackError => const Color(0xFF1F1F1F); @override - Color get snackBarBackInfo => const Color(0xFFB4C4FF); + Color get snackBarBackInfo => const Color(0xFF1F1F1F); @override - Color get snackBarTextSuccess => const Color(0xFF003921); + Color get snackBarTextSuccess => const Color(0xFF69C297); @override - Color get snackBarTextError => const Color(0xFF690001); + Color get snackBarTextError => const Color(0xFFCF6679); @override - Color get snackBarTextInfo => const Color(0xFF00297A); + Color get snackBarTextInfo => const Color(0xFFABAEFF); // icons @override - Color get bottomNavIconBack => const Color(0xFF7F8185); + Color get bottomNavIconBack => const Color(0xFF69696A); @override - Color get bottomNavIconIcon => const Color(0xFFFFFFFF); + Color get bottomNavIconIcon => const Color(0xFFDEDEDE); @override - Color get topNavIconPrimary => const Color(0xFFFFFFFF); + Color get topNavIconPrimary => const Color(0xFFDEDEDE); @override Color get topNavIconGreen => const Color(0xFF4CC0A0); @override - Color get topNavIconYellow => const Color(0xFFF7D65D); + Color get topNavIconYellow => const Color(0xFFD4A51E); @override Color get topNavIconRed => const Color(0xFFD34E50); @override - Color get settingsIconBack => const Color(0xFFE0E3E3); + Color get settingsIconBack => const Color(0xFFDEDEDE); @override Color get settingsIconIcon => const Color(0xFF232323); @override Color get settingsIconBack2 => const Color(0xFF94D6C4); @override - Color get settingsIconElement => const Color(0xFF00A578); + Color get settingsIconElement => const Color(0xFF4CC0A0); // text field @override - Color get textFieldActiveBG => const Color(0xFF4C5360); + Color get textFieldActiveBG => const Color(0xFF232323); @override - Color get textFieldDefaultBG => const Color(0xFF444953); + Color get textFieldDefaultBG => const Color(0xFF171717); @override - Color get textFieldErrorBG => const Color(0xFFFFB4A9); + Color get textFieldErrorBG => const Color(0xFF141414); @override - Color get textFieldSuccessBG => const Color(0xFF8EF5C3); + Color get textFieldSuccessBG => const Color(0xFF141414); @override - Color get textFieldActiveSearchIconLeft => const Color(0xFFA9ACAC); + Color get textFieldActiveSearchIconLeft => const Color(0xFF9C9C9C); @override - Color get textFieldDefaultSearchIconLeft => const Color(0xFFA9ACAC); + Color get textFieldDefaultSearchIconLeft => const Color(0xFF979797); @override - Color get textFieldErrorSearchIconLeft => const Color(0xFF690001); + Color get textFieldErrorSearchIconLeft => const Color(0xFFCF6679); @override - Color get textFieldSuccessSearchIconLeft => const Color(0xFF003921); + Color get textFieldSuccessSearchIconLeft => const Color(0xFF23CFA1); @override - Color get textFieldActiveText => const Color(0xFFFFFFFF); + Color get textFieldActiveText => const Color(0xFFC2C2C2); @override - Color get textFieldDefaultText => const Color(0xFFA9ACAC); + Color get textFieldDefaultText => const Color(0xFF979797); @override - Color get textFieldErrorText => const Color(0xFF000000); + Color get textFieldErrorText => const Color(0xFFCF6679); @override - Color get textFieldSuccessText => const Color(0xFF000000); + Color get textFieldSuccessText => const Color(0xFFDEDEDE); @override - Color get textFieldActiveLabel => const Color(0xFFA9ACAC); + Color get textFieldActiveLabel => const Color(0xFF979797); @override - Color get textFieldErrorLabel => const Color(0xFF690001); + Color get textFieldErrorLabel => const Color(0xFFCF6679); @override - Color get textFieldSuccessLabel => const Color(0xFF003921); + Color get textFieldSuccessLabel => const Color(0xFF69C297); @override - Color get textFieldActiveSearchIconRight => const Color(0xFFC4C7C7); + Color get textFieldActiveSearchIconRight => const Color(0xFF9C9C9C); @override - Color get textFieldDefaultSearchIconRight => const Color(0xFF747778); + Color get textFieldDefaultSearchIconRight => const Color(0xFF5D5D5D); @override - Color get textFieldErrorSearchIconRight => const Color(0xFF690001); + Color get textFieldErrorSearchIconRight => const Color(0xFFCF6679); @override - Color get textFieldSuccessSearchIconRight => const Color(0xFF003921); + Color get textFieldSuccessSearchIconRight => const Color(0xFF69C297); // settings item level2 @override - Color get settingsItem2ActiveBG => const Color(0xFF484B51); + Color get settingsItem2ActiveBG => const Color(0xFF242424); @override - Color get settingsItem2ActiveText => const Color(0xFFFFFFFF); + Color get settingsItem2ActiveText => const Color(0xFFD3D3D3); @override - Color get settingsItem2ActiveSub => const Color(0xFF9E9E9E); + Color get settingsItem2ActiveSub => const Color(0xFFB2B2B2); // radio buttons @override - Color get radioButtonIconBorder => const Color(0xFF4C86E9); + Color get radioButtonIconBorder => const Color(0xFF77A7F9); @override - Color get radioButtonIconBorderDisabled => const Color(0xFF9E9E9E); + Color get radioButtonIconBorderDisabled => const Color(0xFF7D7D7D); @override - Color get radioButtonBorderEnabled => const Color(0xFF4C86E9); + Color get radioButtonBorderEnabled => const Color(0xFF77A7F9); @override - Color get radioButtonBorderDisabled => const Color(0xFFCDCDCD); + Color get radioButtonBorderDisabled => const Color(0xFF7D7D7D); @override - Color get radioButtonIconCircle => const Color(0xFF9E9E9E); + Color get radioButtonIconCircle => const Color(0xFF77A7F9); @override - Color get radioButtonIconEnabled => const Color(0xFF4C86E9); + Color get radioButtonIconEnabled => const Color(0xFF77A7F9); @override - Color get radioButtonTextEnabled => const Color(0xFF44464E); + Color get radioButtonTextEnabled => const Color(0xFFA8AAB2); @override - Color get radioButtonTextDisabled => const Color(0xFF44464E); + Color get radioButtonTextDisabled => const Color(0xFFA8AAB2); @override - Color get radioButtonLabelEnabled => const Color(0xFF8E9192); + Color get radioButtonLabelEnabled => const Color(0xFF878A8A); @override - Color get radioButtonLabelDisabled => const Color(0xFF8E9192); + Color get radioButtonLabelDisabled => const Color(0xFF878A8A); // info text @override - Color get infoItemBG => const Color(0xFF333942); + Color get infoItemBG => const Color(0xFF141414); @override - Color get infoItemLabel => const Color(0xFF9E9E9E); + Color get infoItemLabel => const Color(0xFFB2B2B2); @override - Color get infoItemText => const Color(0xFFFFFFFF); + Color get infoItemText => const Color(0xFFDEDEDE); @override - Color get infoItemIcons => const Color(0xFF4C86E9); + Color get infoItemIcons => const Color(0xFF77A7F9); // popup @override - Color get popupBG => const Color(0xFF333942); + Color get popupBG => const Color(0xFF212121); // currency list @override - Color get currencyListItemBG => const Color(0xFF484B51); + Color get currencyListItemBG => const Color(0xFF252525); // bottom nav @override @@ -283,7 +284,7 @@ class DarkColors extends StackColorTheme { @override Color get stackWalletMid => const Color(0xFF292D34); @override - Color get stackWalletBottom => const Color(0xFFFFFFFF); + Color get stackWalletBottom => const Color(0xFF292D34); @override Color get bottomNavShadow => const Color(0xFF282E33); @@ -293,19 +294,19 @@ class DarkColors extends StackColorTheme { Color get favoriteStarInactive => textSubtitle2; @override - Color get splash => const Color(0x358E9192); + Color get splash => const Color(0xFF7A7D7E); @override - Color get highlight => const Color(0x44A9ACAC); + Color get highlight => const Color(0xFF878A8A); @override Color get warningForeground => snackBarTextError; @override - Color get warningBackground => const Color(0xFFFFB4A9); + Color get warningBackground => const Color(0xFF1F1F1F); @override - Color get loadingOverlayTextColor => const Color(0xFFF7F7F7); + Color get loadingOverlayTextColor => const Color(0xFFCFCFCF); @override - Color get myStackContactIconBG => const Color(0x88747778); + Color get myStackContactIconBG => const Color(0xFF747778); @override - Color get textConfirmTotalAmount => const Color(0xFF003921); + Color get textConfirmTotalAmount => const Color(0xFF144D35); @override - Color get textSelectedWordTableItem => const Color(0xFF00297A); + Color get textSelectedWordTableItem => const Color(0xFF143D8E); } From 8ca405cfea97f7f1172eb74b63ea6785f261284f Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Thu, 5 Jan 2023 11:51:15 -0700 Subject: [PATCH 13/45] oledBlack theme added to themeType --- lib/utilities/theme/color_theme.dart | 11 ++++++----- lib/utilities/theme/oled_black_colors.dart | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/utilities/theme/color_theme.dart b/lib/utilities/theme/color_theme.dart index 43012ffe6..94544ff11 100644 --- a/lib/utilities/theme/color_theme.dart +++ b/lib/utilities/theme/color_theme.dart @@ -3,12 +3,9 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/theme/dark_colors.dart'; import 'package:stackwallet/utilities/theme/light_colors.dart'; import 'package:stackwallet/utilities/theme/ocean_breeze_colors.dart'; +import 'package:stackwallet/utilities/theme/oled_black_colors.dart'; -enum ThemeType { - light, - dark, - oceanBreeze, -} +enum ThemeType { light, dark, oceanBreeze, oledBlack } extension ThemeTypeExt on ThemeType { StackColorTheme get colorTheme { @@ -19,6 +16,8 @@ extension ThemeTypeExt on ThemeType { return DarkColors(); case ThemeType.oceanBreeze: return OceanBreezeColors(); + case ThemeType.oledBlack: + return OledBlackColors(); } } @@ -30,6 +29,8 @@ extension ThemeTypeExt on ThemeType { return "Dark"; case ThemeType.oceanBreeze: return "Ocean Breeze"; + case ThemeType.oledBlack: + return "Oled Black"; } } } diff --git a/lib/utilities/theme/oled_black_colors.dart b/lib/utilities/theme/oled_black_colors.dart index b29dde318..ca142276b 100644 --- a/lib/utilities/theme/oled_black_colors.dart +++ b/lib/utilities/theme/oled_black_colors.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stackwallet/utilities/theme/color_theme.dart'; -class DarkColors extends StackColorTheme { +class OledBlackColors extends StackColorTheme { @override ThemeType get themeType => ThemeType.dark; From 6391e474f0dc9e12e22cbb3c75ec7675665de388 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 5 Jan 2023 14:32:36 -0600 Subject: [PATCH 14/45] add trusted flag to node model node model fix --- lib/models/node_model.dart | 6 ++++++ lib/models/type_adaptors/node_model.g.dart | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/models/node_model.dart b/lib/models/node_model.dart index af5f8cbc1..2aeaa893b 100644 --- a/lib/models/node_model.dart +++ b/lib/models/node_model.dart @@ -26,6 +26,8 @@ class NodeModel { final bool isFailover; // @HiveField(9) final bool isDown; + // @HiveField(10) + final bool? trusted; NodeModel({ required this.host, @@ -38,6 +40,7 @@ class NodeModel { required this.isFailover, required this.isDown, this.loginName, + this.trusted, }); NodeModel copyWith({ @@ -50,6 +53,7 @@ class NodeModel { String? coinName, bool? isFailover, bool? isDown, + bool? trusted, }) { return NodeModel( host: host ?? this.host, @@ -62,6 +66,7 @@ class NodeModel { coinName: coinName ?? this.coinName, isFailover: isFailover ?? this.isFailover, isDown: isDown ?? this.isDown, + trusted: trusted ?? this.trusted, ); } @@ -82,6 +87,7 @@ class NodeModel { map['coinName'] = coinName; map['isFailover'] = isFailover; map['isDown'] = isDown; + map['trusted'] = trusted; return map; } diff --git a/lib/models/type_adaptors/node_model.g.dart b/lib/models/type_adaptors/node_model.g.dart index 580c36a75..597468c56 100644 --- a/lib/models/type_adaptors/node_model.g.dart +++ b/lib/models/type_adaptors/node_model.g.dart @@ -26,14 +26,15 @@ class NodeModelAdapter extends TypeAdapter { loginName: fields[5] as String?, coinName: fields[7] as String, isFailover: fields[8] as bool, - isDown: fields[8] as bool, + isDown: fields[9] as bool, + trusted: fields[10] as bool?, ); } @override void write(BinaryWriter writer, NodeModel obj) { writer - ..writeByte(10) + ..writeByte(11) ..writeByte(0) ..write(obj.id) ..writeByte(1) @@ -53,7 +54,9 @@ class NodeModelAdapter extends TypeAdapter { ..writeByte(8) ..write(obj.isFailover) ..writeByte(9) - ..write(obj.isDown); + ..write(obj.isDown) + ..writeByte(10) + ..write(obj.trusted); } @override From 0a810987c0642a698ac34807fcf15702ba2a9964 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Thu, 5 Jan 2023 13:34:56 -0700 Subject: [PATCH 15/45] oledBlack added to textStyles and appearance settings --- .../appearance_settings_view.dart | 2 + .../settings_menu/appearance_settings.dart | 2 + lib/utilities/text_styles.dart | 357 ++++++++++++++++++ 3 files changed, 361 insertions(+) diff --git a/lib/pages/settings_views/global_settings_view/appearance_settings_view.dart b/lib/pages/settings_views/global_settings_view/appearance_settings_view.dart index 693f39f02..9f9447a66 100644 --- a/lib/pages/settings_views/global_settings_view/appearance_settings_view.dart +++ b/lib/pages/settings_views/global_settings_view/appearance_settings_view.dart @@ -28,6 +28,8 @@ class AppearanceSettingsView extends ConsumerWidget { return "Ocean theme"; case ThemeType.dark: return "Dark theme"; + case ThemeType.oledBlack: + return "Oled Black theme"; } } diff --git a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings.dart index 8486e64f6..d1812c89f 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings.dart @@ -163,6 +163,8 @@ class _ThemeToggle extends ConsumerState { return Assets.svg.themeDark; case ThemeType.oceanBreeze: return Assets.svg.themeOcean; + case ThemeType.oledBlack: + return Assets.svg.themeOledBlack; } } diff --git a/lib/utilities/text_styles.dart b/lib/utilities/text_styles.dart index 56c313219..64e3c319f 100644 --- a/lib/utilities/text_styles.dart +++ b/lib/utilities/text_styles.dart @@ -27,6 +27,12 @@ class STextStyles { fontWeight: FontWeight.w600, fontSize: 20, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w600, + fontSize: 20, + ); } } @@ -50,6 +56,12 @@ class STextStyles { fontWeight: FontWeight.w600, fontSize: 18, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w600, + fontSize: 18, + ); } } @@ -73,6 +85,12 @@ class STextStyles { fontWeight: FontWeight.w600, fontSize: 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w600, + fontSize: 16, + ); } } @@ -96,6 +114,12 @@ class STextStyles { fontWeight: FontWeight.w600, fontSize: 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w600, + fontSize: 16, + ); } } @@ -119,6 +143,12 @@ class STextStyles { fontWeight: FontWeight.w400, fontSize: 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w400, + fontSize: 16, + ); } } @@ -142,6 +172,12 @@ class STextStyles { fontWeight: FontWeight.w400, fontSize: 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w400, + fontSize: 16, + ); } } @@ -165,6 +201,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 16, + ); } } @@ -188,6 +230,12 @@ class STextStyles { fontWeight: FontWeight.w600, fontSize: 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w600, + fontSize: 16, + ); } } @@ -211,6 +259,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).buttonTextPrimary, + fontWeight: FontWeight.w500, + fontSize: 16, + ); } } @@ -234,6 +288,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 16, + ); } } @@ -257,6 +317,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark3, + fontWeight: FontWeight.w500, + fontSize: 16, + ); } } @@ -280,6 +346,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 14, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark3, + fontWeight: FontWeight.w500, + fontSize: 14, + ); } } @@ -303,6 +375,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 12, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textSubtitle1, + fontWeight: FontWeight.w500, + fontSize: 12, + ); } } @@ -329,6 +407,13 @@ class STextStyles { fontSize: 14, height: 14 / 14, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textFieldActiveSearchIconRight, + fontWeight: FontWeight.w500, + fontSize: 14, + height: 14 / 14, + ); } } @@ -352,6 +437,12 @@ class STextStyles { fontWeight: FontWeight.w700, fontSize: 12, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textSubtitle1, + fontWeight: FontWeight.w700, + fontSize: 12, + ); } } @@ -375,6 +466,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 14, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).infoItemLabel, + fontWeight: FontWeight.w500, + fontSize: 14, + ); } } @@ -398,6 +495,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 14, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 14, + ); } } @@ -421,6 +524,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 14, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 14, + ); } } @@ -447,6 +556,13 @@ class STextStyles { fontSize: 14, height: 1.5, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textSubtitle2, + fontWeight: FontWeight.w500, + fontSize: 14, + height: 1.5, + ); } } @@ -473,6 +589,13 @@ class STextStyles { fontSize: 14, height: 1.5, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 14, + height: 1.5, + ); } } @@ -496,6 +619,12 @@ class STextStyles { fontWeight: FontWeight.w400, fontSize: 14, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w400, + fontSize: 14, + ); } } @@ -519,6 +648,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 14, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).accentColorRed, + fontWeight: FontWeight.w500, + fontSize: 14, + ); } } @@ -542,6 +677,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 14, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).infoItemIcons, + fontWeight: FontWeight.w500, + fontSize: 14, + ); } } @@ -565,6 +706,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 12, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).accentColorBlue, + fontWeight: FontWeight.w500, + fontSize: 12, + ); } } @@ -588,6 +735,12 @@ class STextStyles { fontWeight: FontWeight.w600, fontSize: 12, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w600, + fontSize: 12, + ); } } @@ -611,6 +764,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 12, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 12, + ); } } @@ -634,6 +793,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 12, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 12, + ); } } @@ -657,6 +822,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 10, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textError, + fontWeight: FontWeight.w500, + fontSize: 10, + ); } } @@ -680,6 +851,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 10, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textSubtitle1, + fontWeight: FontWeight.w500, + fontSize: 10, + ); } } @@ -708,6 +885,13 @@ class STextStyles { fontSize: 40, height: 40 / 40, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w600, + fontSize: 40, + height: 40 / 40, + ); } } @@ -734,6 +918,13 @@ class STextStyles { fontSize: 32, height: 32 / 32, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w600, + fontSize: 32, + height: 32 / 32, + ); } } @@ -760,6 +951,13 @@ class STextStyles { fontSize: 24, height: 24 / 24, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w600, + fontSize: 24, + height: 24 / 24, + ); } } @@ -786,6 +984,13 @@ class STextStyles { fontSize: 20, height: 30 / 20, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 20, + height: 30 / 20, + ); } } @@ -812,6 +1017,13 @@ class STextStyles { fontSize: 20, height: 30 / 20, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w400, + fontSize: 20, + height: 30 / 20, + ); } } @@ -838,6 +1050,13 @@ class STextStyles { fontSize: 20, height: 28 / 20, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w400, + fontSize: 20, + height: 28 / 20, + ); } } @@ -864,6 +1083,13 @@ class STextStyles { fontSize: 24, height: 33 / 24, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w400, + fontSize: 24, + height: 33 / 24, + ); } } @@ -890,6 +1116,13 @@ class STextStyles { fontSize: 20, height: 26 / 20, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).buttonTextPrimary, + fontWeight: FontWeight.w500, + fontSize: 20, + height: 26 / 20, + ); } } @@ -916,6 +1149,13 @@ class STextStyles { fontSize: 20, height: 26 / 20, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).buttonTextPrimaryDisabled, + fontWeight: FontWeight.w500, + fontSize: 20, + height: 26 / 20, + ); } } @@ -942,6 +1182,13 @@ class STextStyles { fontSize: 20, height: 26 / 20, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).buttonTextSecondary, + fontWeight: FontWeight.w500, + fontSize: 20, + height: 26 / 20, + ); } } @@ -968,6 +1215,13 @@ class STextStyles { fontSize: 20, height: 26 / 20, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).buttonTextSecondaryDisabled, + fontWeight: FontWeight.w500, + fontSize: 20, + height: 26 / 20, + ); } } @@ -994,6 +1248,13 @@ class STextStyles { fontSize: 18, height: 27 / 18, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).buttonTextPrimaryDisabled, + fontWeight: FontWeight.w500, + fontSize: 18, + height: 27 / 18, + ); } } @@ -1020,6 +1281,13 @@ class STextStyles { fontSize: 18, height: 27 / 18, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).buttonTextPrimaryDisabled, + fontWeight: FontWeight.w700, + fontSize: 18, + height: 27 / 18, + ); } } @@ -1046,6 +1314,13 @@ class STextStyles { fontSize: 16, height: 24 / 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).buttonTextPrimaryDisabled, + fontWeight: FontWeight.w500, + fontSize: 16, + height: 24 / 16, + ); } } @@ -1072,6 +1347,13 @@ class STextStyles { fontSize: 14, height: 21 / 14, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textSubtitle1, + fontWeight: FontWeight.w500, + fontSize: 14, + height: 21 / 14, + ); } } @@ -1098,6 +1380,13 @@ class STextStyles { fontSize: 14, height: 21 / 14, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w600, + fontSize: 14, + height: 21 / 14, + ); } } @@ -1124,6 +1413,13 @@ class STextStyles { fontSize: 16, height: 24 / 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).buttonTextSecondary, + fontWeight: FontWeight.w500, + fontSize: 16, + height: 24 / 16, + ); } } @@ -1150,6 +1446,13 @@ class STextStyles { fontSize: 20, height: 30 / 20, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textSubtitle2, + fontWeight: FontWeight.w500, + fontSize: 20, + height: 30 / 20, + ); } } @@ -1176,6 +1479,13 @@ class STextStyles { fontSize: 16, height: 20.8 / 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark.withOpacity(0.8), + fontWeight: FontWeight.w500, + fontSize: 16, + height: 20.8 / 16, + ); } } @@ -1202,6 +1512,13 @@ class STextStyles { fontSize: 16, height: 20.8 / 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 16, + height: 20.8 / 16, + ); } } @@ -1228,6 +1545,13 @@ class STextStyles { fontSize: 16, height: 20.8 / 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark.withOpacity(0.5), + fontWeight: FontWeight.w500, + fontSize: 16, + height: 20.8 / 16, + ); } } @@ -1254,6 +1578,13 @@ class STextStyles { fontSize: 16, height: 20.8 / 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 16, + height: 20.8 / 16, + ); } } @@ -1277,6 +1608,12 @@ class STextStyles { fontWeight: FontWeight.w600, fontSize: 8, ); + case ThemeType.oledBlack: + return GoogleFonts.roboto( + color: _theme(context).textDark, + fontWeight: FontWeight.w600, + fontSize: 8, + ); } } @@ -1300,6 +1637,12 @@ class STextStyles { fontWeight: FontWeight.w400, fontSize: 26, ); + case ThemeType.oledBlack: + return GoogleFonts.roboto( + color: _theme(context).numberTextDefault, + fontWeight: FontWeight.w400, + fontSize: 26, + ); } } @@ -1326,6 +1669,13 @@ class STextStyles { fontWeight: FontWeight.w400, fontSize: 12, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + letterSpacing: 0.5, + color: _theme(context).accentColorDark, + fontWeight: FontWeight.w400, + fontSize: 12, + ); } } @@ -1352,6 +1702,13 @@ class STextStyles { fontWeight: FontWeight.w600, fontSize: 16, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + letterSpacing: 0.5, + color: _theme(context).accentColorDark, + fontWeight: FontWeight.w600, + fontSize: 16, + ); } } } From 7aad7cb9e320ffc8de52a2f00dd52017f3248a6c Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Thu, 5 Jan 2023 13:59:17 -0700 Subject: [PATCH 16/45] oledBlack text color fix --- .../appearance_settings_view.dart | 82 +++++++++++++++++++ lib/utilities/theme/oled_black_colors.dart | 10 +-- 2 files changed, 87 insertions(+), 5 deletions(-) diff --git a/lib/pages/settings_views/global_settings_view/appearance_settings_view.dart b/lib/pages/settings_views/global_settings_view/appearance_settings_view.dart index 9f9447a66..73da50719 100644 --- a/lib/pages/settings_views/global_settings_view/appearance_settings_view.dart +++ b/lib/pages/settings_views/global_settings_view/appearance_settings_view.dart @@ -9,6 +9,7 @@ import 'package:stackwallet/utilities/theme/color_theme.dart'; import 'package:stackwallet/utilities/theme/dark_colors.dart'; import 'package:stackwallet/utilities/theme/light_colors.dart'; import 'package:stackwallet/utilities/theme/ocean_breeze_colors.dart'; +import 'package:stackwallet/utilities/theme/oled_black_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart'; @@ -432,6 +433,87 @@ class _ThemeOptionsView extends ConsumerState { ), ), ), + const SizedBox( + height: 10, + ), + MaterialButton( + splashColor: Colors.transparent, + hoverColor: Colors.transparent, + padding: const EdgeInsets.all(0), + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + onPressed: () { + DB.instance.put( + boxName: DB.boxNameTheme, + key: "colorScheme", + value: ThemeType.oledBlack.name, + ); + ref.read(colorThemeProvider.state).state = + StackColors.fromStackColorTheme( + OledBlackColors(), + ); + + setState(() { + _selectedTheme = "oledBlack"; + }); + }, + child: SizedBox( + width: 200, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + SizedBox( + width: 10, + height: 10, + child: Radio( + activeColor: Theme.of(context) + .extension()! + .radioButtonIconEnabled, + value: "oledBlack", + groupValue: _selectedTheme, + onChanged: (newValue) { + if (newValue is String && newValue == "oledBlack") { + DB.instance.put( + boxName: DB.boxNameTheme, + key: "colorScheme", + value: ThemeType.oledBlack.name, + ); + ref.read(colorThemeProvider.state).state = + StackColors.fromStackColorTheme( + OledBlackColors(), + ); + + setState(() { + _selectedTheme = "oledBlack"; + }); + } + }, + ), + ), + const SizedBox( + width: 14, + ), + Text( + "OLED Black", + style: + STextStyles.desktopTextExtraSmall(context).copyWith( + color: Theme.of(context) + .extension()! + .textDark2, + ), + ), + ], + ), + ], + ), + ), + ), ], ); } diff --git a/lib/utilities/theme/oled_black_colors.dart b/lib/utilities/theme/oled_black_colors.dart index ca142276b..1a3fd0cc4 100644 --- a/lib/utilities/theme/oled_black_colors.dart +++ b/lib/utilities/theme/oled_black_colors.dart @@ -33,17 +33,17 @@ class OledBlackColors extends StackColorTheme { Color get shadow => const Color(0x0F2D3132); //not done yet @override - Color get textDark => const Color(0xFF2D3132); + Color get textDark => const Color(0xFFDEDEDE); @override - Color get textDark2 => const Color(0xFFDEDEDE); + Color get textDark2 => const Color(0xFFCCCCCC); @override - Color get textDark3 => const Color(0xFFCCCCCC); + Color get textDark3 => const Color(0xFFB2B2B2); @override Color get textSubtitle1 => const Color(0xFFB2B2B2); @override - Color get textSubtitle2 => const Color(0xFFB2B2B2); + Color get textSubtitle2 => const Color(0xFFA0A0A0); @override - Color get textSubtitle3 => const Color(0xFFA0A0A0); + Color get textSubtitle3 => const Color(0xFF878A8A); @override Color get textSubtitle4 => const Color(0xFF878A8A); @override From db57b4bca7941b9df533f5f61bbdd9bbcb6684cf Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 5 Jan 2023 19:14:43 -0600 Subject: [PATCH 17/45] ref update: expose using trusted node setting in flutter_libmonero --- crypto_plugins/flutter_libmonero | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto_plugins/flutter_libmonero b/crypto_plugins/flutter_libmonero index 201ebc2ca..37bda039f 160000 --- a/crypto_plugins/flutter_libmonero +++ b/crypto_plugins/flutter_libmonero @@ -1 +1 @@ -Subproject commit 201ebc2ca4ef003b2b264af47467868a00fcbd73 +Subproject commit 37bda039f8cce636c4b6f4ad0ce52af9e25edfff From 903e034b58645f0176f6e6a70e083e739f4b2ed8 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 5 Jan 2023 20:03:20 -0600 Subject: [PATCH 18/45] add trusted checkbox to monero and wownero node details defaults to false TODO call native function to set node as trusted when checked (and vice versa) --- .../add_edit_node_view.dart | 67 ++++++++++++++++++- .../manage_nodes_views/node_details_view.dart | 1 + lib/utilities/default_nodes.dart | 2 + 3 files changed, 67 insertions(+), 3 deletions(-) diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart index e29b0888f..7e5a7d553 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart @@ -328,6 +328,7 @@ class _AddEditNodeViewState extends ConsumerState { enabled: true, coinName: coin.name, isFailover: formData.isFailover!, + trusted: formData.trusted!, isDown: false, ); @@ -352,6 +353,7 @@ class _AddEditNodeViewState extends ConsumerState { enabled: true, coinName: coin.name, isFailover: formData.isFailover!, + trusted: formData.trusted!, isDown: false, ); @@ -621,11 +623,11 @@ class _AddEditNodeViewState extends ConsumerState { class NodeFormData { String? name, host, login, password; int? port; - bool? useSSL, isFailover; + bool? useSSL, isFailover, trusted; @override String toString() { - return "{ name: $name, host: $host, port: $port, useSSL: $useSSL }"; + return "{ name: $name, host: $host, port: $port, useSSL: $useSSL, trusted: $trusted }"; } } @@ -666,8 +668,10 @@ class _NodeFormState extends ConsumerState { bool _useSSL = false; bool _isFailover = false; + bool _trusted = false; int? port; late bool enableSSLCheckbox; + late bool trustedCheckbox; late final bool enableAuthFields; @@ -733,6 +737,7 @@ class _NodeFormState extends ConsumerState { ref.read(nodeFormDataProvider).port = port; ref.read(nodeFormDataProvider).useSSL = _useSSL; ref.read(nodeFormDataProvider).isFailover = _isFailover; + ref.read(nodeFormDataProvider).trusted = _trusted; } @override @@ -764,12 +769,17 @@ class _NodeFormState extends ConsumerState { _usernameController.text = node.loginName ?? ""; _useSSL = node.useSSL; _isFailover = node.isFailover; + _trusted = node.trusted ?? false; if (widget.coin == Coin.epicCash) { enableSSLCheckbox = !node.host.startsWith("http"); } else { enableSSLCheckbox = true; } - print("enableSSLCheckbox: $enableSSLCheckbox"); + if (widget.coin == Coin.monero || widget.coin == Coin.wownero) { + trustedCheckbox = node.trusted ?? false; + } else { + trustedCheckbox = false; + } WidgetsBinding.instance.addPostFrameCallback((_) { // update provider state object so test connection works without having to modify a field in the ui first @@ -1106,6 +1116,57 @@ class _NodeFormState extends ConsumerState { ), ], ), + if (widget.coin == Coin.monero || widget.coin == Coin.wownero) + Row( + children: [ + GestureDetector( + onTap: trustedCheckbox + ? () { + setState(() { + _trusted = !_trusted; + }); + _updateState(); + } + : null, + child: Container( + color: Colors.transparent, + child: Row( + children: [ + SizedBox( + width: 20, + height: 20, + child: Checkbox( + fillColor: trustedCheckbox + ? null + : MaterialStateProperty.all(Theme.of(context) + .extension()! + .checkboxBGDisabled), + materialTapTargetSize: + MaterialTapTargetSize.shrinkWrap, + value: _trusted, + onChanged: trustedCheckbox + ? (newValue) { + setState(() { + _trusted = newValue!; + }); + _updateState(); + } + : null, + ), + ), + const SizedBox( + width: 12, + ), + Text( + "Trusted", + style: STextStyles.itemSubtitle12(context), + ) + ], + ), + ), + ), + ], + ), if (widget.coin != Coin.monero && widget.coin != Coin.wownero && widget.coin != Coin.epicCash) diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart index ad8ad7301..dab7dbee6 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart @@ -388,6 +388,7 @@ class _NodeDetailsViewState extends ConsumerState { port: ref.read(nodeFormDataProvider).port, name: ref.read(nodeFormDataProvider).name, useSSL: ref.read(nodeFormDataProvider).useSSL, + trusted: ref.read(nodeFormDataProvider).trusted, loginName: ref.read(nodeFormDataProvider).login, isFailover: ref.read(nodeFormDataProvider).isFailover, diff --git a/lib/utilities/default_nodes.dart b/lib/utilities/default_nodes.dart index e45e33aec..9072b75d0 100644 --- a/lib/utilities/default_nodes.dart +++ b/lib/utilities/default_nodes.dart @@ -108,6 +108,7 @@ abstract class DefaultNodes { coinName: Coin.monero.name, isFailover: true, isDown: false, + trusted: false, ); static NodeModel get wownero => NodeModel( @@ -120,6 +121,7 @@ abstract class DefaultNodes { coinName: Coin.wownero.name, isFailover: true, isDown: false, + trusted: false, ); static NodeModel get epicCash => NodeModel( From ad15f4d126adc42561b9ffff20b8432e50dc0275 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 5 Jan 2023 20:03:38 -0600 Subject: [PATCH 19/45] linting --- .../manage_nodes_views/node_details_view.dart | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart index dab7dbee6..1816e9886 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart @@ -70,15 +70,13 @@ class _NodeDetailsViewState extends ConsumerState { switch (coin) { case Coin.epicCash: try { - - testPassed = await testEpicNodeConnection( - NodeFormData() - ..host = node!.host - ..useSSL = node.useSSL - ..port = node.port, - ) != - null; - + testPassed = await testEpicNodeConnection( + NodeFormData() + ..host = node!.host + ..useSSL = node.useSSL + ..port = node.port, + ) != + null; } catch (e, s) { Logging.instance.log("$e\n$s", level: LogLevel.Warning); testPassed = false; From 5e15e3e4b03b2ba8a89f1bf8f4cc45050291d272 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 5 Jan 2023 20:13:01 -0600 Subject: [PATCH 20/45] change checkbox color unless in edit mode --- .../manage_nodes_views/add_edit_node_view.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart index 7e5a7d553..6df9cdf59 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart @@ -1120,7 +1120,7 @@ class _NodeFormState extends ConsumerState { Row( children: [ GestureDetector( - onTap: trustedCheckbox + onTap: !widget.readOnly && trustedCheckbox ? () { setState(() { _trusted = !_trusted; @@ -1136,7 +1136,7 @@ class _NodeFormState extends ConsumerState { width: 20, height: 20, child: Checkbox( - fillColor: trustedCheckbox + fillColor: !widget.readOnly && trustedCheckbox ? null : MaterialStateProperty.all(Theme.of(context) .extension()! @@ -1144,7 +1144,7 @@ class _NodeFormState extends ConsumerState { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, value: _trusted, - onChanged: trustedCheckbox + onChanged: !widget.readOnly && trustedCheckbox ? (newValue) { setState(() { _trusted = newValue!; From 23e3452cf1930a7e6760f9950b21ff4a9dc8d7b7 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Fri, 6 Jan 2023 09:12:01 -0700 Subject: [PATCH 21/45] oledBlack theme added to desktop --- lib/main.dart | 5 +- .../settings_menu/appearance_settings.dart | 186 +++++++++--------- lib/utilities/assets.dart | 1 + lib/utilities/theme/oled_black_colors.dart | 2 +- lib/widgets/background.dart | 1 + 5 files changed, 102 insertions(+), 93 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 4303889b7..ce9053e2c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -59,6 +59,7 @@ import 'package:stackwallet/utilities/theme/color_theme.dart'; import 'package:stackwallet/utilities/theme/dark_colors.dart'; import 'package:stackwallet/utilities/theme/light_colors.dart'; import 'package:stackwallet/utilities/theme/ocean_breeze_colors.dart'; +import 'package:stackwallet/utilities/theme/oled_black_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/util.dart'; import 'package:window_size/window_size.dart'; @@ -75,7 +76,6 @@ void main() async { if (Platform.isIOS) { Util.libraryPath = await getLibraryDirectory(); } - Screen? screen; if (Platform.isLinux || (Util.isDesktop && !Platform.isIOS)) { screen = await getCurrentScreen(); @@ -323,6 +323,9 @@ class _MaterialAppWithThemeState extends ConsumerState case "dark": colorTheme = DarkColors(); break; + case "oledBlack": + colorTheme = OledBlackColors(); + break; case "oceanBreeze": colorTheme = OceanBreezeColors(); break; diff --git a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings.dart index d1812c89f..dcbbd15b1 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings.dart @@ -35,106 +35,110 @@ class _AppearanceOptionSettings ), child: RoundedWhiteContainer( radiusMultiplier: 2, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Wrap( children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: SvgPicture.asset( - Assets.svg.circleSun, - width: 48, - height: 48, - ), - ), Column( - crossAxisAlignment: CrossAxisAlignment.stretch, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: const EdgeInsets.all(10), - child: RichText( - textAlign: TextAlign.left, - text: TextSpan( - children: [ - TextSpan( - text: "Appearances", - style: STextStyles.desktopTextSmall(context), - ), - TextSpan( - text: - "\n\nCustomize how your Stack Wallet looks according to your preferences.", - style: STextStyles.desktopTextExtraExtraSmall( - context), - ), - ], - ), + padding: const EdgeInsets.all(8.0), + child: SvgPicture.asset( + Assets.svg.circleSun, + width: 48, + height: 48, ), ), - ], - ), - const Padding( - padding: EdgeInsets.all(10.0), - child: Divider( - thickness: 0.5, - ), - ), - Padding( - padding: const EdgeInsets.all(10.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Display favorite wallets", - style: STextStyles.desktopTextExtraSmall(context) - .copyWith( - color: Theme.of(context) - .extension()! - .textDark), - textAlign: TextAlign.left, - ), - SizedBox( - height: 20, - width: 40, - child: DraggableSwitchButton( - isOn: ref.watch( - prefsChangeNotifierProvider - .select((value) => value.showFavoriteWallets), + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Padding( + padding: const EdgeInsets.all(10), + child: RichText( + textAlign: TextAlign.left, + text: TextSpan( + children: [ + TextSpan( + text: "Appearances", + style: STextStyles.desktopTextSmall(context), + ), + TextSpan( + text: + "\n\nCustomize how your Stack Wallet looks according to your preferences.", + style: STextStyles.desktopTextExtraExtraSmall( + context), + ), + ], + ), ), - onValueChanged: (newValue) { - ref - .read(prefsChangeNotifierProvider) - .showFavoriteWallets = newValue; - }, ), - ) - ], - ), - ), - const Padding( - padding: EdgeInsets.all(10.0), - child: Divider( - thickness: 0.5, - ), - ), - Padding( - padding: const EdgeInsets.all(10.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Choose theme", - style: STextStyles.desktopTextExtraSmall(context) - .copyWith( - color: Theme.of(context) - .extension()! - .textDark), - textAlign: TextAlign.left, + ], + ), + const Padding( + padding: EdgeInsets.all(10.0), + child: Divider( + thickness: 0.5, ), - ], - ), - ), - const Padding( - padding: EdgeInsets.all(10), - child: ThemeToggle(), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Display favorite wallets", + style: STextStyles.desktopTextExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textDark), + textAlign: TextAlign.left, + ), + SizedBox( + height: 20, + width: 40, + child: DraggableSwitchButton( + isOn: ref.watch( + prefsChangeNotifierProvider.select( + (value) => value.showFavoriteWallets), + ), + onValueChanged: (newValue) { + ref + .read(prefsChangeNotifierProvider) + .showFavoriteWallets = newValue; + }, + ), + ) + ], + ), + ), + const Padding( + padding: EdgeInsets.all(10.0), + child: Divider( + thickness: 0.5, + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Choose theme", + style: STextStyles.desktopTextExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textDark), + textAlign: TextAlign.left, + ), + ], + ), + ), + Padding( + padding: EdgeInsets.all(10), + child: ThemeToggle(), + ), + ], ), ], ), diff --git a/lib/utilities/assets.dart b/lib/utilities/assets.dart index 6c421ebec..f9128205d 100644 --- a/lib/utilities/assets.dart +++ b/lib/utilities/assets.dart @@ -33,6 +33,7 @@ class _SVG { switch (Theme.of(context).extension()!.themeType) { case ThemeType.light: case ThemeType.dark: + case ThemeType.oledBlack: return null; case ThemeType.oceanBreeze: diff --git a/lib/utilities/theme/oled_black_colors.dart b/lib/utilities/theme/oled_black_colors.dart index 1a3fd0cc4..102dc96f5 100644 --- a/lib/utilities/theme/oled_black_colors.dart +++ b/lib/utilities/theme/oled_black_colors.dart @@ -3,7 +3,7 @@ import 'package:stackwallet/utilities/theme/color_theme.dart'; class OledBlackColors extends StackColorTheme { @override - ThemeType get themeType => ThemeType.dark; + ThemeType get themeType => ThemeType.oledBlack; @override Color get background => const Color(0xFF000000); diff --git a/lib/widgets/background.dart b/lib/widgets/background.dart index 67ff44f55..0a14e2df6 100644 --- a/lib/widgets/background.dart +++ b/lib/widgets/background.dart @@ -20,6 +20,7 @@ class Background extends StatelessWidget { switch (Theme.of(context).extension()!.themeType) { case ThemeType.light: case ThemeType.dark: + case ThemeType.oledBlack: color = Theme.of(context).extension()!.background; break; case ThemeType.oceanBreeze: From 5e795ccc336891cf3c3e04580c454cc6ffe9cc93 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Fri, 6 Jan 2023 09:21:31 -0700 Subject: [PATCH 22/45] oledBlack desktopTextSmall color fix --- lib/utilities/text_styles.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utilities/text_styles.dart b/lib/utilities/text_styles.dart index 64e3c319f..3d1a38c12 100644 --- a/lib/utilities/text_styles.dart +++ b/lib/utilities/text_styles.dart @@ -1250,7 +1250,7 @@ class STextStyles { ); case ThemeType.oledBlack: return GoogleFonts.inter( - color: _theme(context).buttonTextPrimaryDisabled, + color: _theme(context).textDark, fontWeight: FontWeight.w500, fontSize: 18, height: 27 / 18, From 79f2cc0768771e281014668f74d3c522ee2cda6b Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Fri, 6 Jan 2023 09:35:41 -0700 Subject: [PATCH 23/45] wrap funct on desktop theme selectors --- .../settings/settings_menu/appearance_settings.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings.dart index dcbbd15b1..f1bb52244 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings.dart @@ -174,7 +174,9 @@ class _ThemeToggle extends ConsumerState { @override Widget build(BuildContext context) { - return Row( + return Wrap( + spacing: 16, + runSpacing: 16, children: [ for (int i = 0; i < ThemeType.values.length; i++) Row( From 67e6b6991e8db3ae473d13763173f78e9d09eb21 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Fri, 6 Jan 2023 09:50:05 -0700 Subject: [PATCH 24/45] oledBlack images added --- pubspec.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pubspec.yaml b/pubspec.yaml index f7d7d62b1..b6949e41d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -385,6 +385,21 @@ flutter: - assets/svg/oceanBreeze/buy-coins-icon.svg - assets/svg/oceanBreeze/bg.svg + # OLED black theme specific + - assets/svg/oledBlack/tx-exchange-icon.svg + - assets/svg/oledBlack/tx-exchange-icon-pending.svg + - assets/svg/oledBlack/tx-exchange-icon-failed.svg + - assets/svg/oledBlack/tx-icon-send.svg + - assets/svg/oledBlack/tx-icon-send-pending.svg + - assets/svg/oledBlack/tx-icon-send-failed.svg + - assets/svg/oledBlack/tx-icon-receive.svg + - assets/svg/oledBlack/tx-icon-receive-pending.svg + - assets/svg/oledBlack/tx-icon-receive-failed.svg + - assets/svg/oledBlack/exchange-2.svg + - assets/svg/oledBlack/bell-new.svg + - assets/svg/oledBlack/stack-icon1.svg + - assets/svg/oledBlack/buy-coins-icon.svg + # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. # For details regarding adding assets from package dependencies, see From 3794b18ba63d561c3b2a367116584ff419bf31f4 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 6 Jan 2023 11:15:32 -0600 Subject: [PATCH 25/45] comment update --- lib/services/coins/coin_service.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/services/coins/coin_service.dart b/lib/services/coins/coin_service.dart index 7a43c71da..f0c154ba7 100644 --- a/lib/services/coins/coin_service.dart +++ b/lib/services/coins/coin_service.dart @@ -310,6 +310,8 @@ abstract class CoinServiceAPI { // Certain outputs return address as an array/list of strings like List ["addresses"][0], some return it as a string like String ["address"] String? getAddress(dynamic output) { + // Julian's code from https://github.com/cypherstack/stack_wallet/blob/35a8172d35f1b5cdbd22f0d56c4db02f795fd032/lib/services/coins/coin_paynym_extension.dart#L170 wins codegolf for this, I'd love to commit it now but need to retest this section ... should make unit tests for this case + // final String? address = output["scriptPubKey"]?["addresses"]?[0] as String? ?? output["scriptPubKey"]?["address"] as String?; String? address; if (output.containsKey('scriptPubKey') as bool) { // Make sure the key exists before using it @@ -330,6 +332,8 @@ abstract class CoinServiceAPI { // Firo wants an array/list of address strings like List List? getAddresses(dynamic output) { + // Inspired by Julian's code as referenced above, need to test before committing + // final List? addresses = output["scriptPubKey"]?["addresses"] as List? ?? [output["scriptPubKey"]?["address"]] as List?; List? addresses; if (output.containsKey('scriptPubKey') as bool) { if (output["scriptPubKey"].containsKey('addresses') as bool) { From 1e4a39a92cb239e86dfe6aabf309476f4b2ae0ae Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 6 Jan 2023 14:41:51 -0600 Subject: [PATCH 26/45] make checkboxes checkable when editing --- .../manage_nodes_views/add_edit_node_view.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart index 6df9cdf59..7db6e5845 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart @@ -1120,7 +1120,7 @@ class _NodeFormState extends ConsumerState { Row( children: [ GestureDetector( - onTap: !widget.readOnly && trustedCheckbox + onTap: !widget.readOnly /*&& trustedCheckbox*/ ? () { setState(() { _trusted = !_trusted; @@ -1136,7 +1136,7 @@ class _NodeFormState extends ConsumerState { width: 20, height: 20, child: Checkbox( - fillColor: !widget.readOnly && trustedCheckbox + fillColor: !widget.readOnly /*&& trustedCheckbox*/ ? null : MaterialStateProperty.all(Theme.of(context) .extension()! @@ -1144,7 +1144,7 @@ class _NodeFormState extends ConsumerState { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, value: _trusted, - onChanged: !widget.readOnly && trustedCheckbox + onChanged: !widget.readOnly /*&& trustedCheckbox*/ ? (newValue) { setState(() { _trusted = newValue!; From 227dd61be2ee89fd7b46566cba0357555c520f15 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 6 Jan 2023 14:55:06 -0600 Subject: [PATCH 27/45] pass trusted to connectToNode --- lib/services/coins/monero/monero_wallet.dart | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/services/coins/monero/monero_wallet.dart b/lib/services/coins/monero/monero_wallet.dart index d9c6ae42b..a7b8fcade 100644 --- a/lib/services/coins/monero/monero_wallet.dart +++ b/lib/services/coins/monero/monero_wallet.dart @@ -398,7 +398,10 @@ class MoneroWallet extends CoinServiceAPI { final node = await _getCurrentNode(); final host = Uri.parse(node.host).host; await walletBase!.connectToNode( - node: Node(uri: "$host:${node.port}", type: WalletType.monero)); + node: Node( + uri: "$host:${node.port}", + type: WalletType.monero, + trusted: node.trusted ?? false)); await walletBase!.startSync(); await DB.instance .put(boxName: walletId, key: "id", value: _walletId); @@ -666,7 +669,10 @@ class MoneroWallet extends CoinServiceAPI { final node = await _getCurrentNode(); final host = Uri.parse(node.host).host; await walletBase!.connectToNode( - node: Node(uri: "$host:${node.port}", type: WalletType.monero)); + node: Node( + uri: "$host:${node.port}", + type: WalletType.monero, + trusted: node.trusted ?? false)); await walletBase!.rescan(height: credentials.height); walletBase!.close(); } catch (e, s) { @@ -775,7 +781,10 @@ class MoneroWallet extends CoinServiceAPI { final node = await _getCurrentNode(); final host = Uri.parse(node.host).host; await walletBase?.connectToNode( - node: Node(uri: "$host:${node.port}", type: WalletType.monero)); + node: Node( + uri: "$host:${node.port}", + type: WalletType.monero, + trusted: node.trusted ?? false)); } await walletBase?.startSync(); await refresh(); @@ -851,7 +860,10 @@ class MoneroWallet extends CoinServiceAPI { final host = Uri.parse(node.host).host; await walletBase?.connectToNode( - node: Node(uri: "$host:${node.port}", type: WalletType.monero)); + node: Node( + uri: "$host:${node.port}", + type: WalletType.monero, + trusted: node.trusted ?? false)); // TODO: is this sync call needed? Do we need to notify ui here? await walletBase?.startSync(); From 4ca0d919a9b873d140da01a0a5724b80a1af8309 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Fri, 6 Jan 2023 14:07:42 -0700 Subject: [PATCH 28/45] oledBlack images --- assets/svg/oledBlack/bell-new.svg | 5 +++++ assets/svg/oledBlack/buy-coins-icon.svg | 18 ++++++++++++++++++ assets/svg/oledBlack/exchange-2.svg | 11 +++++++++++ assets/svg/oledBlack/stack-icon1.svg | 5 +++++ .../svg/oledBlack/tx-exchange-icon-failed.svg | 14 ++++++++++++++ .../svg/oledBlack/tx-exchange-icon-pending.svg | 13 +++++++++++++ assets/svg/oledBlack/tx-exchange-icon.svg | 11 +++++++++++ .../svg/oledBlack/tx-icon-receive-failed.svg | 14 ++++++++++++++ .../svg/oledBlack/tx-icon-receive-pending.svg | 12 ++++++++++++ assets/svg/oledBlack/tx-icon-receive.svg | 11 +++++++++++ assets/svg/oledBlack/tx-icon-send-failed.svg | 14 ++++++++++++++ assets/svg/oledBlack/tx-icon-send-pending.svg | 13 +++++++++++++ assets/svg/oledBlack/tx-icon-send.svg | 11 +++++++++++ 13 files changed, 152 insertions(+) create mode 100644 assets/svg/oledBlack/bell-new.svg create mode 100644 assets/svg/oledBlack/buy-coins-icon.svg create mode 100644 assets/svg/oledBlack/exchange-2.svg create mode 100644 assets/svg/oledBlack/stack-icon1.svg create mode 100644 assets/svg/oledBlack/tx-exchange-icon-failed.svg create mode 100644 assets/svg/oledBlack/tx-exchange-icon-pending.svg create mode 100644 assets/svg/oledBlack/tx-exchange-icon.svg create mode 100644 assets/svg/oledBlack/tx-icon-receive-failed.svg create mode 100644 assets/svg/oledBlack/tx-icon-receive-pending.svg create mode 100644 assets/svg/oledBlack/tx-icon-receive.svg create mode 100644 assets/svg/oledBlack/tx-icon-send-failed.svg create mode 100644 assets/svg/oledBlack/tx-icon-send-pending.svg create mode 100644 assets/svg/oledBlack/tx-icon-send.svg diff --git a/assets/svg/oledBlack/bell-new.svg b/assets/svg/oledBlack/bell-new.svg new file mode 100644 index 000000000..f976e0986 --- /dev/null +++ b/assets/svg/oledBlack/bell-new.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/svg/oledBlack/buy-coins-icon.svg b/assets/svg/oledBlack/buy-coins-icon.svg new file mode 100644 index 000000000..9170c4190 --- /dev/null +++ b/assets/svg/oledBlack/buy-coins-icon.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/assets/svg/oledBlack/exchange-2.svg b/assets/svg/oledBlack/exchange-2.svg new file mode 100644 index 000000000..ee04dcebe --- /dev/null +++ b/assets/svg/oledBlack/exchange-2.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/svg/oledBlack/stack-icon1.svg b/assets/svg/oledBlack/stack-icon1.svg new file mode 100644 index 000000000..4fb16176a --- /dev/null +++ b/assets/svg/oledBlack/stack-icon1.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/svg/oledBlack/tx-exchange-icon-failed.svg b/assets/svg/oledBlack/tx-exchange-icon-failed.svg new file mode 100644 index 000000000..64acda4e9 --- /dev/null +++ b/assets/svg/oledBlack/tx-exchange-icon-failed.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/svg/oledBlack/tx-exchange-icon-pending.svg b/assets/svg/oledBlack/tx-exchange-icon-pending.svg new file mode 100644 index 000000000..f9cdeb7c2 --- /dev/null +++ b/assets/svg/oledBlack/tx-exchange-icon-pending.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/svg/oledBlack/tx-exchange-icon.svg b/assets/svg/oledBlack/tx-exchange-icon.svg new file mode 100644 index 000000000..36b2cf7cc --- /dev/null +++ b/assets/svg/oledBlack/tx-exchange-icon.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/svg/oledBlack/tx-icon-receive-failed.svg b/assets/svg/oledBlack/tx-icon-receive-failed.svg new file mode 100644 index 000000000..cb1d500b1 --- /dev/null +++ b/assets/svg/oledBlack/tx-icon-receive-failed.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/svg/oledBlack/tx-icon-receive-pending.svg b/assets/svg/oledBlack/tx-icon-receive-pending.svg new file mode 100644 index 000000000..efb8350b3 --- /dev/null +++ b/assets/svg/oledBlack/tx-icon-receive-pending.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/svg/oledBlack/tx-icon-receive.svg b/assets/svg/oledBlack/tx-icon-receive.svg new file mode 100644 index 000000000..15be19d52 --- /dev/null +++ b/assets/svg/oledBlack/tx-icon-receive.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/svg/oledBlack/tx-icon-send-failed.svg b/assets/svg/oledBlack/tx-icon-send-failed.svg new file mode 100644 index 000000000..2be637ef3 --- /dev/null +++ b/assets/svg/oledBlack/tx-icon-send-failed.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/svg/oledBlack/tx-icon-send-pending.svg b/assets/svg/oledBlack/tx-icon-send-pending.svg new file mode 100644 index 000000000..50cca5a9e --- /dev/null +++ b/assets/svg/oledBlack/tx-icon-send-pending.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/svg/oledBlack/tx-icon-send.svg b/assets/svg/oledBlack/tx-icon-send.svg new file mode 100644 index 000000000..0e64ee37e --- /dev/null +++ b/assets/svg/oledBlack/tx-icon-send.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + From 554d526ea4d852b805727c828e3bd389bb757616 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 6 Jan 2023 15:49:27 -0600 Subject: [PATCH 29/45] setPrimateNodeFor coin if edited node is primary node --- lib/services/node_service.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/services/node_service.dart b/lib/services/node_service.dart index ca1aae082..5124cf7b0 100644 --- a/lib/services/node_service.dart +++ b/lib/services/node_service.dart @@ -161,6 +161,17 @@ class NodeService extends ChangeNotifier { String? password, bool shouldNotifyListeners, ) async { + // check if the node being edited is the primary one; if it is, setPrimaryNodeFor coin + final coin = coinFromPrettyName(editedNode.coinName); + var primaryNode = getPrimaryNodeFor(coin: coin); + if (primaryNode?.id == editedNode.id) { + await setPrimaryNodeFor( + coin: coin, + node: editedNode, + shouldNotifyListeners: true, + ); + } + return add(editedNode, password, shouldNotifyListeners); } From b8c21b928756468928366a9feba3b5f5ef56efaa Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 6 Jan 2023 16:57:46 -0600 Subject: [PATCH 30/45] persist trusted flag across app closes --- lib/services/node_service.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/services/node_service.dart b/lib/services/node_service.dart index 5124cf7b0..2f3b8b836 100644 --- a/lib/services/node_service.dart +++ b/lib/services/node_service.dart @@ -33,11 +33,14 @@ class NodeService extends ChangeNotifier { ); } } else { - // update all fields but copy over previously set enabled state + // update all fields but copy over previously set enabled and trusted states await DB.instance.put( boxName: DB.boxNameNodeModels, key: savedNode.id, - value: defaultNode.copyWith(enabled: savedNode.enabled)); + value: defaultNode.copyWith( + enabled: savedNode.enabled, + trusted: savedNode.trusted, + )); } // check if a default node is the primary node for the crypto currency @@ -49,6 +52,7 @@ class NodeService extends ChangeNotifier { coin: coin, node: defaultNode.copyWith( enabled: primaryNode.enabled, + trusted: primaryNode.trusted, ), ); } From ca52bb8d59a866bec22eb18160e891fea2e3a983 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 6 Jan 2023 17:08:38 -0600 Subject: [PATCH 31/45] ref update: merge trusted node feature to flutter_libmonero#main --- crypto_plugins/flutter_libmonero | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto_plugins/flutter_libmonero b/crypto_plugins/flutter_libmonero index 37bda039f..d892955bf 160000 --- a/crypto_plugins/flutter_libmonero +++ b/crypto_plugins/flutter_libmonero @@ -1 +1 @@ -Subproject commit 37bda039f8cce636c4b6f4ad0ce52af9e25edfff +Subproject commit d892955bf7f4273855395091b9009243185d48f1 From a8d5301381c1d5b10aca08b84e069ea1ddd26c78 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 6 Jan 2023 17:10:05 -0600 Subject: [PATCH 32/45] trust monero and wownero default nodes --- lib/utilities/default_nodes.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utilities/default_nodes.dart b/lib/utilities/default_nodes.dart index 9072b75d0..744e83a97 100644 --- a/lib/utilities/default_nodes.dart +++ b/lib/utilities/default_nodes.dart @@ -108,7 +108,7 @@ abstract class DefaultNodes { coinName: Coin.monero.name, isFailover: true, isDown: false, - trusted: false, + trusted: true, ); static NodeModel get wownero => NodeModel( @@ -121,7 +121,7 @@ abstract class DefaultNodes { coinName: Coin.wownero.name, isFailover: true, isDown: false, - trusted: false, + trusted: true, ); static NodeModel get epicCash => NodeModel( From 7da4bc75f34c4d42e70486a4081fd9fcf38f9374 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 6 Jan 2023 17:10:17 -0600 Subject: [PATCH 33/45] persist isFailover settings changes across app closes --- lib/services/node_service.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/services/node_service.dart b/lib/services/node_service.dart index 2f3b8b836..8a0e17ad7 100644 --- a/lib/services/node_service.dart +++ b/lib/services/node_service.dart @@ -39,6 +39,7 @@ class NodeService extends ChangeNotifier { key: savedNode.id, value: defaultNode.copyWith( enabled: savedNode.enabled, + isFailover: savedNode.isFailover, trusted: savedNode.trusted, )); } @@ -52,6 +53,7 @@ class NodeService extends ChangeNotifier { coin: coin, node: defaultNode.copyWith( enabled: primaryNode.enabled, + isFailover: primaryNode.isFailover, trusted: primaryNode.trusted, ), ); From db23fcdbc274c51761123057044b4d2b6dff5563 Mon Sep 17 00:00:00 2001 From: Diego Salazar Date: Fri, 6 Jan 2023 17:25:22 -0700 Subject: [PATCH 34/45] Bump version number (1.5.28, build 102) --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index b6949e41d..9d6923934 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Stack Wallet # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.5.27+100 +version: 1.5.28+102 environment: sdk: ">=2.17.0 <3.0.0" From db2c7bb5abe524c4073879a51121f4cdf17d8963 Mon Sep 17 00:00:00 2001 From: Diego Salazar Date: Fri, 6 Jan 2023 17:31:28 -0700 Subject: [PATCH 35/45] Update ios version stuff --- ios/Runner.xcodeproj/project.pbxproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 2e5d4bac0..c935c514e 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -456,7 +456,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 83; + CURRENT_PROJECT_VERSION = 102; DEVELOPMENT_TEAM = 4DQKUWSG6C; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -510,7 +510,7 @@ "$(PROJECT_DIR)/../crypto_plugins/flutter_libmonero/cw_shared_external/ios/External/ios/**", "$(PROJECT_DIR)/../crypto_plugins/flutter_libepiccash/ios/libs", ); - MARKETING_VERSION = 1.5.11; + MARKETING_VERSION = 1.5.28; ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = com.cypherstack.stackwallet; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -643,7 +643,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 83; + CURRENT_PROJECT_VERSION = 102; DEVELOPMENT_TEAM = 4DQKUWSG6C; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -697,7 +697,7 @@ "$(PROJECT_DIR)/../crypto_plugins/flutter_libmonero/cw_shared_external/ios/External/ios/**", "$(PROJECT_DIR)/../crypto_plugins/flutter_libepiccash/ios/libs", ); - MARKETING_VERSION = 1.5.11; + MARKETING_VERSION = 1.5.28; ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = com.cypherstack.stackwallet; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -722,7 +722,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 83; + CURRENT_PROJECT_VERSION = 102; DEVELOPMENT_TEAM = 4DQKUWSG6C; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -776,7 +776,7 @@ "$(PROJECT_DIR)/../crypto_plugins/flutter_libmonero/cw_shared_external/ios/External/ios/**", "$(PROJECT_DIR)/../crypto_plugins/flutter_libepiccash/ios/libs", ); - MARKETING_VERSION = 1.5.11; + MARKETING_VERSION = 1.5.28; ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = com.cypherstack.stackwallet; PRODUCT_NAME = "$(TARGET_NAME)"; From 1d057a7f227725e89baedd73b45897f6f7ff75bc Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 9 Jan 2023 09:15:53 -0600 Subject: [PATCH 36/45] disable editing of default node fields --- .../add_edit_node_view.dart | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart index 7db6e5845..70e208ed5 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart @@ -671,7 +671,6 @@ class _NodeFormState extends ConsumerState { bool _trusted = false; int? port; late bool enableSSLCheckbox; - late bool trustedCheckbox; late final bool enableAuthFields; @@ -722,6 +721,9 @@ class _NodeFormState extends ConsumerState { return enable; } + bool get shouldBeReadOnly => + widget.readOnly || widget.node?.isDefault == true; + void _updateState() { port = int.tryParse(_portController.text); onChanged?.call(canSave, canTestConnection); @@ -775,11 +777,6 @@ class _NodeFormState extends ConsumerState { } else { enableSSLCheckbox = true; } - if (widget.coin == Coin.monero || widget.coin == Coin.wownero) { - trustedCheckbox = node.trusted ?? false; - } else { - trustedCheckbox = false; - } WidgetsBinding.instance.addPostFrameCallback((_) { // update provider state object so test connection works without having to modify a field in the ui first @@ -822,7 +819,7 @@ class _NodeFormState extends ConsumerState { autocorrect: Util.isDesktop ? false : true, enableSuggestions: Util.isDesktop ? false : true, key: const Key("addCustomNodeNodeNameFieldKey"), - readOnly: widget.readOnly, + readOnly: shouldBeReadOnly, enabled: enableField(_nameController), controller: _nameController, focusNode: _nameFocusNode, @@ -832,7 +829,7 @@ class _NodeFormState extends ConsumerState { _nameFocusNode, context, ).copyWith( - suffixIcon: !widget.readOnly && _nameController.text.isNotEmpty + suffixIcon: !shouldBeReadOnly && _nameController.text.isNotEmpty ? Padding( padding: const EdgeInsets.only(right: 0), child: UnconstrainedBox( @@ -868,7 +865,7 @@ class _NodeFormState extends ConsumerState { autocorrect: Util.isDesktop ? false : true, enableSuggestions: Util.isDesktop ? false : true, key: const Key("addCustomNodeNodeAddressFieldKey"), - readOnly: widget.readOnly, + readOnly: shouldBeReadOnly, enabled: enableField(_hostController), controller: _hostController, focusNode: _hostFocusNode, @@ -880,7 +877,7 @@ class _NodeFormState extends ConsumerState { _hostFocusNode, context, ).copyWith( - suffixIcon: !widget.readOnly && _hostController.text.isNotEmpty + suffixIcon: !shouldBeReadOnly && _hostController.text.isNotEmpty ? Padding( padding: const EdgeInsets.only(right: 0), child: UnconstrainedBox( @@ -927,7 +924,7 @@ class _NodeFormState extends ConsumerState { autocorrect: Util.isDesktop ? false : true, enableSuggestions: Util.isDesktop ? false : true, key: const Key("addCustomNodeNodePortFieldKey"), - readOnly: widget.readOnly, + readOnly: shouldBeReadOnly, enabled: enableField(_portController), controller: _portController, focusNode: _portFocusNode, @@ -939,7 +936,7 @@ class _NodeFormState extends ConsumerState { _portFocusNode, context, ).copyWith( - suffixIcon: !widget.readOnly && _portController.text.isNotEmpty + suffixIcon: !shouldBeReadOnly && _portController.text.isNotEmpty ? Padding( padding: const EdgeInsets.only(right: 0), child: UnconstrainedBox( @@ -976,7 +973,7 @@ class _NodeFormState extends ConsumerState { autocorrect: Util.isDesktop ? false : true, enableSuggestions: Util.isDesktop ? false : true, controller: _usernameController, - readOnly: widget.readOnly, + readOnly: shouldBeReadOnly, enabled: enableField(_usernameController), keyboardType: TextInputType.number, focusNode: _usernameFocusNode, @@ -987,7 +984,7 @@ class _NodeFormState extends ConsumerState { context, ).copyWith( suffixIcon: - !widget.readOnly && _usernameController.text.isNotEmpty + !shouldBeReadOnly && _usernameController.text.isNotEmpty ? Padding( padding: const EdgeInsets.only(right: 0), child: UnconstrainedBox( @@ -1025,7 +1022,7 @@ class _NodeFormState extends ConsumerState { autocorrect: Util.isDesktop ? false : true, enableSuggestions: Util.isDesktop ? false : true, controller: _passwordController, - readOnly: widget.readOnly, + readOnly: shouldBeReadOnly, enabled: enableField(_passwordController), keyboardType: TextInputType.number, focusNode: _passwordFocusNode, @@ -1036,7 +1033,7 @@ class _NodeFormState extends ConsumerState { context, ).copyWith( suffixIcon: - !widget.readOnly && _passwordController.text.isNotEmpty + !shouldBeReadOnly && _passwordController.text.isNotEmpty ? Padding( padding: const EdgeInsets.only(right: 0), child: UnconstrainedBox( @@ -1069,7 +1066,7 @@ class _NodeFormState extends ConsumerState { Row( children: [ GestureDetector( - onTap: !widget.readOnly && enableSSLCheckbox + onTap: !shouldBeReadOnly && enableSSLCheckbox ? () { setState(() { _useSSL = !_useSSL; @@ -1085,7 +1082,7 @@ class _NodeFormState extends ConsumerState { width: 20, height: 20, child: Checkbox( - fillColor: !widget.readOnly && enableSSLCheckbox + fillColor: !shouldBeReadOnly && enableSSLCheckbox ? null : MaterialStateProperty.all(Theme.of(context) .extension()! @@ -1093,7 +1090,7 @@ class _NodeFormState extends ConsumerState { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, value: _useSSL, - onChanged: !widget.readOnly && enableSSLCheckbox + onChanged: !shouldBeReadOnly && enableSSLCheckbox ? (newValue) { setState(() { _useSSL = newValue!; @@ -1136,7 +1133,7 @@ class _NodeFormState extends ConsumerState { width: 20, height: 20, child: Checkbox( - fillColor: !widget.readOnly /*&& trustedCheckbox*/ + fillColor: !widget.readOnly ? null : MaterialStateProperty.all(Theme.of(context) .extension()! @@ -1144,7 +1141,7 @@ class _NodeFormState extends ConsumerState { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, value: _trusted, - onChanged: !widget.readOnly /*&& trustedCheckbox*/ + onChanged: !widget.readOnly ? (newValue) { setState(() { _trusted = newValue!; From af698332e752438f19caa47a8bd86ab75acd7af1 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Tue, 10 Jan 2023 12:00:38 -0700 Subject: [PATCH 37/45] wallet nav bar and wallet card text colors fixed --- lib/utilities/theme/oled_black_colors.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/utilities/theme/oled_black_colors.dart b/lib/utilities/theme/oled_black_colors.dart index 102dc96f5..c54a42db9 100644 --- a/lib/utilities/theme/oled_black_colors.dart +++ b/lib/utilities/theme/oled_black_colors.dart @@ -51,9 +51,9 @@ class OledBlackColors extends StackColorTheme { @override Color get textSubtitle6 => const Color(0xFF878A8A); @override - Color get textWhite => const Color(0xFFDEDEDE); + Color get textWhite => const Color(0xFF242424); @override - Color get textFavoriteCard => const Color(0xFFDEDEDE); + Color get textFavoriteCard => const Color(0xFF232323); @override Color get textError => const Color(0xFFCF6679); @@ -76,7 +76,7 @@ class OledBlackColors extends StackColorTheme { @override Color get numpadBackDefault => const Color(0xFF6F9CE9); @override - Color get bottomNavBack => const Color(0xFFDEDEDE); + Color get bottomNavBack => const Color(0xFF202122); // button text/element @override @@ -195,6 +195,7 @@ class OledBlackColors extends StackColorTheme { Color get textFieldErrorBG => const Color(0xFF141414); @override Color get textFieldSuccessBG => const Color(0xFF141414); + //add border color vars here @override Color get textFieldActiveSearchIconLeft => const Color(0xFF9C9C9C); From a90f7fe9949a8e05ea2dd1d6c3b4734947293a27 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Tue, 10 Jan 2023 13:48:40 -0700 Subject: [PATCH 38/45] textFieldError/SuccessBorder added --- assets/svg/oledBlack/oled-black-theme.svg | 28 -------------------- lib/utilities/theme/color_theme.dart | 4 +++ lib/utilities/theme/dark_colors.dart | 4 +++ lib/utilities/theme/light_colors.dart | 4 +++ lib/utilities/theme/ocean_breeze_colors.dart | 4 +++ lib/utilities/theme/oled_black_colors.dart | 4 +++ lib/utilities/theme/stack_colors.dart | 21 +++++++++++++++ 7 files changed, 41 insertions(+), 28 deletions(-) delete mode 100644 assets/svg/oledBlack/oled-black-theme.svg diff --git a/assets/svg/oledBlack/oled-black-theme.svg b/assets/svg/oledBlack/oled-black-theme.svg deleted file mode 100644 index 70a14e115..000000000 --- a/assets/svg/oledBlack/oled-black-theme.svg +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/utilities/theme/color_theme.dart b/lib/utilities/theme/color_theme.dart index 94544ff11..c9853891f 100644 --- a/lib/utilities/theme/color_theme.dart +++ b/lib/utilities/theme/color_theme.dart @@ -7,6 +7,8 @@ import 'package:stackwallet/utilities/theme/oled_black_colors.dart'; enum ThemeType { light, dark, oceanBreeze, oledBlack } +// adjust this file + extension ThemeTypeExt on ThemeType { StackColorTheme get colorTheme { switch (this) { @@ -144,6 +146,8 @@ abstract class StackColorTheme { Color get textFieldDefaultBG; Color get textFieldErrorBG; Color get textFieldSuccessBG; + Color get textFieldErrorBorder; + Color get textFieldSuccessBorder; Color get textFieldActiveSearchIconLeft; Color get textFieldDefaultSearchIconLeft; Color get textFieldErrorSearchIconLeft; diff --git a/lib/utilities/theme/dark_colors.dart b/lib/utilities/theme/dark_colors.dart index d55581921..eae8fa5a8 100644 --- a/lib/utilities/theme/dark_colors.dart +++ b/lib/utilities/theme/dark_colors.dart @@ -194,6 +194,10 @@ class DarkColors extends StackColorTheme { Color get textFieldErrorBG => const Color(0xFFFFB4A9); @override Color get textFieldSuccessBG => const Color(0xFF8EF5C3); + @override + Color get textFieldErrorBorder => textFieldErrorBG; + @override + Color get textFieldSuccessBorder => textFieldSuccessBG; @override Color get textFieldActiveSearchIconLeft => const Color(0xFFA9ACAC); diff --git a/lib/utilities/theme/light_colors.dart b/lib/utilities/theme/light_colors.dart index 1303d0b75..27e1edd71 100644 --- a/lib/utilities/theme/light_colors.dart +++ b/lib/utilities/theme/light_colors.dart @@ -194,6 +194,10 @@ class LightColors extends StackColorTheme { Color get textFieldErrorBG => const Color(0xFFFFDAD4); @override Color get textFieldSuccessBG => const Color(0xFFB9E9D4); + @override + Color get textFieldErrorBorder => textFieldErrorBG; + @override + Color get textFieldSuccessBorder => textFieldSuccessBG; @override Color get textFieldActiveSearchIconLeft => const Color(0xFFA9ACAC); diff --git a/lib/utilities/theme/ocean_breeze_colors.dart b/lib/utilities/theme/ocean_breeze_colors.dart index 8c4259bb9..9e010dfd3 100644 --- a/lib/utilities/theme/ocean_breeze_colors.dart +++ b/lib/utilities/theme/ocean_breeze_colors.dart @@ -201,6 +201,10 @@ class OceanBreezeColors extends StackColorTheme { Color get textFieldErrorBG => const Color(0xFFF6C7C3); @override Color get textFieldSuccessBG => const Color(0xFFADD6D2); + @override + Color get textFieldErrorBorder => textFieldErrorBG; + @override + Color get textFieldSuccessBorder => textFieldSuccessBG; @override Color get textFieldActiveSearchIconLeft => const Color(0xFF86898C); diff --git a/lib/utilities/theme/oled_black_colors.dart b/lib/utilities/theme/oled_black_colors.dart index c54a42db9..41b43c3e6 100644 --- a/lib/utilities/theme/oled_black_colors.dart +++ b/lib/utilities/theme/oled_black_colors.dart @@ -196,6 +196,10 @@ class OledBlackColors extends StackColorTheme { @override Color get textFieldSuccessBG => const Color(0xFF141414); //add border color vars here + @override + Color get textFieldErrorBorder => const Color(0xFFCF6679); + @override + Color get textFieldSuccessBorder => const Color(0xFF23CFA1); @override Color get textFieldActiveSearchIconLeft => const Color(0xFF9C9C9C); diff --git a/lib/utilities/theme/stack_colors.dart b/lib/utilities/theme/stack_colors.dart index 9764128e4..9aaa6072d 100644 --- a/lib/utilities/theme/stack_colors.dart +++ b/lib/utilities/theme/stack_colors.dart @@ -110,6 +110,8 @@ class StackColors extends ThemeExtension { final Color textFieldDefaultBG; final Color textFieldErrorBG; final Color textFieldSuccessBG; + final Color textFieldErrorBorder; + final Color textFieldSuccessBorder; final Color textFieldActiveSearchIconLeft; final Color textFieldDefaultSearchIconLeft; final Color textFieldErrorSearchIconLeft; @@ -258,6 +260,8 @@ class StackColors extends ThemeExtension { required this.textFieldDefaultBG, required this.textFieldErrorBG, required this.textFieldSuccessBG, + required this.textFieldErrorBorder, + required this.textFieldSuccessBorder, required this.textFieldActiveSearchIconLeft, required this.textFieldDefaultSearchIconLeft, required this.textFieldErrorSearchIconLeft, @@ -394,6 +398,8 @@ class StackColors extends ThemeExtension { textFieldDefaultBG: colorTheme.textFieldDefaultBG, textFieldErrorBG: colorTheme.textFieldErrorBG, textFieldSuccessBG: colorTheme.textFieldSuccessBG, + textFieldErrorBorder: colorTheme.textFieldErrorBorder, + textFieldSuccessBorder: colorTheme.textFieldSuccessBorder, textFieldActiveSearchIconLeft: colorTheme.textFieldActiveSearchIconLeft, textFieldDefaultSearchIconLeft: colorTheme.textFieldDefaultSearchIconLeft, textFieldErrorSearchIconLeft: colorTheme.textFieldErrorSearchIconLeft, @@ -533,6 +539,8 @@ class StackColors extends ThemeExtension { Color? textFieldDefaultBG, Color? textFieldErrorBG, Color? textFieldSuccessBG, + Color? textFieldErrorBorder, + Color? textFieldSuccessBorder, Color? textFieldActiveSearchIconLeft, Color? textFieldDefaultSearchIconLeft, Color? textFieldErrorSearchIconLeft, @@ -679,6 +687,9 @@ class StackColors extends ThemeExtension { textFieldDefaultBG: textFieldDefaultBG ?? this.textFieldDefaultBG, textFieldErrorBG: textFieldErrorBG ?? this.textFieldErrorBG, textFieldSuccessBG: textFieldSuccessBG ?? this.textFieldSuccessBG, + textFieldErrorBorder: textFieldErrorBorder ?? this.textFieldErrorBorder, + textFieldSuccessBorder: + textFieldSuccessBorder ?? this.textFieldSuccessBorder, textFieldActiveSearchIconLeft: textFieldActiveSearchIconLeft ?? this.textFieldActiveSearchIconLeft, textFieldDefaultSearchIconLeft: @@ -1177,6 +1188,16 @@ class StackColors extends ThemeExtension { other.textFieldSuccessBG, t, )!, + textFieldErrorBorder: Color.lerp( + textFieldErrorBorder, + other.textFieldErrorBorder, + t, + )!, + textFieldSuccessBorder: Color.lerp( + textFieldSuccessBorder, + other.textFieldSuccessBorder, + t, + )!, textFieldActiveSearchIconLeft: Color.lerp( textFieldActiveSearchIconLeft, other.textFieldActiveSearchIconLeft, From 9f5ce0db7aeca057938faed9b5d0aacee69e7f1a Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Tue, 10 Jan 2023 15:28:59 -0700 Subject: [PATCH 39/45] textRestore added for color fix --- .../restore_wallet_view.dart | 21 ++++++++++++------- lib/utilities/theme/color_theme.dart | 1 + lib/utilities/theme/dark_colors.dart | 2 ++ lib/utilities/theme/light_colors.dart | 2 ++ lib/utilities/theme/ocean_breeze_colors.dart | 2 ++ lib/utilities/theme/oled_black_colors.dart | 2 ++ lib/utilities/theme/stack_colors.dart | 10 +++++++++ 7 files changed, 33 insertions(+), 7 deletions(-) diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart index bb2628192..44a00083f 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart @@ -373,17 +373,22 @@ class _RestoreWalletViewState extends ConsumerState { FormInputStatus status, String prefix) { Color color; Color prefixColor; + Color borderColor; Widget? suffixIcon; switch (status) { case FormInputStatus.empty: color = Theme.of(context).extension()!.textFieldDefaultBG; prefixColor = Theme.of(context).extension()!.textSubtitle2; + borderColor = + Theme.of(context).extension()!.textFieldDefaultBG; break; case FormInputStatus.invalid: color = Theme.of(context).extension()!.textFieldErrorBG; prefixColor = Theme.of(context) .extension()! .textFieldErrorSearchIconLeft; + borderColor = + Theme.of(context).extension()!.textFieldErrorBorder; suffixIcon = SvgPicture.asset( Assets.svg.alertCircle, width: 16, @@ -398,6 +403,8 @@ class _RestoreWalletViewState extends ConsumerState { prefixColor = Theme.of(context) .extension()! .textFieldSuccessSearchIconLeft; + borderColor = + Theme.of(context).extension()!.textFieldSuccessBorder; suffixIcon = SvgPicture.asset( Assets.svg.checkCircle, width: 16, @@ -449,11 +456,11 @@ class _RestoreWalletViewState extends ConsumerState { child: suffixIcon, ), ), - enabledBorder: _buildOutlineInputBorder(color), - focusedBorder: _buildOutlineInputBorder(color), - errorBorder: _buildOutlineInputBorder(color), - disabledBorder: _buildOutlineInputBorder(color), - focusedErrorBorder: _buildOutlineInputBorder(color), + enabledBorder: _buildOutlineInputBorder(borderColor), + focusedBorder: _buildOutlineInputBorder(borderColor), + errorBorder: _buildOutlineInputBorder(borderColor), + disabledBorder: _buildOutlineInputBorder(borderColor), + focusedErrorBorder: _buildOutlineInputBorder(borderColor), ); } @@ -786,7 +793,7 @@ class _RestoreWalletViewState extends ConsumerState { .copyWith( color: Theme.of(context) .extension()! - .overlay, + .textRestore, fontSize: isDesktop ? 16 : 14, ), ), @@ -993,7 +1000,7 @@ class _RestoreWalletViewState extends ConsumerState { STextStyles.field(context).copyWith( color: Theme.of(context) .extension()! - .overlay, + .textRestore, fontSize: isDesktop ? 16 : 14, ), ), diff --git a/lib/utilities/theme/color_theme.dart b/lib/utilities/theme/color_theme.dart index c9853891f..8e85a69c1 100644 --- a/lib/utilities/theme/color_theme.dart +++ b/lib/utilities/theme/color_theme.dart @@ -68,6 +68,7 @@ abstract class StackColorTheme { Color get textWhite; Color get textFavoriteCard; Color get textError; + Color get textRestore; // button background Color get buttonBackPrimary; diff --git a/lib/utilities/theme/dark_colors.dart b/lib/utilities/theme/dark_colors.dart index eae8fa5a8..9e3a625c1 100644 --- a/lib/utilities/theme/dark_colors.dart +++ b/lib/utilities/theme/dark_colors.dart @@ -55,6 +55,8 @@ class DarkColors extends StackColorTheme { Color get textFavoriteCard => const Color(0xFF232323); @override Color get textError => const Color(0xFFF37475); + @override + Color get textRestore => overlay; // button background @override diff --git a/lib/utilities/theme/light_colors.dart b/lib/utilities/theme/light_colors.dart index 27e1edd71..ef59ed622 100644 --- a/lib/utilities/theme/light_colors.dart +++ b/lib/utilities/theme/light_colors.dart @@ -55,6 +55,8 @@ class LightColors extends StackColorTheme { Color get textFavoriteCard => const Color(0xFF232323); @override Color get textError => const Color(0xFF930006); + @override + Color get textRestore => overlay; // button background @override diff --git a/lib/utilities/theme/ocean_breeze_colors.dart b/lib/utilities/theme/ocean_breeze_colors.dart index 9e010dfd3..8bc9dab52 100644 --- a/lib/utilities/theme/ocean_breeze_colors.dart +++ b/lib/utilities/theme/ocean_breeze_colors.dart @@ -62,6 +62,8 @@ class OceanBreezeColors extends StackColorTheme { Color get textFavoriteCard => const Color(0xFF232323); @override Color get textError => const Color(0xFF8D0006); + @override + Color get textRestore => overlay; // button background @override diff --git a/lib/utilities/theme/oled_black_colors.dart b/lib/utilities/theme/oled_black_colors.dart index 41b43c3e6..5a878d7c6 100644 --- a/lib/utilities/theme/oled_black_colors.dart +++ b/lib/utilities/theme/oled_black_colors.dart @@ -56,6 +56,8 @@ class OledBlackColors extends StackColorTheme { Color get textFavoriteCard => const Color(0xFF232323); @override Color get textError => const Color(0xFFCF6679); + @override + Color get textRestore => textDark; // button background @override diff --git a/lib/utilities/theme/stack_colors.dart b/lib/utilities/theme/stack_colors.dart index 9aaa6072d..b47e93128 100644 --- a/lib/utilities/theme/stack_colors.dart +++ b/lib/utilities/theme/stack_colors.dart @@ -32,6 +32,7 @@ class StackColors extends ThemeExtension { final Color textWhite; final Color textFavoriteCard; final Color textError; + final Color textRestore; // button background final Color buttonBackPrimary; @@ -200,6 +201,7 @@ class StackColors extends ThemeExtension { required this.textWhite, required this.textFavoriteCard, required this.textError, + required this.textRestore, required this.buttonBackPrimary, required this.buttonBackSecondary, required this.buttonBackPrimaryDisabled, @@ -338,6 +340,7 @@ class StackColors extends ThemeExtension { textWhite: colorTheme.textWhite, textFavoriteCard: colorTheme.textFavoriteCard, textError: colorTheme.textError, + textRestore: colorTheme.textRestore, buttonBackPrimary: colorTheme.buttonBackPrimary, buttonBackSecondary: colorTheme.buttonBackSecondary, buttonBackPrimaryDisabled: colorTheme.buttonBackPrimaryDisabled, @@ -479,6 +482,7 @@ class StackColors extends ThemeExtension { Color? textWhite, Color? textFavoriteCard, Color? textError, + Color? textRestore, Color? buttonBackPrimary, Color? buttonBackSecondary, Color? buttonBackPrimaryDisabled, @@ -615,6 +619,7 @@ class StackColors extends ThemeExtension { textWhite: textWhite ?? this.textWhite, textFavoriteCard: textFavoriteCard ?? this.textFavoriteCard, textError: textError ?? this.textError, + textRestore: textRestore ?? this.textRestore, buttonBackPrimary: buttonBackPrimary ?? this.buttonBackPrimary, buttonBackSecondary: buttonBackSecondary ?? this.buttonBackSecondary, buttonBackPrimaryDisabled: @@ -888,6 +893,11 @@ class StackColors extends ThemeExtension { other.textError, t, )!, + textRestore: Color.lerp( + textRestore, + other.textRestore, + t, + )!, buttonBackPrimary: Color.lerp( buttonBackPrimary, other.buttonBackPrimary, From 720a698814b02f56e8c0536a3adf302da07e4bfc Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Thu, 12 Jan 2023 09:30:34 -0700 Subject: [PATCH 40/45] theme selector fix --- assets/svg/oled-black-theme.svg | 6 +----- assets/svg/oled-black.svg | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 assets/svg/oled-black.svg diff --git a/assets/svg/oled-black-theme.svg b/assets/svg/oled-black-theme.svg index 70a14e115..27cd50638 100644 --- a/assets/svg/oled-black-theme.svg +++ b/assets/svg/oled-black-theme.svg @@ -1,6 +1,6 @@ - + @@ -17,10 +17,6 @@ - - - - diff --git a/assets/svg/oled-black.svg b/assets/svg/oled-black.svg new file mode 100644 index 000000000..98b67ae6c --- /dev/null +++ b/assets/svg/oled-black.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + From e38f860f2ba8e1c32baafdcf51c72af19381bf89 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 12 Jan 2023 10:47:55 -0600 Subject: [PATCH 41/45] ref update: update fix-armv7a-compile -> v0.10.2.0 --- crypto_plugins/flutter_libmonero | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto_plugins/flutter_libmonero b/crypto_plugins/flutter_libmonero index d892955bf..3aff42511 160000 --- a/crypto_plugins/flutter_libmonero +++ b/crypto_plugins/flutter_libmonero @@ -1 +1 @@ -Subproject commit d892955bf7f4273855395091b9009243185d48f1 +Subproject commit 3aff42511ec8107163a3d1e0b42f2c83c21f6896 From 3b9cb60aaa6007650933a5459c43b1d594a54b96 Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 20 Jan 2023 15:32:49 -0600 Subject: [PATCH 42/45] update text styles --- lib/utilities/text_styles.dart | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/utilities/text_styles.dart b/lib/utilities/text_styles.dart index 00492b478..66decfc50 100644 --- a/lib/utilities/text_styles.dart +++ b/lib/utilities/text_styles.dart @@ -27,6 +27,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 12, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark3, + fontWeight: FontWeight.w500, + fontSize: 12, + ); } } @@ -787,6 +793,12 @@ class STextStyles { fontWeight: FontWeight.w500, fontSize: 12, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 12, + ); } } @@ -1030,6 +1042,13 @@ class STextStyles { fontSize: 24, height: 24 / 24, ); + case ThemeType.oledBlack: + return GoogleFonts.inter( + color: _theme(context).textDark, + fontWeight: FontWeight.w500, + fontSize: 24, + height: 24 / 24, + ); } } From 017719971b08cc8aac335d8203b119743d48640a Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 20 Jan 2023 15:57:54 -0600 Subject: [PATCH 43/45] isar init fix and renaming of init functions --- lib/db/main_db.dart | 4 +- lib/main.dart | 2 +- .../coins/bitcoin/bitcoin_wallet.dart | 2 +- .../coins/bitcoincash/bitcoincash_wallet.dart | 2 +- .../coins/dogecoin/dogecoin_wallet.dart | 2 +- .../coins/epiccash/epiccash_wallet.dart | 2 +- lib/services/coins/firo/firo_wallet.dart | 2 +- .../coins/litecoin/litecoin_wallet.dart | 2 +- lib/services/coins/monero/monero_wallet.dart | 2 +- .../coins/namecoin/namecoin_wallet.dart | 2 +- .../coins/particl/particl_wallet.dart | 2 +- .../coins/wownero/wownero_wallet.dart | 2 +- lib/services/mixins/wallet_db.dart | 2 +- lib/utilities/db_version_migration.dart | 4 +- pubspec.lock | 45 ++++++++----------- .../pages/send_view/send_view_test.mocks.dart | 4 +- test/services/coins/manager_test.mocks.dart | 4 +- .../managed_favorite_test.mocks.dart | 4 +- .../table_view/table_view_row_test.mocks.dart | 4 +- .../transaction_card_test.mocks.dart | 4 +- test/widget_tests/wallet_card_test.mocks.dart | 4 +- ...et_info_row_balance_future_test.mocks.dart | 4 +- .../wallet_info_row_test.mocks.dart | 4 +- 23 files changed, 52 insertions(+), 57 deletions(-) diff --git a/lib/db/main_db.dart b/lib/db/main_db.dart index be937b411..413951e37 100644 --- a/lib/db/main_db.dart +++ b/lib/db/main_db.dart @@ -12,7 +12,7 @@ class MainDB { Isar get isar => _isar!; - Future isarInit({Isar? mock}) async { + Future initMainDB({Isar? mock}) async { if (mock != null) { _isar = mock; return true; @@ -28,7 +28,7 @@ class MainDB { AddressSchema, ], directory: (await StackFileSystem.applicationIsarDirectory()).path, - inspector: true, + inspector: false, name: "wallet_data", ); return true; diff --git a/lib/main.dart b/lib/main.dart index 59a1520d2..ba6757259 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -265,7 +265,7 @@ class _MaterialAppWithThemeState extends ConsumerState await loadShared(); } - await MainDB.instance.isarInit(); + await MainDB.instance.initMainDB(); _notificationsService = ref.read(notificationsProvider); _nodeService = ref.read(nodeServiceChangeNotifierProvider); diff --git a/lib/services/coins/bitcoin/bitcoin_wallet.dart b/lib/services/coins/bitcoin/bitcoin_wallet.dart index b3ea2485f..55b17d837 100644 --- a/lib/services/coins/bitcoin/bitcoin_wallet.dart +++ b/lib/services/coins/bitcoin/bitcoin_wallet.dart @@ -1257,7 +1257,7 @@ class BitcoinWallet extends CoinServiceAPI with WalletCache, WalletDB { _cachedElectrumXClient = cachedClient; _secureStore = secureStore; initCache(walletId, coin); - isarInit(mockableOverride: mockableOverride); + initWalletDB(mockableOverride: mockableOverride); } @override diff --git a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart index b5338c443..1a6587e6b 100644 --- a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart +++ b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart @@ -1214,7 +1214,7 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB { _cachedElectrumXClient = cachedClient; _secureStore = secureStore; initCache(walletId, coin); - isarInit(mockableOverride: mockableOverride); + initWalletDB(mockableOverride: mockableOverride); } @override diff --git a/lib/services/coins/dogecoin/dogecoin_wallet.dart b/lib/services/coins/dogecoin/dogecoin_wallet.dart index 9fc5d2f04..e13c3673a 100644 --- a/lib/services/coins/dogecoin/dogecoin_wallet.dart +++ b/lib/services/coins/dogecoin/dogecoin_wallet.dart @@ -1092,7 +1092,7 @@ class DogecoinWallet extends CoinServiceAPI with WalletCache, WalletDB { _cachedElectrumXClient = cachedClient; _secureStore = secureStore; initCache(walletId, coin); - isarInit(mockableOverride: mockableOverride); + initWalletDB(mockableOverride: mockableOverride); } @override diff --git a/lib/services/coins/epiccash/epiccash_wallet.dart b/lib/services/coins/epiccash/epiccash_wallet.dart index 3e569d0ea..86ed2979b 100644 --- a/lib/services/coins/epiccash/epiccash_wallet.dart +++ b/lib/services/coins/epiccash/epiccash_wallet.dart @@ -542,7 +542,7 @@ class EpicCashWallet extends CoinServiceAPI _secureStore = secureStore; initCache(walletId, coin); initEpicCashHive(walletId); - isarInit(mockableOverride: mockableOverride); + initWalletDB(mockableOverride: mockableOverride); Logging.instance.log("$walletName isolate length: ${isolates.length}", level: LogLevel.Info); diff --git a/lib/services/coins/firo/firo_wallet.dart b/lib/services/coins/firo/firo_wallet.dart index dcb4153a7..0962e6fdc 100644 --- a/lib/services/coins/firo/firo_wallet.dart +++ b/lib/services/coins/firo/firo_wallet.dart @@ -1225,7 +1225,7 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive { _secureStore = secureStore; initCache(walletId, coin); initFiroHive(walletId); - isarInit(mockableOverride: mockableOverride); + initWalletDB(mockableOverride: mockableOverride); Logging.instance.log("$walletName isolates length: ${isolates.length}", level: LogLevel.Info); diff --git a/lib/services/coins/litecoin/litecoin_wallet.dart b/lib/services/coins/litecoin/litecoin_wallet.dart index 25e963b4b..f248aa0a0 100644 --- a/lib/services/coins/litecoin/litecoin_wallet.dart +++ b/lib/services/coins/litecoin/litecoin_wallet.dart @@ -1275,7 +1275,7 @@ class LitecoinWallet extends CoinServiceAPI with WalletCache, WalletDB { _cachedElectrumXClient = cachedClient; _secureStore = secureStore; initCache(walletId, coin); - isarInit(mockableOverride: mockableOverride); + initWalletDB(mockableOverride: mockableOverride); } @override diff --git a/lib/services/coins/monero/monero_wallet.dart b/lib/services/coins/monero/monero_wallet.dart index 48bcfc2ed..61ea7c8d1 100644 --- a/lib/services/coins/monero/monero_wallet.dart +++ b/lib/services/coins/monero/monero_wallet.dart @@ -92,7 +92,7 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { _secureStorage = secureStorage; _prefs = prefs ?? Prefs.instance; initCache(walletId, coin); - isarInit(mockableOverride: mockableOverride); + initWalletDB(mockableOverride: mockableOverride); } @override diff --git a/lib/services/coins/namecoin/namecoin_wallet.dart b/lib/services/coins/namecoin/namecoin_wallet.dart index 34728bcc3..b9968f6c0 100644 --- a/lib/services/coins/namecoin/namecoin_wallet.dart +++ b/lib/services/coins/namecoin/namecoin_wallet.dart @@ -1264,7 +1264,7 @@ class NamecoinWallet extends CoinServiceAPI with WalletCache, WalletDB { _cachedElectrumXClient = cachedClient; _secureStore = secureStore; initCache(walletId, coin); - isarInit(mockableOverride: mockableOverride); + initWalletDB(mockableOverride: mockableOverride); } @override diff --git a/lib/services/coins/particl/particl_wallet.dart b/lib/services/coins/particl/particl_wallet.dart index c4afcd1ed..e705a6178 100644 --- a/lib/services/coins/particl/particl_wallet.dart +++ b/lib/services/coins/particl/particl_wallet.dart @@ -1195,7 +1195,7 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB { _cachedElectrumXClient = cachedClient; _secureStore = secureStore; initCache(walletId, coin); - isarInit(mockableOverride: mockableOverride); + initWalletDB(mockableOverride: mockableOverride); } @override diff --git a/lib/services/coins/wownero/wownero_wallet.dart b/lib/services/coins/wownero/wownero_wallet.dart index 8cf873b3b..81b7e2fa1 100644 --- a/lib/services/coins/wownero/wownero_wallet.dart +++ b/lib/services/coins/wownero/wownero_wallet.dart @@ -94,7 +94,7 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB { _secureStorage = secureStorage; _prefs = prefs ?? Prefs.instance; initCache(walletId, coin); - isarInit(mockableOverride: mockableOverride); + initWalletDB(mockableOverride: mockableOverride); } @override diff --git a/lib/services/mixins/wallet_db.dart b/lib/services/mixins/wallet_db.dart index c1e02c9a2..cf62cf6da 100644 --- a/lib/services/mixins/wallet_db.dart +++ b/lib/services/mixins/wallet_db.dart @@ -4,7 +4,7 @@ mixin WalletDB { MainDB? _db; MainDB get db => _db!; - void isarInit({MainDB? mockableOverride}) async { + void initWalletDB({MainDB? mockableOverride}) async { _db = mockableOverride ?? MainDB.instance; } } diff --git a/lib/utilities/db_version_migration.dart b/lib/utilities/db_version_migration.dart index 9562f168c..eab9a8966 100644 --- a/lib/utilities/db_version_migration.dart +++ b/lib/utilities/db_version_migration.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:hive/hive.dart'; +import 'package:stackwallet/db/main_db.dart'; import 'package:stackwallet/electrumx_rpc/electrumx.dart'; import 'package:stackwallet/hive/db.dart'; import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart'; @@ -403,7 +404,8 @@ class DbVersionMigrator with WalletDB { _parseTransactions(txnsLelantus, walletId, true, newAddresses)); // store newly parsed data in isar - isarInit(); + await MainDB.instance.initMainDB(); + initWalletDB(); await db.isar.writeTxn(() async { await db.isar.addresses.putAll(newAddresses); }); diff --git a/pubspec.lock b/pubspec.lock index 1d66703e2..c6e2a2019 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -42,7 +42,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.11" + version: "3.3.0" args: dependency: transitive description: @@ -63,7 +63,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" barcode_scan2: dependency: "direct main" description: @@ -199,14 +199,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" checked_yaml: dependency: transitive description: @@ -227,7 +220,7 @@ packages: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" code_builder: dependency: transitive description: @@ -297,7 +290,7 @@ packages: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.5.0" cross_file: dependency: transitive description: @@ -472,7 +465,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" ffi: dependency: "direct main" description: @@ -901,21 +894,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" mime: dependency: transitive description: @@ -1027,7 +1020,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" path_drawing: dependency: transitive description: @@ -1403,7 +1396,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -1447,7 +1440,7 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" string_validator: dependency: "direct main" description: @@ -1461,35 +1454,35 @@ packages: name: sync_http url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.3.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test: dependency: transitive description: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.21.1" + version: "1.21.4" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.12" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.4.13" + version: "0.4.16" time: dependency: transitive description: @@ -1538,7 +1531,7 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" universal_io: dependency: transitive description: @@ -1622,7 +1615,7 @@ packages: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "8.2.2" + version: "9.0.0" wakelock: dependency: "direct main" description: diff --git a/test/pages/send_view/send_view_test.mocks.dart b/test/pages/send_view/send_view_test.mocks.dart index 1fd95c2a2..bcd5f44fc 100644 --- a/test/pages/send_view/send_view_test.mocks.dart +++ b/test/pages/send_view/send_view_test.mocks.dart @@ -1557,9 +1557,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i21.BitcoinWallet { returnValueForMissingStub: _i17.Future.value(), ) as _i17.Future); @override - void isarInit({_i13.MainDB? mockableOverride}) => super.noSuchMethod( + void initWalletDB({_i13.MainDB? mockableOverride}) => super.noSuchMethod( Invocation.method( - #isarInit, + #initWalletDB, [], {#mockableOverride: mockableOverride}, ), diff --git a/test/services/coins/manager_test.mocks.dart b/test/services/coins/manager_test.mocks.dart index 71a77970e..af988ae76 100644 --- a/test/services/coins/manager_test.mocks.dart +++ b/test/services/coins/manager_test.mocks.dart @@ -977,9 +977,9 @@ class MockFiroWallet extends _i1.Mock implements _i9.FiroWallet { returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override - void isarInit({_i7.MainDB? mockableOverride}) => super.noSuchMethod( + void initWalletDB({_i7.MainDB? mockableOverride}) => super.noSuchMethod( Invocation.method( - #isarInit, + #initWalletDB, [], {#mockableOverride: mockableOverride}, ), diff --git a/test/widget_tests/managed_favorite_test.mocks.dart b/test/widget_tests/managed_favorite_test.mocks.dart index 15213e274..a5ee69930 100644 --- a/test/widget_tests/managed_favorite_test.mocks.dart +++ b/test/widget_tests/managed_favorite_test.mocks.dart @@ -1347,9 +1347,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i20.BitcoinWallet { returnValueForMissingStub: _i17.Future.value(), ) as _i17.Future); @override - void isarInit({_i12.MainDB? mockableOverride}) => super.noSuchMethod( + void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod( Invocation.method( - #isarInit, + #initWalletDB, [], {#mockableOverride: mockableOverride}, ), diff --git a/test/widget_tests/table_view/table_view_row_test.mocks.dart b/test/widget_tests/table_view/table_view_row_test.mocks.dart index e549bfe09..d31019d37 100644 --- a/test/widget_tests/table_view/table_view_row_test.mocks.dart +++ b/test/widget_tests/table_view/table_view_row_test.mocks.dart @@ -1332,9 +1332,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i19.BitcoinWallet { returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); @override - void isarInit({_i12.MainDB? mockableOverride}) => super.noSuchMethod( + void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod( Invocation.method( - #isarInit, + #initWalletDB, [], {#mockableOverride: mockableOverride}, ), diff --git a/test/widget_tests/transaction_card_test.mocks.dart b/test/widget_tests/transaction_card_test.mocks.dart index 185b84c60..c3b2cce4b 100644 --- a/test/widget_tests/transaction_card_test.mocks.dart +++ b/test/widget_tests/transaction_card_test.mocks.dart @@ -1891,9 +1891,9 @@ class MockFiroWallet extends _i1.Mock implements _i22.FiroWallet { returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override - void isarInit({_i13.MainDB? mockableOverride}) => super.noSuchMethod( + void initWalletDB({_i13.MainDB? mockableOverride}) => super.noSuchMethod( Invocation.method( - #isarInit, + #initWalletDB, [], {#mockableOverride: mockableOverride}, ), diff --git a/test/widget_tests/wallet_card_test.mocks.dart b/test/widget_tests/wallet_card_test.mocks.dart index fc4e5bb8b..5a5d048b3 100644 --- a/test/widget_tests/wallet_card_test.mocks.dart +++ b/test/widget_tests/wallet_card_test.mocks.dart @@ -1095,9 +1095,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i18.BitcoinWallet { returnValueForMissingStub: _i15.Future.value(), ) as _i15.Future); @override - void isarInit({_i12.MainDB? mockableOverride}) => super.noSuchMethod( + void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod( Invocation.method( - #isarInit, + #initWalletDB, [], {#mockableOverride: mockableOverride}, ), diff --git a/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart b/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart index 67354fe01..41f874146 100644 --- a/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart +++ b/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart @@ -1346,9 +1346,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i20.BitcoinWallet { returnValueForMissingStub: _i17.Future.value(), ) as _i17.Future); @override - void isarInit({_i12.MainDB? mockableOverride}) => super.noSuchMethod( + void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod( Invocation.method( - #isarInit, + #initWalletDB, [], {#mockableOverride: mockableOverride}, ), diff --git a/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart b/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart index 21b8cb10f..3e88ef129 100644 --- a/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart +++ b/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart @@ -1346,9 +1346,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i20.BitcoinWallet { returnValueForMissingStub: _i17.Future.value(), ) as _i17.Future); @override - void isarInit({_i12.MainDB? mockableOverride}) => super.noSuchMethod( + void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod( Invocation.method( - #isarInit, + #initWalletDB, [], {#mockableOverride: mockableOverride}, ), From a391a76eec1768bae0cba3d171efd9e670b26a1f Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 20 Jan 2023 16:24:33 -0600 Subject: [PATCH 44/45] trusted nodes fix and possibly other node fix --- lib/services/coins/monero/monero_wallet.dart | 28 ++++++++++++++++--- .../coins/wownero/wownero_wallet.dart | 28 ++++++++++++++++--- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/lib/services/coins/monero/monero_wallet.dart b/lib/services/coins/monero/monero_wallet.dart index 61ea7c8d1..ee3807163 100644 --- a/lib/services/coins/monero/monero_wallet.dart +++ b/lib/services/coins/monero/monero_wallet.dart @@ -381,7 +381,12 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { final node = await _getCurrentNode(); final host = Uri.parse(node.host).host; await walletBase!.connectToNode( - node: Node(uri: "$host:${node.port}", type: WalletType.monero)); + node: Node( + uri: "$host:${node.port}", + type: WalletType.monero, + trusted: node.trusted ?? false, + ), + ); await walletBase!.startSync(); await Future.wait([ @@ -603,7 +608,12 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { final node = await _getCurrentNode(); final host = Uri.parse(node.host).host; await walletBase!.connectToNode( - node: Node(uri: "$host:${node.port}", type: WalletType.monero)); + node: Node( + uri: "$host:${node.port}", + type: WalletType.monero, + trusted: node.trusted ?? false, + ), + ); await walletBase!.rescan(height: credentials.height); walletBase!.close(); } catch (e, s) { @@ -690,7 +700,12 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { final node = await _getCurrentNode(); final host = Uri.parse(node.host).host; await walletBase?.connectToNode( - node: Node(uri: "$host:${node.port}", type: WalletType.monero)); + node: Node( + uri: "$host:${node.port}", + type: WalletType.monero, + trusted: node.trusted ?? false, + ), + ); } await walletBase?.startSync(); await refresh(); @@ -782,7 +797,12 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { final host = Uri.parse(node.host).host; await walletBase?.connectToNode( - node: Node(uri: "$host:${node.port}", type: WalletType.monero)); + node: Node( + uri: "$host:${node.port}", + type: WalletType.monero, + trusted: node.trusted ?? false, + ), + ); // TODO: is this sync call needed? Do we need to notify ui here? await walletBase?.startSync(); diff --git a/lib/services/coins/wownero/wownero_wallet.dart b/lib/services/coins/wownero/wownero_wallet.dart index 81b7e2fa1..d471208cd 100644 --- a/lib/services/coins/wownero/wownero_wallet.dart +++ b/lib/services/coins/wownero/wownero_wallet.dart @@ -389,7 +389,12 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB { final node = await _getCurrentNode(); final host = Uri.parse(node.host).host; await walletBase?.connectToNode( - node: Node(uri: "$host:${node.port}", type: WalletType.wownero)); + node: Node( + uri: "$host:${node.port}", + type: WalletType.wownero, + trusted: node.trusted ?? false, + ), + ); await walletBase?.startSync(); await Future.wait([ updateCachedId(walletId), @@ -614,7 +619,12 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB { final node = await _getCurrentNode(); final host = Uri.parse(node.host).host; await walletBase?.connectToNode( - node: Node(uri: "$host:${node.port}", type: WalletType.wownero)); + node: Node( + uri: "$host:${node.port}", + type: WalletType.wownero, + trusted: node.trusted ?? false, + ), + ); await walletBase?.rescan(height: credentials.height); walletBase?.close(); } catch (e, s) { @@ -701,7 +711,12 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB { final node = await _getCurrentNode(); final host = Uri.parse(node.host).host; await walletBase?.connectToNode( - node: Node(uri: "$host:${node.port}", type: WalletType.monero)); + node: Node( + uri: "$host:${node.port}", + type: WalletType.wownero, + trusted: node.trusted ?? false, + ), + ); } await walletBase?.startSync(); await refresh(); @@ -790,7 +805,12 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB { final host = Uri.parse(node.host).host; await walletBase?.connectToNode( - node: Node(uri: "$host:${node.port}", type: WalletType.monero)); + node: Node( + uri: "$host:${node.port}", + type: WalletType.wownero, + trusted: node.trusted ?? false, + ), + ); // TODO: is this sync call needed? Do we need to notify ui here? await walletBase?.startSync(); From 93e1e2f98af82a94d274299dc5427c388d4ea39e Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 20 Jan 2023 16:28:13 -0600 Subject: [PATCH 45/45] update version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index c85fac8d7..a4ba77948 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Stack Wallet # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.5.29+103 +version: 1.5.30+104 environment: sdk: ">=2.17.0 <3.0.0"