diff --git a/IntentsExtension/IntentHandler.swift b/IntentsExtension/IntentHandler.swift
index 429439d13..21879cf9e 100644
--- a/IntentsExtension/IntentHandler.swift
+++ b/IntentsExtension/IntentHandler.swift
@@ -23,6 +23,8 @@ class IntentHandler: INExtension {
return CopyNoteContentIntentHandler()
case is AppendNoteIntent:
return AppendNoteIntentHandler()
+ case is CreateNewNoteIntent:
+ return CreateNewNoteIntentHandler()
default:
return self
}
diff --git a/IntentsExtension/IntentHandlers/CreateNewNoteIntentHandler.swift b/IntentsExtension/IntentHandlers/CreateNewNoteIntentHandler.swift
new file mode 100644
index 000000000..cd3dde3d9
--- /dev/null
+++ b/IntentsExtension/IntentHandlers/CreateNewNoteIntentHandler.swift
@@ -0,0 +1,28 @@
+import Intents
+
+class CreateNewNoteIntentHandler: NSObject, CreateNewNoteIntentHandling {
+ let coreDataWrapper = ExtensionCoreDataWrapper()
+
+ func handle(intent: CreateNewNoteIntent) async -> CreateNewNoteIntentResponse {
+ guard let content = intent.content,
+ let token = KeychainManager.extensionToken,
+ let note = note(with: content) else {
+ return CreateNewNoteIntentResponse(code: .failure, userActivity: nil)
+ }
+
+ Uploader(simperiumToken: token).send(note)
+ return CreateNewNoteIntentResponse(code: .success, userActivity: nil)
+ }
+
+ private func note(with content: String) -> Note? {
+ guard let context = coreDataWrapper.context() else {
+ return nil
+ }
+ let note = Note(context: context)
+ note.creationDate = .now
+ note.modificationDate = .now
+ note.content = content
+
+ return note
+ }
+}
diff --git a/IntentsExtension/Support Files/Info.plist b/IntentsExtension/Support Files/Info.plist
index 604bcbfb1..df43828e5 100644
--- a/IntentsExtension/Support Files/Info.plist
+++ b/IntentsExtension/Support Files/Info.plist
@@ -14,6 +14,7 @@
CopyNoteContentIntent
AppendNoteIntent
+ CreateNewNoteIntent
FindNoteIntent
FindNoteWithTagIntent
OpenNewNoteIntent
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index a35352275..eeebf17bf 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -1,3 +1,7 @@
+2.21
+-----
+- Added shortcuts to Simplenote Mac!!
+
2.20
-----
- Added spotlight search support for notes
diff --git a/Simplenote.xcodeproj/project.pbxproj b/Simplenote.xcodeproj/project.pbxproj
index fc2ffea6e..2319c10ed 100644
--- a/Simplenote.xcodeproj/project.pbxproj
+++ b/Simplenote.xcodeproj/project.pbxproj
@@ -258,6 +258,7 @@
BA4C6D18264CAAF800B723A7 /* URLRequest+Simplenote.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA4C6D17264CAAF800B723A7 /* URLRequest+Simplenote.swift */; };
BA4F223E2C1255A500144EDA /* SPCredentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E196C0230F5F5300F5658A /* SPCredentials.swift */; };
BA54F2462C0E63C700DBCE9D /* AppendNoteIntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA54F2452C0E63C700DBCE9D /* AppendNoteIntentHandler.swift */; };
+ BA54F2482C0E6A6900DBCE9D /* CreateNewNoteIntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA54F2472C0E6A6900DBCE9D /* CreateNewNoteIntentHandler.swift */; };
BA553F0927065E20007737E9 /* FontSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA553F0727065E20007737E9 /* FontSettings.swift */; };
BA5A658A2C07CD0B00F605A6 /* CopyNoteContentIntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA5A65892C07CD0B00F605A6 /* CopyNoteContentIntentHandler.swift */; };
BA5A658C2C090F4800F605A6 /* SharedStorageMigratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA5A658B2C090F4800F605A6 /* SharedStorageMigratorTests.swift */; };
@@ -711,6 +712,7 @@
BA52005A2BC878F1003F1B75 /* CSSearchable+Helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CSSearchable+Helpers.swift"; sourceTree = ""; };
BA52005C2BC88397003F1B75 /* NSManagedObjectContext+Simplenote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Simplenote.swift"; sourceTree = ""; };
BA54F2452C0E63C700DBCE9D /* AppendNoteIntentHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppendNoteIntentHandler.swift; sourceTree = ""; };
+ BA54F2472C0E6A6900DBCE9D /* CreateNewNoteIntentHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateNewNoteIntentHandler.swift; sourceTree = ""; };
BA553F0727065E20007737E9 /* FontSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontSettings.swift; sourceTree = ""; };
BA5A65892C07CD0B00F605A6 /* CopyNoteContentIntentHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CopyNoteContentIntentHandler.swift; sourceTree = ""; };
BA5A658B2C090F4800F605A6 /* SharedStorageMigratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharedStorageMigratorTests.swift; sourceTree = ""; };
@@ -1656,6 +1658,7 @@
BAC5DFB82C079E5A002AD7EF /* OpenNoteIntentHandler.swift */,
BA2BF33F2C07C75500A7C894 /* FindNoteIntentHandler.swift */,
BA54F2452C0E63C700DBCE9D /* AppendNoteIntentHandler.swift */,
+ BA54F2472C0E6A6900DBCE9D /* CreateNewNoteIntentHandler.swift */,
BACA686E2C0A6E2F005409C1 /* FindNoteWithTagIntentHandler.swift */,
BA5A65892C07CD0B00F605A6 /* CopyNoteContentIntentHandler.swift */,
);
@@ -2260,6 +2263,7 @@
BACA68792C0A7608005409C1 /* KeychainManager.swift in Sources */,
BAB261762BFFD319009A98D7 /* OpenNewNoteIntentHandler.swift in Sources */,
BA2BF3402C07C75500A7C894 /* FindNoteIntentHandler.swift in Sources */,
+ BA54F2482C0E6A6900DBCE9D /* CreateNewNoteIntentHandler.swift in Sources */,
BAAA71D72C07A11500244C01 /* Note+Intents.swift in Sources */,
BAAA71D82C07A12F00244C01 /* NoteContentHelper.swift in Sources */,
BAAA71EA2C07A58100244C01 /* Simplenote.xcdatamodeld in Sources */,
diff --git a/Simplenote/ShortcutIntents.intentdefinition b/Simplenote/ShortcutIntents.intentdefinition
index 070c48add..8ff500eeb 100644
--- a/Simplenote/ShortcutIntents.intentdefinition
+++ b/Simplenote/ShortcutIntents.intentdefinition
@@ -762,6 +762,103 @@
INIntentVerb
Do
+
+ INIntentCategory
+ generic
+ INIntentConfigurable
+
+ INIntentDescription
+ Creates a note with supplied content and save it in Simplenote
+ INIntentDescriptionID
+ mekg4S
+ INIntentIneligibleForSuggestions
+
+ INIntentInput
+ content
+ INIntentLastParameterTag
+ 1
+ INIntentManagedParameterCombinations
+
+ content
+
+ INIntentParameterCombinationSupportsBackgroundExecution
+
+ INIntentParameterCombinationTitle
+ Create new note with ${content}
+ INIntentParameterCombinationTitleID
+ Fjvqm6
+ INIntentParameterCombinationUpdatesLinked
+
+
+
+ INIntentName
+ CreateNewNote
+ INIntentParameters
+
+
+ INIntentParameterConfigurable
+
+ INIntentParameterDisplayName
+ Content
+ INIntentParameterDisplayNameID
+ mH6JsQ
+ INIntentParameterDisplayPriority
+ 1
+ INIntentParameterMetadata
+
+ INIntentParameterMetadataCapitalization
+ Sentences
+ INIntentParameterMetadataDefaultValueID
+ Zjifxw
+
+ INIntentParameterName
+ content
+ INIntentParameterPromptDialogs
+
+
+ INIntentParameterPromptDialogCustom
+
+ INIntentParameterPromptDialogType
+ Configuration
+
+
+ INIntentParameterPromptDialogCustom
+
+ INIntentParameterPromptDialogType
+ Primary
+
+
+ INIntentParameterTag
+ 1
+ INIntentParameterType
+ String
+
+
+ INIntentResponse
+
+ INIntentResponseCodes
+
+
+ INIntentResponseCodeName
+ success
+ INIntentResponseCodeSuccess
+
+
+
+ INIntentResponseCodeName
+ failure
+
+
+
+ INIntentTitle
+ Create New Note With Content
+ INIntentTitleID
+ 2jZ9yi
+ INIntentType
+ Custom
+ INIntentVerb
+ Do
+
INTypes
diff --git a/Simplenote/Simplenote-Info.plist b/Simplenote/Simplenote-Info.plist
index 6575c5894..b7fc0aaeb 100644
--- a/Simplenote/Simplenote-Info.plist
+++ b/Simplenote/Simplenote-Info.plist
@@ -58,6 +58,7 @@
CopyNoteContentIntent
AppendNoteIntent
+ CreateNewNoteIntent
FindNoteIntent
FindNoteWithTagIntent
OpenNewNoteIntent