New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safe check appdelegate wallet operations #798
Conversation
macsleven
commented
Jun 1, 2021
•
edited
edited
- This PR safe checks wallet operations when app is not fully active.
- optimized wallet sync operations and not allowing the os screen sleep while wallet is syncing,mixing or rescanning.
@@ -716,19 +717,22 @@ extension OverviewViewController: DcrlibwalletSyncProgressListenerProtocol { | |||
func onSyncCanceled(_ willRestart: Bool) { | |||
DispatchQueue.main.async { | |||
self.updateUI(syncCompletedSuccessfully: false) | |||
UIApplication.shared.isIdleTimerDisabled = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have many different synchronous processes, so we have to check them all to complete to set UIApplication.shared.isIdleTimerDisabled = false
} | ||
} | ||
|
||
func onSyncCompleted() { | ||
DispatchQueue.main.async { | ||
self.updateUI(syncCompletedSuccessfully: true) | ||
self.setMixerStatus() | ||
UIApplication.shared.isIdleTimerDisabled = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same above
} | ||
} | ||
|
||
func onSyncEndedWithError(_ err: Error?) { | ||
DispatchQueue.main.async { | ||
self.updateUI(syncCompletedSuccessfully: false) | ||
UIApplication.shared.isIdleTimerDisabled = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same above
@@ -821,6 +826,7 @@ extension OverviewViewController: DcrlibwalletBlocksRescanProgressListenerProtoc | |||
|
|||
func onBlocksRescanEnded(_ walletID: Int, err: Error?) { | |||
DispatchQueue.main.async { | |||
UIApplication.shared.isIdleTimerDisabled = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same above