CarPlay connection improvements (#3931)

This commit is contained in:
Bruno Pantaleão Gonçalves
2025-11-04 20:28:44 +01:00
committed by GitHub
parent 539a81f728
commit eb296104d4
3 changed files with 9 additions and 19 deletions

View File

@@ -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 {

View File

@@ -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

View File

@@ -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)")
}
}
}
}