Skip to content

Commit

Permalink
There's no need to post Event.configurationProgress-notifications on …
Browse files Browse the repository at this point in the history
…main (#2242)
  • Loading branch information
zeitschlag committed Aug 9, 2024
1 parent fe19607 commit 1b17000
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
25 changes: 12 additions & 13 deletions DcCore/DcCore/DC/events.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,19 @@ public class DcEventHandler {

case DC_EVENT_CONFIGURE_PROGRESS:
logger.info("📡[\(accountId)] configure: \(Int(data1))")
DispatchQueue.main.async {
let done = Int(data1) == 1000

NotificationCenter.default.post(name: Event.configurationProgress, object: nil, userInfo: [
"progress": Int(data1),
"error": Int(data1) == 0,
"done": done,
"errorMessage": event.data2String,
])

if done {
UserDefaults.standard.set(true, forKey: Constants.Keys.deltachatUserProvidedCredentialsKey)
UserDefaults.standard.synchronize()
}
let done = Int(data1) == 1000

NotificationCenter.default.post(name: Event.configurationProgress, object: nil, userInfo: [
"progress": Int(data1),
"error": Int(data1) == 0,
"done": done,
"errorMessage": event.data2String,
])

if done {
UserDefaults.standard.set(true, forKey: Constants.Keys.deltachatUserProvidedCredentialsKey)
UserDefaults.standard.synchronize()
}

case DC_EVENT_IMEX_PROGRESS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,11 @@ class InstantOnboardingViewController: UIViewController {
}

private func handleCreateSuccess() {
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
appDelegate.registerForNotifications()
appDelegate.reloadDcContext()
DispatchQueue.main.async {
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
appDelegate.registerForNotifications()
appDelegate.reloadDcContext()
}
}

private func storeImageAndName() {
Expand Down

0 comments on commit 1b17000

Please sign in to comment.