mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-02 12:14:09 +01:00
Added auto saving of wallet address to wallet info. Added users wallet addresses into address book.
This commit is contained in:
@@ -10,14 +10,14 @@ ReactionDisposer _onAuthenticationStateChange;
|
||||
dynamic loginError;
|
||||
|
||||
void startAuthenticationStateChange(AuthenticationStore authenticationStore,
|
||||
@required GlobalKey<NavigatorState> navigatorKey) {
|
||||
GlobalKey<NavigatorState> navigatorKey) {
|
||||
_onAuthenticationStateChange ??= autorun((_) async {
|
||||
final state = authenticationStore.state;
|
||||
|
||||
if (state == AuthenticationState.installed) {
|
||||
try {
|
||||
await loadCurrentWallet();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
loginError = e;
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -30,6 +30,14 @@ void startCurrentWalletChangeReaction(AppStore appStore,
|
||||
await getIt.get<SharedPreferences>().setInt(
|
||||
PreferencesKey.currentWalletType, serializeToInt(wallet.type));
|
||||
await wallet.connectToNode(node: node);
|
||||
|
||||
if (wallet.walletInfo.address?.isEmpty ?? true) {
|
||||
wallet.walletInfo.address = wallet.address;
|
||||
|
||||
if (wallet.walletInfo.isInBox) {
|
||||
await wallet.walletInfo.save();
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
@@ -39,8 +47,9 @@ void startCurrentWalletChangeReaction(AppStore appStore,
|
||||
reaction((_) => appStore.wallet, (WalletBase wallet) async {
|
||||
try {
|
||||
fiatConversionStore.prices[wallet.currency] = 0;
|
||||
fiatConversionStore.prices[wallet.currency] = await FiatConversionService.fetchPrice(
|
||||
wallet.currency, settingsStore.fiatCurrency);
|
||||
fiatConversionStore.prices[wallet.currency] =
|
||||
await FiatConversionService.fetchPrice(
|
||||
wallet.currency, settingsStore.fiatCurrency);
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user