feat: add App Intents and device control widget

This commit is contained in:
joshuafhiggins authored and Joshua Higgins committed 2026-10-22 18:58:48 -04:00
1 parent 838a25b990
commit db4af0ef6a
43 files changed
+852 -1070

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import AppIntents
internal import ExpoAppIntents
/// Resolves devices from the catalog published by `syncDevicesToWidget`.
struct DeviceQuery: EntityStringQuery {
func entities(for identifiers: [String]) async throws -> [DeviceEntity] {
try await AppIntentEntityStore.shared
.entities(ofKind: "device", matching: identifiers)
.map(DeviceEntity.init(record:))
}
func suggestedEntities() async throws -> [DeviceEntity] {
try await AppIntentEntityStore.shared
.entities(ofKind: "device")
.map(DeviceEntity.init(record:))
}
func entities(matching string: String) async throws -> [DeviceEntity] {
let search = string.trimmingCharacters(in: .whitespacesAndNewlines)
guard !search.isEmpty else {
return []
}
return try await suggestedEntities().filter { $0.matches(search) }
}
}