Skip to content

Commit

Permalink
fix crash on disconnect button (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
macsleven committed May 27, 2020
1 parent 73591e2 commit aaff2e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
13 changes: 9 additions & 4 deletions Decred Wallet/Features/Overview/OverviewViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,19 @@ class OverviewViewController: UIViewController {
// Handle action of rescan, sync connect/reconnect/cancel button click based on sync/network status
@IBAction func syncConnectionButtonTap(_ sender: Any) {
if SyncManager.shared.isRescanning {
WalletLoader.shared.multiWallet.cancelRescan()
DispatchQueue.global(qos: .userInitiated).async {
WalletLoader.shared.multiWallet.cancelRescan()
}
} else if SyncManager.shared.isSynced || SyncManager.shared.isSyncing {
WalletLoader.shared.multiWallet.cancelSync()
DispatchQueue.global(qos: .userInitiated).async {
WalletLoader.shared.multiWallet.cancelSync()
}
} else {
SyncManager.shared.startSync(allowSyncOnCellular: Settings.syncOnCellular)
}

self.updateSyncConnectionButtonTextAndIcon()
DispatchQueue.main.async {
self.updateSyncConnectionButtonTextAndIcon()
}
}

@IBAction func showOrHideSyncDetails(_ sender: Any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,13 @@ class WalletSettingsViewController: UIViewController {

if WalletLoader.shared.multiWallet.openedWalletsCount() == 0 {
Settings.clear()
WalletLoader.shared.multiWallet.shutdown()
let startScreen = Storyboard.Main.initialViewController()
AppDelegate.shared.setAndDisplayRootViewController(startScreen!)
DispatchQueue.global(qos: .userInitiated).async {
WalletLoader.shared.multiWallet.shutdown()
DispatchQueue.main.async {
let startScreen = Storyboard.Main.initialViewController()
AppDelegate.shared.setAndDisplayRootViewController(startScreen!)
}
}
} else {
self.dismissView()
}
Expand Down

0 comments on commit aaff2e1

Please sign in to comment.