mirror of
https://github.com/home-assistant/iOS.git
synced 2026-02-05 06:05:56 -06:00
## Summary Most, but not all, of the changes necessary to support multi-server throughout the app and all its features. ## Screenshots | Light | Dark | | ----- | ---- | |  |  | |  |  | |  |  | |  |  | |  |  | ## Any other notes - Encapsulates all connectivity, token & server-specific knowledge in a Server model object which gets passed around. - Updates various places throughout the app to know about and use Server rather than accessing said information through non-server-specific methods. - Visually requests/notes server in places where it's ambiguous. For example, the Open Page widget will gain a subtitle if multiple servers are set up. - Allows switching which server is shown in the WebViews. Note that this doesn't take into account multi-window support on iPad/macOS yet. Most things will migrate successfully however adding an additional server causes things like Shortcuts to start erroring requiring you specify which to use in the particular Shortcut. Future work necessary: - Model objects currently clobber each other if their identifiers match. For example, both servers having a zone named `home` means one of them wins the fight for which is known to the app. - Being remotely logged out on any account causes the app to require onboarding again, when instead it should only do that if the last known server is logged out.
56 lines
1.6 KiB
Swift
56 lines
1.6 KiB
Swift
import Foundation
|
|
import PromiseKit
|
|
import Shared
|
|
import UIKit
|
|
import UserNotificationsUI
|
|
|
|
class NotificationErrorViewController: UIViewController, NotificationCategory {
|
|
let label = UILabel()
|
|
|
|
required init(api: HomeAssistantAPI, notification: UNNotification, attachmentURL: URL?) throws {
|
|
fatalError("not meant to be used in the list of potentials, just directly set")
|
|
}
|
|
|
|
init(error: Error) {
|
|
super.init(nibName: nil, bundle: nil)
|
|
label.text = error.localizedDescription
|
|
}
|
|
|
|
@available(*, unavailable)
|
|
required init?(coder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
label.numberOfLines = 0
|
|
label.textAlignment = .center
|
|
|
|
if #available(iOS 13, *) {
|
|
label.textColor = .systemRed
|
|
} else {
|
|
label.textColor = .red
|
|
}
|
|
|
|
view.addSubview(label)
|
|
label.translatesAutoresizingMaskIntoConstraints = false
|
|
NSLayoutConstraint.activate([
|
|
label.topAnchor.constraint(equalTo: view.topAnchor),
|
|
label.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
|
label.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
|
label.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
|
])
|
|
}
|
|
|
|
func start() -> Promise<Void> {
|
|
.value(())
|
|
}
|
|
|
|
var mediaPlayPauseButtonType: UNNotificationContentExtensionMediaPlayPauseButtonType { .none }
|
|
var mediaPlayPauseButtonFrame: CGRect?
|
|
var mediaPlayPauseButtonTintColor: UIColor?
|
|
func mediaPlay() {}
|
|
func mediaPause() {}
|
|
}
|