Skip to content

Commit

Permalink
Detect shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
vknabel committed Jun 28, 2021
1 parent 68f667b commit 41a3bcf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Puffery Intents/NotifyChannelIntentHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@

import Intents
import PufferyKit
import AckeeTracker

@objc class NotifyChannelIntentHandler: NSObject, NotiyChannelIntentHandling {
func handle(intent: NotiyChannelIntent, completion: @escaping (NotiyChannelIntentResponse) -> Void) {
guard let notifyKey = intent.channel?.notifyKey else {
completion(NotiyChannelIntentResponse(code: .failure, userActivity: nil))
return
}

ackeeTracker.action(.sendMessage, key: .fromShortcut)
Current.api.notify(key: notifyKey, CreateMessageRequest(title: intent.title ?? "", body: intent.body ?? "", color: intent.color.toPuffery.rawValue)).task { result in
switch result {
case let .success(messageResponse):
Expand Down

0 comments on commit 41a3bcf

Please sign in to comment.