iOS/Sources/App/Settings/Notifications/NotificationDebugNotificationsViewController.swift
Zac West b5f4b2fe40
Enable Mac interface idiom & Macify settings (#1600)
Fixes #1305.

## Summary
Enables the new-to-macOS 11 interface idiom of Mac, which removes any interface scaling and brings more Mac-like UI.

## Screenshots
<img width="350" alt="image" src="https://user-images.githubusercontent.com/74188/115946708-ea115500-a477-11eb-9e42-378e76d6e136.png"><img width="350" alt="image" src="https://user-images.githubusercontent.com/74188/115946711-eed60900-a477-11eb-8591-fd01a3711787.png">

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a corresponding pull request in the Companion App Documentation repository (https://github.com/home-assistant/companion.home-assistant). Please add the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
- Updates Settings on Big Sur to use a toolbar to swap between root-level settings screens.
- Fixes blurry web view, only on Big Sur.
- `UISwitch` as a checkbox looks kind of weird; may need to do some Eureka-level changes to make SwitchRow use the `title` property on `UISwitch` to make it connected so the whole thing is clickable. This gets weird because the font size is larger for this property.
2021-04-24 07:08:30 +00:00

87 lines
3.6 KiB
Swift

import Eureka
import RealmSwift
import Shared
class NotificationDebugNotificationsViewController: HAFormViewController {
override func viewDidLoad() {
super.viewDidLoad()
title = L10n.SettingsDetails.Location.Notifications.header
form +++ Section()
<<< SwitchRow {
$0.title = L10n.SettingsDetails.Location.Notifications.Enter.title
$0.value = prefs.bool(forKey: "enterNotifications")
}.onChange({ row in
if let val = row.value {
prefs.set(val, forKey: "enterNotifications")
}
})
<<< SwitchRow {
$0.title = L10n.SettingsDetails.Location.Notifications.Exit.title
$0.value = prefs.bool(forKey: "exitNotifications")
}.onChange({ row in
if let val = row.value {
prefs.set(val, forKey: "exitNotifications")
}
})
<<< SwitchRow {
$0.title = L10n.SettingsDetails.Location.Notifications.BeaconEnter.title
$0.value = prefs.bool(forKey: "beaconEnterNotifications")
}.onChange({ row in
if let val = row.value {
prefs.set(val, forKey: "beaconEnterNotifications")
}
})
<<< SwitchRow {
$0.title = L10n.SettingsDetails.Location.Notifications.BeaconExit.title
$0.value = prefs.bool(forKey: "beaconExitNotifications")
}.onChange({ row in
if let val = row.value {
prefs.set(val, forKey: "beaconExitNotifications")
}
})
<<< SwitchRow {
$0.title = L10n.SettingsDetails.Location.Notifications.LocationChange.title
$0.value = prefs.bool(forKey: "significantLocationChangeNotifications")
}.onChange({ row in
if let val = row.value {
prefs.set(val, forKey: "significantLocationChangeNotifications")
}
})
<<< SwitchRow {
$0.title = L10n.SettingsDetails.Location.Notifications.BackgroundFetch.title
$0.value = prefs.bool(forKey: "backgroundFetchLocationChangeNotifications")
}.onChange({ row in
if let val = row.value {
prefs.set(val, forKey: "backgroundFetchLocationChangeNotifications")
}
})
<<< SwitchRow {
$0.title = L10n.SettingsDetails.Location.Notifications.PushNotification.title
$0.value = prefs.bool(forKey: "pushLocationRequestNotifications")
}.onChange({ row in
if let val = row.value {
prefs.set(val, forKey: "pushLocationRequestNotifications")
}
})
<<< SwitchRow {
$0.title = L10n.SettingsDetails.Location.Notifications.UrlScheme.title
$0.value = prefs.bool(forKey: "urlSchemeLocationRequestNotifications")
}.onChange({ row in
if let val = row.value {
prefs.set(val, forKey: "urlSchemeLocationRequestNotifications")
}
})
<<< SwitchRow {
$0.title = L10n.SettingsDetails.Location.Notifications.XCallbackUrl.title
$0.value = prefs.bool(forKey: "xCallbackURLLocationRequestNotifications")
}.onChange({ row in
if let val = row.value {
prefs.set(val, forKey: "xCallbackURLLocationRequestNotifications")
}
})
}
}