Skip to content

Commit

Permalink
Added handler method for find note with tag
Browse files Browse the repository at this point in the history
  • Loading branch information
charliescheer committed May 31, 2024
1 parent bd24475 commit 24e651f
Showing 1 changed file with 8 additions and 30 deletions.
38 changes: 8 additions & 30 deletions IntentsExtension/IntentHandlers/FindNoteWithTagIntentHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,13 @@ class FindNoteWithTagIntentHandler: NSObject, FindNoteWithTagIntentHandling {
}

func handle(intent: FindNoteWithTagIntent, completion: @escaping (FindNoteWithTagIntentResponse) -> Void) {

guard let note = intent.note else {
completion(FindNoteWithTagIntentResponse(code: .failure, userActivity: nil))
return
}

let response = FindNoteWithTagIntentResponse(code: .success, userActivity: nil)
response.note = note
completion(response)
}
}

/*
func resolveNote(for intent: FindNoteWithTagIntent) async -> IntentNoteResolutionResult {
if let selectedNote = intent.note {
return IntentNoteResolutionResult.success(with: selectedNote)
}

guard let selectedTag = intent.tag else {
return IntentNoteResolutionResult.needsValue()
}

return IntentNoteResolutionResult.resolveIntentNote(forTag: selectedTag, in: coreDataWrapper)
}

func provideTagOptionsCollection(for intent: FindNoteWithTagIntent) async throws -> INObjectCollection<IntentTag> {
let tags = try IntentTag.allTags(in: coreDataWrapper)
return INObjectCollection(items: tags)
}

func handle(intent: FindNoteWithTagIntent) async -> FindNoteWithTagIntentResponse {
guard let note = intent.note else {
return FindNoteWithTagIntentResponse(code: .failure, userActivity: nil)
}

let response = FindNoteWithTagIntentResponse(code: .success, userActivity: nil)
response.note = note
return response
}
*/

0 comments on commit 24e651f

Please sign in to comment.