Skip to content

Commit

Permalink
make sure not to handle events when finishing
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Mar 31, 2023
1 parent e41c1e0 commit 677c658
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions deltachat-ios/Controller/BackupTransferViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class BackupTransferViewController: UIViewController {
private var imexObserver: NSObjectProtocol?
private var transferState: TranferState = TranferState.unknown
private var warnAboutCopiedQrCodeOnAbort = false
private var isFinishing = false

private var cancelButton: UIBarButtonItem {
return UIBarButtonItem(title: String.localized("cancel"), style: .plain, target: self, action: #selector(cancelButtonPressed))
Expand Down Expand Up @@ -125,6 +126,7 @@ class BackupTransferViewController: UIViewController {
override func didMove(toParent parent: UIViewController?) {
let isRemoved = parent == nil
if isRemoved {
isFinishing = true
if let imexObserver = self.imexObserver {
NotificationCenter.default.removeObserver(imexObserver)
}
Expand All @@ -139,6 +141,7 @@ class BackupTransferViewController: UIViewController {
UIApplication.shared.isIdleTimerDisabled = true
imexObserver = NotificationCenter.default.addObserver(forName: dcNotificationImexProgress, object: nil, queue: nil) { [weak self] notification in
guard let self = self, let ui = notification.userInfo, let permille = ui["progress"] as? Int else { return }
if self.isFinishing { return }
var statusLineText: String?
var hideQrCode = false

Expand Down

0 comments on commit 677c658

Please sign in to comment.