// // SettingsViewController.swift // PayCash // // Created by Saveliy Stavitsky on 9/9/21. // Copyright © 2021 AM. All rights reserved. // import UIKit class SettingsViewController: UIViewController { @IBOutlet var settingsView: AccountViewSettings! override func viewDidLoad() { super.viewDidLoad() title = L10n.Account.Settings.title navigationItem.leftBarButtonItem = .pop(self) settingsView.parent = self notificationSwitch() NotificationCenter.default.addObserver(self, selector: #selector(notificationSwitch), name: UIApplication.willEnterForegroundNotification, object: nil) // Do any additional setup after loading the view. } @objc func notificationSwitch() { let center = UNUserNotificationCenter.current() center.getNotificationSettings(completionHandler: { settings in switch settings.authorizationStatus { case .authorized, .provisional: DispatchQueue.main.async { self.settingsView.notificationsEnabledLabel.text = L10n.Account.Settings.notificationsEnabled } default: DispatchQueue.main.async { self.settingsView.notificationsEnabledLabel.text = L10n.Account.Settings.notificationsDisabled } } }) } deinit { NotificationCenter.default.removeObserver(self) } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ }