Skip to content

Commit

Permalink
Refactored handleUserActivity to unwrap the simperium key for index
Browse files Browse the repository at this point in the history
  • Loading branch information
charliescheer committed Apr 17, 2024
1 parent 2e2f0e8 commit fd0a4f6
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions Simplenote/SimplenoteAppDelegate+Swift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -246,21 +246,14 @@ extension SimplenoteAppDelegate {

@objc
func handleUserActivity(_ userActivity: NSUserActivity) -> Bool {
if userActivity.activityType == CSSearchableItemActionType {
presentNote(for: userActivity)
if userActivity.activityType == CSSearchableItemActionType,
let simperiumKey = userActivity.userInfo?[CSSearchableItemActivityIdentifier] as? String {
displayNote(simperiumKey: simperiumKey)
return true
}

return false
}

func presentNote(for userActivity: NSUserActivity) {
guard let uniqueIdentifier = userActivity.userInfo?[CSSearchableItemActivityIdentifier] as? String else {
return
}

displayNote(simperiumKey: uniqueIdentifier)
}
}

// MARK: - URL Handlers
Expand Down

0 comments on commit fd0a4f6

Please sign in to comment.