feat: app intents, siri & widgets + fix for auth (#5)
Reviewed-on: #5 Co-authored-by: Joshua Higgins <joshuafhiggins@gmail.com>
This commit was merged in pull request #5.
This commit is contained in:
1 parent
838a25b990
commit
7327ae9c68
45 files changed
+1390
-1205
No files matched your search
@@ -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) }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user