From f7bd518192f0cbc395672ae01303c6645980c7e6 Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Fri, 2 Aug 2024 13:32:54 +0200 Subject: [PATCH] Remove dead code "this method is unnecessary and shouldn't be used" --- DcCore/DcCore/DC/events.swift | 6 +++--- deltachat-ios/Controller/FullMessageViewController.swift | 3 --- .../Settings/BackgroundOptionsViewController.swift | 2 -- .../Controller/Settings/SettingsViewController.swift | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/DcCore/DcCore/DC/events.swift b/DcCore/DcCore/DC/events.swift index 5c5b45998..248250f77 100644 --- a/DcCore/DcCore/DC/events.swift +++ b/DcCore/DcCore/DC/events.swift @@ -56,8 +56,8 @@ public class DcEventHandler { case DC_EVENT_CONFIGURE_PROGRESS: logger.info("📡[\(accountId)] configure: \(Int(data1))") - - let done = Int(data1) == 1000 + + let done = Int(data1) == 1000 NotificationCenter.default.post(name: Event.configurationProgress, object: nil, userInfo: [ "progress": Int(data1), @@ -70,7 +70,7 @@ public class DcEventHandler { UserDefaults.standard.set(true, forKey: Constants.Keys.deltachatUserProvidedCredentialsKey) UserDefaults.standard.synchronize() } - + case DC_EVENT_IMEX_PROGRESS: NotificationCenter.default.post(name: Event.importExportProgress, object: nil, userInfo: [ diff --git a/deltachat-ios/Controller/FullMessageViewController.swift b/deltachat-ios/Controller/FullMessageViewController.swift index f949ec56c..990b3e5de 100644 --- a/deltachat-ios/Controller/FullMessageViewController.swift +++ b/deltachat-ios/Controller/FullMessageViewController.swift @@ -95,7 +95,6 @@ class FullMessageViewController: WebViewViewController { @objc func alwaysActionPressed(_ action: UIAlertAction) { UserDefaults.standard.set(true, forKey: "html_load_remote_content") - UserDefaults.standard.synchronize() loadContentOnce = false loadUnrestricedHtml() } @@ -103,7 +102,6 @@ class FullMessageViewController: WebViewViewController { @objc func onceActionPressed(_ action: UIAlertAction) { if !isHalfBlocked { UserDefaults.standard.set(false, forKey: "html_load_remote_content") - UserDefaults.standard.synchronize() } loadContentOnce = true loadUnrestricedHtml() @@ -112,7 +110,6 @@ class FullMessageViewController: WebViewViewController { @objc func neverActionPressed(_ action: UIAlertAction) { if !isHalfBlocked { UserDefaults.standard.set(false, forKey: "html_load_remote_content") - UserDefaults.standard.synchronize() } loadContentOnce = false loadRestrictedHtml() diff --git a/deltachat-ios/Controller/Settings/BackgroundOptionsViewController.swift b/deltachat-ios/Controller/Settings/BackgroundOptionsViewController.swift index 3d4775214..b70b84aec 100644 --- a/deltachat-ios/Controller/Settings/BackgroundOptionsViewController.swift +++ b/deltachat-ios/Controller/Settings/BackgroundOptionsViewController.swift @@ -141,7 +141,6 @@ class BackgroundOptionsViewController: UIViewController, MediaPickerDelegate { @objc private func onDefaultSelected() { setDefault(backgroundContainer) UserDefaults.standard.set(nil, forKey: Constants.Keys.backgroundImageName) - UserDefaults.standard.synchronize() } private func setDefault(_ imageView: UIImageView) { @@ -156,7 +155,6 @@ class BackgroundOptionsViewController: UIViewController, MediaPickerDelegate { func onImageSelected(image: UIImage) { if let path = ImageFormat.saveImage(image: image, name: Constants.backgroundImageName) { UserDefaults.standard.set(URL(fileURLWithPath: path).lastPathComponent, forKey: Constants.Keys.backgroundImageName) - UserDefaults.standard.synchronize() backgroundContainer.sd_setImage(with: URL(fileURLWithPath: path), placeholderImage: nil, options: .refreshCached, completed: nil) } else { logger.error("failed to save background image") diff --git a/deltachat-ios/Controller/Settings/SettingsViewController.swift b/deltachat-ios/Controller/Settings/SettingsViewController.swift index b62c7e319..bde10d562 100644 --- a/deltachat-ios/Controller/Settings/SettingsViewController.swift +++ b/deltachat-ios/Controller/Settings/SettingsViewController.swift @@ -242,7 +242,7 @@ internal final class SettingsViewController: UITableViewController { } else { NotificationManager.removeAllNotifications() } - UserDefaults.standard.synchronize() + NotificationManager.updateBadgeCounters() NotificationCenter.default.post(name: Event.messagesChanged, object: nil, userInfo: ["message_id": Int(0), "chat_id": Int(0)]) }