diff --git a/ui/modal/create_password_modal.go b/ui/modal/create_password_modal.go index 45a3a5c0b..aae350e9b 100644 --- a/ui/modal/create_password_modal.go +++ b/ui/modal/create_password_modal.go @@ -153,7 +153,7 @@ func (cm *CreatePasswordModal) SetNegativeButtonCallback(callback func()) *Creat return cm } -func (cm *CreatePasswordModal) SetLoading(loading bool) { +func (cm *CreatePasswordModal) setLoading(loading bool) { cm.isLoading = loading cm.Modal.SetDisabled(loading) } @@ -235,11 +235,13 @@ func (cm *CreatePasswordModal) Handle() { return } } - cm.SetLoading(true) + cm.setLoading(true) go func() { if cm.positiveButtonClicked(cm.walletName.Editor.Text(), cm.passwordEditor.Editor.Text(), cm) { cm.Dismiss() + return } + cm.setLoading(false) }() } diff --git a/ui/modal/create_watch_only_modal.go b/ui/modal/create_watch_only_modal.go index 2bdf91adb..e064bdbd7 100644 --- a/ui/modal/create_watch_only_modal.go +++ b/ui/modal/create_watch_only_modal.go @@ -76,7 +76,7 @@ func (cm *CreateWatchOnlyModal) EnableName(enable bool) *CreateWatchOnlyModal { return cm } -func (cm *CreateWatchOnlyModal) SetLoading(loading bool) { +func (cm *CreateWatchOnlyModal) setLoading(loading bool) { cm.isLoading = loading cm.Modal.SetDisabled(loading) } @@ -140,10 +140,14 @@ func (cm *CreateWatchOnlyModal) Handle() { return } - cm.SetLoading(true) - if cm.callback(cm.walletName.Editor.Text(), cm.extendedPubKey.Editor.Text(), cm) { - cm.Dismiss() - } + cm.setLoading(true) + go func() { + if cm.callback(cm.walletName.Editor.Text(), cm.extendedPubKey.Editor.Text(), cm) { + cm.Dismiss() + return + } + cm.setLoading(false) + }() } cm.btnNegative.SetEnabled(!cm.isLoading) diff --git a/ui/modal/info_modal.go b/ui/modal/info_modal.go index fc922cae6..4dd867b39 100644 --- a/ui/modal/info_modal.go +++ b/ui/modal/info_modal.go @@ -181,7 +181,7 @@ func (in *InfoModal) CheckBox(checkbox cryptomaterial.CheckBoxStyle, mustBeCheck return in } -func (in *InfoModal) SetLoading(loading bool) { +func (in *InfoModal) setLoading(loading bool) { in.isLoading = loading in.Modal.SetDisabled(loading) } @@ -298,12 +298,13 @@ func (in *InfoModal) Handle() { isChecked = in.checkbox.CheckBox.Value } - in.SetLoading(true) + in.setLoading(true) go func() { if in.positiveButtonClicked(isChecked, in) { in.Dismiss() + return } - in.SetLoading(false) + in.setLoading(false) }() } diff --git a/ui/modal/text_input_modal.go b/ui/modal/text_input_modal.go index 336bb3f2d..6ec712a1a 100644 --- a/ui/modal/text_input_modal.go +++ b/ui/modal/text_input_modal.go @@ -53,7 +53,7 @@ func (tm *TextInputModal) Hint(hint string) *TextInputModal { return tm } -func (tm *TextInputModal) SetLoading(loading bool) { +func (tm *TextInputModal) setLoading(loading bool) { tm.isLoading = loading tm.Modal.SetDisabled(loading) } @@ -115,11 +115,15 @@ func (tm *TextInputModal) Handle() { return } - tm.SetLoading(true) + tm.setLoading(true) tm.SetError("") - if tm.callback(tm.textInput.Editor.Text(), tm) { - tm.Dismiss() - } + go func() { + if tm.callback(tm.textInput.Editor.Text(), tm) { + tm.Dismiss() + return + } + tm.setLoading(false) + }() } for tm.btnNegative.Clicked() { diff --git a/ui/page/accounts/accounts_page.go b/ui/page/accounts/accounts_page.go index f290e1130..064f2092e 100644 --- a/ui/page/accounts/accounts_page.go +++ b/ui/page/accounts/accounts_page.go @@ -275,7 +275,6 @@ func (pg *Page) HandleUserInteractions() { _, err := pg.wallet.CreateNewAccount(accountName, password) if err != nil { m.SetError(err.Error()) - m.SetLoading(false) return false } pg.loadWalletAccount() diff --git a/ui/page/accounts/btc_account_details_page.go b/ui/page/accounts/btc_account_details_page.go index 37509d02b..3c2976847 100644 --- a/ui/page/accounts/btc_account_details_page.go +++ b/ui/page/accounts/btc_account_details_page.go @@ -379,7 +379,6 @@ func (pg *BTCAcctDetailsPage) HandleUserInteractions() { err := pg.wallet.RenameAccount(int32(pg.account.AccountNumber), newName) if err != nil { tim.SetError(err.Error()) - tim.SetLoading(false) return false } pg.account.AccountName = newName diff --git a/ui/page/accounts/dcr_account_details_page.go b/ui/page/accounts/dcr_account_details_page.go index dc33bfb87..0fd32a926 100644 --- a/ui/page/accounts/dcr_account_details_page.go +++ b/ui/page/accounts/dcr_account_details_page.go @@ -392,7 +392,6 @@ func (pg *AcctDetailsPage) HandleUserInteractions() { err := pg.wallet.RenameAccount(pg.account.Number, newName) if err != nil { tim.SetError(err.Error()) - tim.SetLoading(false) return false } pg.account.Name = newName diff --git a/ui/page/accounts/ltc_account_details_page.go b/ui/page/accounts/ltc_account_details_page.go index fd53dbc8f..35de0ed3e 100644 --- a/ui/page/accounts/ltc_account_details_page.go +++ b/ui/page/accounts/ltc_account_details_page.go @@ -376,7 +376,6 @@ func (pg *LTCAcctDetailsPage) HandleUserInteractions() { err := pg.wallet.RenameAccount(int32(pg.account.AccountNumber), newName) if err != nil { tim.SetError(err.Error()) - tim.SetLoading(false) return false } pg.account.AccountName = newName diff --git a/ui/page/components/restore_page.go b/ui/page/components/restore_page.go index 8e5ec8cc0..72526cb67 100644 --- a/ui/page/components/restore_page.go +++ b/ui/page/components/restore_page.go @@ -291,7 +291,6 @@ func (pg *Restore) restoreFromSeedEditor() { errString = values.StringF(values.StrWalletExist, pg.walletName) } m.SetError(errString) - m.SetLoading(false) clearEditor() return false } diff --git a/ui/page/components/seed_restore_page.go b/ui/page/components/seed_restore_page.go index 414b0ae48..0dfd5a432 100644 --- a/ui/page/components/seed_restore_page.go +++ b/ui/page/components/seed_restore_page.go @@ -570,7 +570,6 @@ func (pg *SeedRestore) HandleUserInteractions() { errString = values.StringF(values.StrWalletExist, pg.walletName) } m.SetError(errString) - m.SetLoading(false) pg.isRestoring = false return false } diff --git a/ui/page/dcrdex/dex_onboarding_page.go b/ui/page/dcrdex/dex_onboarding_page.go index ce559054f..d8af1ebf6 100644 --- a/ui/page/dcrdex/dex_onboarding_page.go +++ b/ui/page/dcrdex/dex_onboarding_page.go @@ -1024,7 +1024,6 @@ func (pg *DEXOnboarding) HandleUserInteractions() { pg.isLoading = false pm.SetError(err.Error()) - pm.SetLoading(false) return false }) dexPasswordModal.SetPasswordTitleVisibility(false) diff --git a/ui/page/dcrdex/market.go b/ui/page/dcrdex/market.go index 19f307237..790f49ae2 100644 --- a/ui/page/dcrdex/market.go +++ b/ui/page/dcrdex/market.go @@ -287,7 +287,6 @@ func (pg *DEXMarketPage) OnNavigatedTo() { } pm.SetError(err.Error()) - pm.SetLoading(false) return false }).SetCancelable(false) dexPasswordModal.SetPasswordTitleVisibility(false) @@ -1591,7 +1590,6 @@ func (pg *DEXMarketPage) HandleUserInteractions() { defer func() { if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) } pg.showLoader = false }() @@ -1702,7 +1700,6 @@ func (pg *DEXMarketPage) showSelectDEXWalletModal(missingWallet libutils.AssetTy err := pg.createMissingMarketWallet(missingWallet, dexPass, walletPass) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } @@ -1720,7 +1717,6 @@ func (pg *DEXMarketPage) showSelectDEXWalletModal(missingWallet libutils.AssetTy err := pg.AssetsManager.DexClient().Login([]byte(password)) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } diff --git a/ui/page/exchange/confirm_order_modal.go b/ui/page/exchange/confirm_order_modal.go index e8e7dbf1f..453448d08 100644 --- a/ui/page/exchange/confirm_order_modal.go +++ b/ui/page/exchange/confirm_order_modal.go @@ -88,7 +88,7 @@ func (com *confirmOrderModal) SetError(err string) { com.passwordEditor.SetError(values.TranslateErr(err)) } -func (com *confirmOrderModal) SetLoading(loading bool) { +func (com *confirmOrderModal) setLoading(loading bool) { com.isCreating = loading com.Modal.SetDisabled(loading) } @@ -102,24 +102,30 @@ func (com *confirmOrderModal) confirmOrder() { return } - com.SetLoading(true) + com.setLoading(true) go func() { + var err error + defer func() { + if err != nil { + com.setLoading(false) + } + }() + if !com.sourceWalletSelector.SelectedWallet().IsSynced() { - com.SetError(values.String(values.StrSourceWalletNotSynced)) - com.SetLoading(false) + err = errors.New(values.String(values.StrSourceWalletNotSynced)) + com.SetError(err.Error()) return } if !com.destinationWalletSelector.SelectedWallet().IsSynced() { - com.SetError(values.String(values.StrDestinationWalletNotSynced)) - com.SetLoading(false) + err = errors.New(values.String(values.StrDestinationWalletNotSynced)) + com.SetError(err.Error()) return } - err := com.sourceWalletSelector.SelectedWallet().UnlockWallet(password) + err = com.sourceWalletSelector.SelectedWallet().UnlockWallet(password) if err != nil { com.SetError(err.Error()) - com.SetLoading(false) return } @@ -127,7 +133,6 @@ func (com *confirmOrderModal) confirmOrder() { if err != nil { log.Error(errors.E(errors.Op("instantSwap.CreateOrder"), err)) com.SetError(err.Error()) - com.SetLoading(false) return } @@ -135,7 +140,6 @@ func (com *confirmOrderModal) confirmOrder() { if err != nil { com.AssetsManager.InstantSwap.DeleteOrder(order) com.SetError(err.Error()) - com.SetLoading(false) return } @@ -144,7 +148,6 @@ func (com *confirmOrderModal) confirmOrder() { if err != nil { com.AssetsManager.InstantSwap.DeleteOrder(order) com.SetError(err.Error()) - com.SetLoading(false) return } diff --git a/ui/page/exchange/order_scheduler_modal.go b/ui/page/exchange/order_scheduler_modal.go index 1565c7d3c..4f78924be 100644 --- a/ui/page/exchange/order_scheduler_modal.go +++ b/ui/page/exchange/order_scheduler_modal.go @@ -138,7 +138,7 @@ func (osm *orderSchedulerModal) OnResume() { osm.ctx, osm.ctxCancel = context.WithCancel(context.TODO()) } -func (osm *orderSchedulerModal) SetLoading(loading bool) { +func (osm *orderSchedulerModal) setLoading(loading bool) { osm.isStarting = loading osm.Modal.SetDisabled(loading) } @@ -460,14 +460,12 @@ func (osm *orderSchedulerModal) Layout(gtx layout.Context) D { } func (osm *orderSchedulerModal) startOrderScheduler() { - // osm.SetLoading(true) - go func() { - osm.SetLoading(true) + osm.setLoading(true) err := osm.sourceWalletSelector.SelectedWallet().UnlockWallet(osm.passwordEditor.Editor.Text()) if err != nil { osm.SetError(err.Error()) - osm.SetLoading(false) + osm.setLoading(false) return } diff --git a/ui/page/exchange/order_settings_modal.go b/ui/page/exchange/order_settings_modal.go index 3b79ee687..5da7d57ed 100644 --- a/ui/page/exchange/order_settings_modal.go +++ b/ui/page/exchange/order_settings_modal.go @@ -139,7 +139,7 @@ func (osm *orderSettingsModal) OnResume() { go osm.feeRateSelector.UpdatedFeeRate(osm.sourceWalletSelector.SelectedWallet()) } -func (osm *orderSettingsModal) SetLoading(loading bool) { +func (osm *orderSettingsModal) setLoading(loading bool) { osm.Modal.SetDisabled(loading) } diff --git a/ui/page/governance/agenda_vote_modal.go b/ui/page/governance/agenda_vote_modal.go index 8e770778f..5868955a8 100644 --- a/ui/page/governance/agenda_vote_modal.go +++ b/ui/page/governance/agenda_vote_modal.go @@ -78,12 +78,10 @@ func (avm *agendaVoteModal) sendVotes(_, password string, _ *modal.CreatePasswor err := avm.dcrImpl.SetVoteChoice(avm.agenda.AgendaID, avm.voteChoice, "", password) if err != nil { avm.CreatePasswordModal.SetError(err.Error()) - avm.CreatePasswordModal.SetLoading(false) return false } successModal := modal.NewSuccessModal(avm.Load, values.String(values.StrVoteUpdated), modal.DefaultClickFunc()) avm.ParentWindow().ShowModal(successModal) - avm.Dismiss() avm.onPreferenceUpdated() return true } diff --git a/ui/page/governance/proposal_vote_modal.go b/ui/page/governance/proposal_vote_modal.go index 590f91c10..5ebf7c0ff 100644 --- a/ui/page/governance/proposal_vote_modal.go +++ b/ui/page/governance/proposal_vote_modal.go @@ -155,7 +155,6 @@ func (vm *voteModal) sendVotes() { err := vm.AssetsManager.Politeia.CastVotes(ctx, w, libwallet.ConvertVotes(votes), vm.proposal.Token, password) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } vm.Dismiss() diff --git a/ui/page/governance/treasury_page.go b/ui/page/governance/treasury_page.go index 15c3b1f76..4550bdea0 100644 --- a/ui/page/governance/treasury_page.go +++ b/ui/page/governance/treasury_page.go @@ -357,7 +357,6 @@ func (pg *TreasuryPage) updatePolicyPreference(treasuryItem *components.Treasury err := pg.selectedDCRWallet.SetTreasuryPolicy(treasuryItem.Policy.PiKey, votingPreference, "", password) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } diff --git a/ui/page/privacy/account_mixer_page.go b/ui/page/privacy/account_mixer_page.go index ce3d74696..c42c1c778 100644 --- a/ui/page/privacy/account_mixer_page.go +++ b/ui/page/privacy/account_mixer_page.go @@ -469,7 +469,6 @@ func (pg *AccountMixerPage) showModalPasswordStartAccountMixer() { err := pg.dcrWallet.StartAccountMixer(password) if err != nil { pg.Toast.NotifyError(err.Error()) - pm.SetLoading(false) return } pm.Dismiss() diff --git a/ui/page/privacy/manual_mixer_setup_page.go b/ui/page/privacy/manual_mixer_setup_page.go index de71e5aae..c74cee287 100644 --- a/ui/page/privacy/manual_mixer_setup_page.go +++ b/ui/page/privacy/manual_mixer_setup_page.go @@ -260,7 +260,6 @@ func (pg *ManualMixerSetupPage) showModalSetupMixerAcct() { SetPositiveButtonCallback(func(_, password string, pm *modal.CreatePasswordModal) bool { errfunc := func(err error) bool { pm.SetError(err.Error()) - pm.SetLoading(false) return false } mixedAcctNumber := pg.mixedAccountSelector.SelectedAccount().Number diff --git a/ui/page/privacy/shared_modals.go b/ui/page/privacy/shared_modals.go index 169a2b769..c85348826 100644 --- a/ui/page/privacy/shared_modals.go +++ b/ui/page/privacy/shared_modals.go @@ -73,7 +73,6 @@ func showModalSetupMixerAcct(conf *sharedModalConfig, dcrWallet *dcr.Asset, move err := dcrWallet.CreateMixerAccounts(values.String(values.StrMixed), values.String(values.StrUnmixed), password) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } diff --git a/ui/page/root/home_page.go b/ui/page/root/home_page.go index 4a97f95ab..ef59ff5f5 100644 --- a/ui/page/root/home_page.go +++ b/ui/page/root/home_page.go @@ -944,7 +944,6 @@ func (hp *HomePage) unlockWalletForSyncing(wal sharedW.Asset, unlock load.NeedUn err := wal.UnlockWallet(password) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } unlock(true) diff --git a/ui/page/security/sign_message_page.go b/ui/page/security/sign_message_page.go index ec359bcbc..18f4e3715 100644 --- a/ui/page/security/sign_message_page.go +++ b/ui/page/security/sign_message_page.go @@ -288,7 +288,6 @@ func (pg *SignMessagePage) HandleUserInteractions() { sig, err := pg.wallet.SignMessage(password, address, message) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } diff --git a/ui/page/seedbackup/save_seed.go b/ui/page/seedbackup/save_seed.go index 5a845cf6e..d7ef531f3 100644 --- a/ui/page/seedbackup/save_seed.go +++ b/ui/page/seedbackup/save_seed.go @@ -113,7 +113,6 @@ func (pg *SaveSeedPage) OnNavigatedTo() { SetPositiveButtonCallback(func(_, password string, m *modal.CreatePasswordModal) bool { seed, err := pg.wallet.DecryptSeed(password) if err != nil { - m.SetLoading(false) m.SetError(err.Error()) return false } diff --git a/ui/page/seedbackup/verify_seed.go b/ui/page/seedbackup/verify_seed.go index e544f24b2..1827c9ed8 100644 --- a/ui/page/seedbackup/verify_seed.go +++ b/ui/page/seedbackup/verify_seed.go @@ -194,13 +194,11 @@ func (pg *VerifySeedPage) verifySeed() { return false } - m.SetLoading(false) m.SetError(err.Error()) return false } - m.Dismiss() - pg.ParentNavigator().Display(NewBackupSuccessPage(pg.Load, pg.redirectCallback)) + pg.ParentNavigator().Display(NewBackupSuccessPage(pg.Load, pg.redirectCallback)) return true }) pg.ParentWindow().ShowModal(passwordModal) diff --git a/ui/page/send/send_confirm_modal.go b/ui/page/send/send_confirm_modal.go index 52cd03e6a..92ef289cd 100644 --- a/ui/page/send/send_confirm_modal.go +++ b/ui/page/send/send_confirm_modal.go @@ -69,7 +69,7 @@ func (scm *sendConfirmModal) SetError(err string) { scm.passwordEditor.SetError(values.TranslateErr(err)) } -func (scm *sendConfirmModal) SetLoading(loading bool) { +func (scm *sendConfirmModal) setLoading(loading bool) { scm.isSending = loading scm.Modal.SetDisabled(loading) } @@ -82,12 +82,12 @@ func (scm *sendConfirmModal) broadcastTransaction() { return } - scm.SetLoading(true) + scm.setLoading(true) go func() { + defer scm.setLoading(false) _, err := scm.asset.Broadcast(password, scm.txLabel) if err != nil { scm.SetError(err.Error()) - scm.SetLoading(false) return } successModal := modal.NewSuccessModal(scm.Load, values.String(values.StrTxSent), modal.DefaultClickFunc()) diff --git a/ui/page/settings/app_settings_page.go b/ui/page/settings/app_settings_page.go index 69d84e1d9..9534ea2b7 100644 --- a/ui/page/settings/app_settings_page.go +++ b/ui/page/settings/app_settings_page.go @@ -619,13 +619,11 @@ func (pg *AppSettingsPage) HandleUserInteractions() { SetPositiveButtonCallback(func(_, password string, pm *modal.CreatePasswordModal) bool { if !utils.StringNotEmpty(password) { pm.SetError(values.String(values.StrErrPassEmpty)) - pm.SetLoading(false) return false } err := pg.AssetsManager.VerifyStartupPassphrase(password) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } pm.Dismiss() @@ -639,13 +637,11 @@ func (pg *AppSettingsPage) HandleUserInteractions() { SetPositiveButtonCallback(func(walletName, newPassword string, m *modal.CreatePasswordModal) bool { if !utils.StringNotEmpty(newPassword) { m.SetError(values.String(values.StrErrPassEmpty)) - m.SetLoading(false) return false } err := pg.AssetsManager.ChangeStartupPassphrase(password, newPassword, sharedW.PassphraseTypePass) if err != nil { m.SetError(err.Error()) - m.SetLoading(false) return false } pg.showNoticeSuccess(values.String(values.StrStartupPassConfirm)) @@ -670,13 +666,11 @@ func (pg *AppSettingsPage) HandleUserInteractions() { SetPositiveButtonCallback(func(walletName, password string, m *modal.CreatePasswordModal) bool { if !utils.StringNotEmpty(password) { m.SetError(values.String(values.StrErrPassEmpty)) - m.SetLoading(false) return false } err := pg.AssetsManager.SetStartupPassphrase(password, sharedW.PassphraseTypePass) if err != nil { m.SetError(err.Error()) - m.SetLoading(false) return false } pg.showNoticeSuccess(values.StringF(values.StrStartupPasswordEnabled, values.String(values.StrEnabled))) @@ -699,7 +693,6 @@ func (pg *AppSettingsPage) HandleUserInteractions() { err := pg.AssetsManager.RemoveStartupPassphrase(password) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } pg.showNoticeSuccess(values.StringF(values.StrStartupPasswordEnabled, values.String(values.StrDisabled))) @@ -724,7 +717,6 @@ func (pg *AppSettingsPage) HandleUserInteractions() { dexSeed, err := pg.AssetsManager.DexClient().ExportSeed([]byte(password)) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } diff --git a/ui/page/staking/stake_overview.go b/ui/page/staking/stake_overview.go index e0fb1d502..d291845c6 100644 --- a/ui/page/staking/stake_overview.go +++ b/ui/page/staking/stake_overview.go @@ -400,7 +400,6 @@ func (pg *Page) startTicketBuyerPasswordModal() { SetPositiveButtonCallback(func(_, password string, pm *modal.CreatePasswordModal) bool { if !pg.dcrWallet.IsConnectedToNetwork() { pm.SetError(values.String(values.StrNotConnected)) - pm.SetLoading(false) pg.stake.SetChecked(false) return false } @@ -408,7 +407,6 @@ func (pg *Page) startTicketBuyerPasswordModal() { err := pg.dcrWallet.StartTicketBuyer(password) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } diff --git a/ui/page/start_page.go b/ui/page/start_page.go index 5b444386e..8cce00606 100644 --- a/ui/page/start_page.go +++ b/ui/page/start_page.go @@ -211,7 +211,6 @@ func (sp *startPage) unlock() { err := sp.openWalletsAndDisplayHomePage(password) if err != nil { m.SetError(err.Error()) - m.SetLoading(false) return false } diff --git a/ui/page/wallet/wallet_settings_page.go b/ui/page/wallet/wallet_settings_page.go index 6da99a131..9f5cf0f77 100644 --- a/ui/page/wallet/wallet_settings_page.go +++ b/ui/page/wallet/wallet_settings_page.go @@ -374,7 +374,6 @@ func (pg *SettingsPage) changeSpendingPasswordModal() { newPassword, sharedW.PassphraseTypePass) if err != nil { m.SetError(err.Error()) - m.SetLoading(false) return false } @@ -383,7 +382,6 @@ func (pg *SettingsPage) changeSpendingPasswordModal() { err := pg.AssetsManager.DexClient().SetWalletPassword([]byte(dexPass), assetID, []byte(newPassword)) if err != nil { m.SetError(fmt.Errorf("Failed to update your dex wallet password, try again: %v", err).Error()) - m.SetLoading(false) // Undo password change. if err = pg.wallet.ChangePrivatePassphraseForWallet(newPassword, currentPassword, sharedW.PassphraseTypePass); err != nil { @@ -410,7 +408,6 @@ func (pg *SettingsPage) changeSpendingPasswordModal() { err := pg.AssetsManager.DexClient().Login([]byte(password)) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } @@ -430,7 +427,6 @@ func (pg *SettingsPage) changeSpendingPasswordModal() { err := pg.wallet.UnlockWallet(password) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } pg.wallet.LockWallet() @@ -469,7 +465,6 @@ func (pg *SettingsPage) deleteWalletModal() { SetPositiveButtonCallback(func(walletName string, m *modal.TextInputModal) bool { if walletName != pg.wallet.GetWalletName() { m.SetError(values.String(values.StrWalletNameMismatch)) - m.SetLoading(false) return false } @@ -487,7 +482,6 @@ func (pg *SettingsPage) deleteWalletModal() { err := pg.AssetsManager.DeleteWallet(pg.wallet.GetWalletID(), "") if err != nil { m.SetError(err.Error()) - m.SetLoading(false) } else { walletDeleted() } @@ -498,14 +492,10 @@ func (pg *SettingsPage) deleteWalletModal() { EnableName(false). EnableConfirmPassword(false). Title(values.String(values.StrConfirmToRemove)). - SetNegativeButtonCallback(func() { - m.SetLoading(false) - }). SetPositiveButtonCallback(func(_, password string, pm *modal.CreatePasswordModal) bool { err := pg.AssetsManager.DeleteWallet(pg.wallet.GetWalletID(), password) if err != nil { pm.SetError(err.Error()) - pm.SetLoading(false) return false } @@ -529,14 +519,12 @@ func (pg *SettingsPage) renameWalletModal() { name := strings.TrimSpace(newName) if !utils.ValidateLengthName(name) { tm.SetError(values.String(values.StrWalletNameLengthError)) - tm.SetLoading(false) return false } err := pg.wallet.RenameWallet(name) if err != nil { tm.SetError(err.Error()) - tm.SetLoading(false) return false } info := modal.NewSuccessModal(pg.Load, values.StringF(values.StrWalletRenamed), modal.DefaultClickFunc()) @@ -556,7 +544,6 @@ func (pg *SettingsPage) showSPVPeerDialog() { addrs, ok := validatePeerAddressStr(ipAddress) if !ok { tim.SetError(values.StringF(values.StrValidateHostErr, addrs)) - tim.SetLoading(false) return false } pg.wallet.SetSpecificPeer(addrs) @@ -670,7 +657,6 @@ func (pg *SettingsPage) HandleUserInteractions() { errorModal := modal.NewErrorModal(pg.Load, err.Error(), modal.DefaultClickFunc()) pg.ParentWindow().ShowModal(errorModal) im.Dismiss() - return false } @@ -718,7 +704,6 @@ func (pg *SettingsPage) HandleUserInteractions() { SetPositiveButtonCallback(func(textInput string, tim *modal.TextInputModal) bool { if textInput != values.String(values.StrAwareOfRisk) { tim.SetError(values.String(values.StrConfirmPending)) - tim.SetLoading(false) } else { pg.wallet.SetBoolConfigValueForKey(sharedW.SpendUnmixedFundsKey, true) tim.Dismiss() @@ -791,7 +776,6 @@ func (pg *SettingsPage) HandleUserInteractions() { _, err := pg.wallet.CreateNewAccount(accountName, password) if err != nil { m.SetError(err.Error()) - m.SetLoading(false) return false } pg.loadWalletAccount() @@ -818,25 +802,21 @@ func (pg *SettingsPage) gapLimitModal() { val, err := strconv.ParseUint(gapLimit, 10, 32) if err != nil { tm.SetError(values.String(values.StrGapLimitInputErr)) - tm.SetLoading(false) return false } if val < 1 || val > 1000 { tm.SetError(values.String(values.StrGapLimitInputErr)) - tm.SetLoading(false) return false } gLimit := uint32(val) - tm.SetLoading(true) err = pg.wallet.(*dcr.Asset).DiscoverUsage(gLimit) if err != nil { tm.SetError(err.Error()) - tm.SetLoading(false) return false } - tm.SetLoading(false) + info := modal.NewSuccessModal(pg.Load, values.String(values.StrAddressDiscoveryStarted), modal.DefaultClickFunc()). Body(values.String(values.StrAddressDiscoveryStartedBody)) pg.ParentWindow().ShowModal(info)