mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-25 05:58:42 +01:00
Merge branch '4.1.0' into CAKE-208-bug-after-balance-changing
# Conflicts: # lib/store/settings_store.dart # lib/view_model/dashboard/balance_view_model.dart
This commit is contained in:
@@ -26,4 +26,10 @@ abstract class AppStoreBase with Store {
|
||||
SettingsStore settingsStore;
|
||||
|
||||
NodeListStore nodeListStore;
|
||||
|
||||
@action
|
||||
void changeCurrentWallet(WalletBase wallet) {
|
||||
this.wallet?.close();
|
||||
this.wallet = wallet;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import 'package:cake_wallet/entities/crypto_currency.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
||||
part 'fiat_conversion_store.g.dart';
|
||||
|
||||
class FiatConversionStore = FiatConversionStoreBase
|
||||
with _$FiatConversionStore;
|
||||
class FiatConversionStore = FiatConversionStoreBase with _$FiatConversionStore;
|
||||
|
||||
abstract class FiatConversionStoreBase with Store {
|
||||
FiatConversionStoreBase() : price = 0.0;
|
||||
FiatConversionStoreBase() : prices = ObservableMap<CryptoCurrency, double>();
|
||||
|
||||
@observable
|
||||
double price;
|
||||
ObservableMap<CryptoCurrency, double> prices;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:cake_wallet/entities/preferences_key.dart';
|
||||
import 'package:cake_wallet/themes.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/themes/theme_list.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
@@ -28,7 +29,7 @@ abstract class SettingsStoreBase with Store {
|
||||
@required BalanceDisplayMode initialBalanceDisplayMode,
|
||||
@required bool initialSaveRecipientAddress,
|
||||
@required bool initialAllowBiometricalAuthentication,
|
||||
@required bool initialDarkTheme,
|
||||
@required ThemeBase initialTheme,
|
||||
@required int initialPinLength,
|
||||
@required String initialLanguageCode,
|
||||
// @required String initialCurrentLocale,
|
||||
@@ -40,10 +41,9 @@ abstract class SettingsStoreBase with Store {
|
||||
balanceDisplayMode = initialBalanceDisplayMode;
|
||||
shouldSaveRecipientAddress = initialSaveRecipientAddress;
|
||||
allowBiometricalAuthentication = initialAllowBiometricalAuthentication;
|
||||
isDarkTheme = initialDarkTheme;
|
||||
currentTheme = initialTheme;
|
||||
pinCodeLength = initialPinLength;
|
||||
languageCode = initialLanguageCode;
|
||||
currentNode = nodes[WalletType.monero];
|
||||
this.nodes = ObservableMap<WalletType, Node>.of(nodes);
|
||||
_sharedPreferences = sharedPreferences;
|
||||
|
||||
@@ -65,9 +65,9 @@ abstract class SettingsStoreBase with Store {
|
||||
shouldSaveRecipientAddress));
|
||||
|
||||
reaction(
|
||||
(_) => isDarkTheme,
|
||||
(bool isDarkTheme) => sharedPreferences.setBool(
|
||||
PreferencesKey.currentDarkTheme, isDarkTheme));
|
||||
(_) => currentTheme,
|
||||
(ThemeBase theme) => sharedPreferences.setInt(
|
||||
PreferencesKey.currentTheme, theme.raw));
|
||||
|
||||
reaction(
|
||||
(_) => allowBiometricalAuthentication,
|
||||
@@ -80,14 +80,15 @@ abstract class SettingsStoreBase with Store {
|
||||
(int pinLength) => sharedPreferences.setInt(
|
||||
PreferencesKey.currentPinLength, pinLength));
|
||||
|
||||
reaction((_) => currentNode,
|
||||
(Node node) => _saveCurrentNode(node, WalletType.monero));
|
||||
|
||||
reaction(
|
||||
(_) => languageCode,
|
||||
(String languageCode) => sharedPreferences.setString(
|
||||
PreferencesKey.currentLanguageCode, languageCode));
|
||||
|
||||
this
|
||||
.nodes
|
||||
.observe((change) => _saveCurrentNode(change.newValue, change.key));
|
||||
|
||||
reaction((_) => balanceDisplayMode,
|
||||
(BalanceDisplayMode mode) => sharedPreferences.setInt(
|
||||
PreferencesKey.currentBalanceDisplayModeKey,
|
||||
@@ -116,16 +117,13 @@ abstract class SettingsStoreBase with Store {
|
||||
bool allowBiometricalAuthentication;
|
||||
|
||||
@observable
|
||||
bool isDarkTheme;
|
||||
ThemeBase currentTheme;
|
||||
|
||||
@observable
|
||||
int pinCodeLength;
|
||||
|
||||
@observable
|
||||
Node currentNode;
|
||||
|
||||
@computed
|
||||
ThemeData get theme => isDarkTheme ? Themes.darkTheme : Themes.lightTheme;
|
||||
ThemeData get theme => currentTheme.themeData;
|
||||
|
||||
@observable
|
||||
String languageCode;
|
||||
@@ -159,8 +157,8 @@ abstract class SettingsStoreBase with Store {
|
||||
final allowBiometricalAuthentication = sharedPreferences
|
||||
.getBool(PreferencesKey.allowBiometricalAuthenticationKey) ??
|
||||
false;
|
||||
final savedDarkTheme =
|
||||
sharedPreferences.getBool(PreferencesKey.currentDarkTheme) ?? false;
|
||||
final savedTheme = ThemeList.deserialize(
|
||||
raw: sharedPreferences.getInt(PreferencesKey.currentTheme) ?? 0);
|
||||
final actionListDisplayMode = ObservableList<ActionListDisplayMode>();
|
||||
actionListDisplayMode.addAll(deserializeActionlistDisplayModes(
|
||||
sharedPreferences.getInt(PreferencesKey.displayActionListModeKey) ??
|
||||
@@ -193,7 +191,7 @@ abstract class SettingsStoreBase with Store {
|
||||
initialBalanceDisplayMode: currentBalanceDisplayMode,
|
||||
initialSaveRecipientAddress: shouldSaveRecipientAddress,
|
||||
initialAllowBiometricalAuthentication: allowBiometricalAuthentication,
|
||||
initialDarkTheme: savedDarkTheme,
|
||||
initialTheme: savedTheme,
|
||||
actionlistDisplayMode: actionListDisplayMode,
|
||||
initialPinLength: pinLength,
|
||||
initialLanguageCode: savedLanguageCode);
|
||||
|
||||
Reference in New Issue
Block a user