Jelajahi Sumber

disable all ongoing notification streamings when disableing the corresponding feature switch

cyberta 4 tahun lalu
induk
melakukan
d18569233a
1 mengubah file dengan 7 tambahan dan 1 penghapusan
  1. 7 1
      deltachat-ios/Controller/SettingsController.swift

+ 7 - 1
deltachat-ios/Controller/SettingsController.swift

@@ -396,6 +396,7 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
         let title = locationStreaming ?
             "Disable on-demand location streaming" : String.localized("pref_on_demand_location_streaming")
         alert.addAction(UIAlertAction(title: title, style: .default, handler: { [weak self] _ in
+            guard let self = self else { return }
             UserDefaults.standard.set(!locationStreaming, forKey: "location_streaming")
             if !locationStreaming {
                 let alert = UIAlertController(title: "Thanks for trying out the experimental feature 🧪 \"Location streaming\"",
@@ -403,7 +404,12 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
                                                 + "If you want to quit the experimental feature, you can disable it at \"Settings / Advanced\".",
                                               preferredStyle: .alert)
                 alert.addAction(UIAlertAction(title: String.localized("ok"), style: .default, handler: nil))
-                self?.navigationController?.present(alert, animated: true, completion: nil)
+                self.navigationController?.present(alert, animated: true, completion: nil)
+            } else if (self.dcContext.isSendingLocationsToChat(chatId: 0)) {
+                guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
+                    return
+                }
+                appDelegate.locationManager.disableLocationStreamingInAllChats()
             }
         }))