mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-24 06:48:38 +02:00
Merge pull request #57 from cake-tech/CWA-209-rework-receive-screen
Cwa 209 rework receive screen
This commit is contained in:
@@ -16,6 +16,7 @@ abstract class AcountListStoreBase with Store {
|
||||
AcountListStoreBase({@required WalletService walletService}) {
|
||||
accounts = [];
|
||||
isAccountCreating = false;
|
||||
isDisabledStatus = true;
|
||||
|
||||
if (walletService.currentWallet != null) {
|
||||
_onWalletChanged(walletService.currentWallet);
|
||||
@@ -37,10 +38,18 @@ abstract class AcountListStoreBase with Store {
|
||||
@observable
|
||||
bool isAccountCreating;
|
||||
|
||||
@observable
|
||||
bool isDisabledStatus;
|
||||
|
||||
AccountList _accountList;
|
||||
StreamSubscription<Wallet> _onWalletChangeSubscription;
|
||||
StreamSubscription<List<Account>> _onAccountsChangeSubscription;
|
||||
|
||||
@action
|
||||
void setDisabledStatus(bool isDisabled) {
|
||||
isDisabledStatus = isDisabled;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_onWalletChangeSubscription.cancel();
|
||||
|
||||
@@ -17,6 +17,7 @@ class SubadrressCreationStore = SubadrressCreationStoreBase
|
||||
abstract class SubadrressCreationStoreBase with Store {
|
||||
SubadrressCreationStoreBase({@required WalletService walletService}) {
|
||||
state = SubaddressCreationStateInitial();
|
||||
isDisabledStatus = true;
|
||||
|
||||
if (walletService.currentWallet != null) {
|
||||
_onWalletChanged(walletService.currentWallet);
|
||||
@@ -26,6 +27,7 @@ abstract class SubadrressCreationStoreBase with Store {
|
||||
walletService.onWalletChange.listen(_onWalletChanged);
|
||||
}
|
||||
|
||||
@observable
|
||||
SubaddressCreationState state;
|
||||
|
||||
@observable
|
||||
@@ -34,11 +36,19 @@ abstract class SubadrressCreationStoreBase with Store {
|
||||
@observable
|
||||
String errorMessage;
|
||||
|
||||
@observable
|
||||
bool isDisabledStatus;
|
||||
|
||||
SubaddressList _subaddressList;
|
||||
StreamSubscription<Wallet> _onWalletChangeSubscription;
|
||||
StreamSubscription<Account> _onAccountChangeSubscription;
|
||||
Account _account;
|
||||
|
||||
@action
|
||||
void setDisabledStatus(bool isDisabled) {
|
||||
isDisabledStatus = isDisabled;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_onWalletChangeSubscription.cancel();
|
||||
@@ -61,6 +71,20 @@ abstract class SubadrressCreationStoreBase with Store {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> setLabel({int addressIndex, String label}) async {
|
||||
try {
|
||||
state = SubaddressIsCreating();
|
||||
await _subaddressList.setLabelSubaddress(
|
||||
accountIndex: _account.id,
|
||||
addressIndex: addressIndex,
|
||||
label: label
|
||||
);
|
||||
state = SubaddressCreatedSuccessfully();
|
||||
} catch (e) {
|
||||
state = SubaddressCreationFailure(error: e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onWalletChanged(Wallet wallet) async {
|
||||
if (wallet is MoneroWallet) {
|
||||
_account = wallet.account;
|
||||
|
||||
Reference in New Issue
Block a user