mirror of
https://github.com/home-assistant/iOS.git
synced 2026-04-20 18:26:36 -05:00
CarPlay connection improvements (#3931)
This commit is contained in:
committed by
GitHub
parent
539a81f728
commit
eb296104d4
@@ -129,6 +129,9 @@ class CarPlaySceneDelegate: UIResponder {
|
||||
],
|
||||
]
|
||||
}
|
||||
|
||||
// Guarantee fresh data
|
||||
Current.api(for: server)?.connection.disconnect()
|
||||
entitiesSubscriptionToken = Current.api(for: server)?.connection.caches.states(filter)
|
||||
.subscribe { [weak self] _, states in
|
||||
self?.allTemplates.forEach {
|
||||
|
||||
@@ -22,11 +22,6 @@ final class CarPlayDomainsListViewModel {
|
||||
return
|
||||
}
|
||||
self.entities = entities
|
||||
|
||||
let server = Current.servers.server(forServerIdentifier: preferredServerId) ?? Current.servers.all.first
|
||||
|
||||
guard let server else { return }
|
||||
|
||||
let entityDomains = Set(entities.all.map(\.domain))
|
||||
let domains = entityDomains.compactMap({ Domain(rawValue: $0) }).filter(\.isCarPlaySupported)
|
||||
.sorted(by: { d1, d2 in
|
||||
|
||||
@@ -21,20 +21,12 @@ final class CarPlayQuickAccessViewModel {
|
||||
}
|
||||
|
||||
func sendIntroNotification() {
|
||||
let content = UNMutableNotificationContent()
|
||||
content.title = L10n.CarPlay.Notification.QuickAccess.Intro.title
|
||||
content.body = L10n.CarPlay.Notification.QuickAccess.Intro.body
|
||||
content.sound = UNNotificationSound.default
|
||||
let request = UNNotificationRequest(
|
||||
identifier: NotificationIdentifier.carPlayIntro.rawValue,
|
||||
content: content,
|
||||
trigger: nil
|
||||
Current.notificationDispatcher.send(
|
||||
.init(
|
||||
id: NotificationIdentifier.carPlayIntro,
|
||||
title: L10n.CarPlay.Notification.QuickAccess.Intro.title,
|
||||
body: L10n.CarPlay.Notification.QuickAccess.Intro.body
|
||||
)
|
||||
)
|
||||
UNUserNotificationCenter.current().add(request) { error in
|
||||
if let error {
|
||||
Current.Log
|
||||
.info("Error scheduling CarPlay Introduction action notification: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user