Files
raspberry/iOS/Wallet/Sources/Account/Controller/SettingsViewController/SettingsViewController.swift
T
y.shikin ff4677166d Fixes for working with UUID in cloud
# Conflicts:
#	toolchain/generate.swift
2022-08-31 14:21:23 +03:00

48 lines
1.4 KiB
Swift

//
// SettingsViewController.swift
// Wallet
//
// Created by Saveliy Stavitsky on 9/9/21.
// Copyright © 2021 AM. All rights reserved.
//
import UIKit
class SettingsViewController: UIViewController {
@IBOutlet var settingsView: AccountViewSettings!
deinit {
NotificationCenter.default.removeObserver(self)
}
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
}
}
})
}
}