-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/Upstream/main'
- Loading branch information
Showing
44 changed files
with
355 additions
and
692 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 0 additions & 97 deletions
97
Actions.xcodeproj/xcshareddata/xcschemes/Intents Extension macOS.xcscheme
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
MARKETING_VERSION = 2.7.0 | ||
CURRENT_PROJECT_VERSION = 45 | ||
MARKETING_VERSION = 2.8.1 | ||
CURRENT_PROJECT_VERSION = 47 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import AppIntents | ||
|
||
struct Boolean: AppIntent { | ||
static let title: LocalizedStringResource = "Boolean" | ||
|
||
static let description = IntentDescription( | ||
""" | ||
Passes the specified boolean value to the next action. | ||
Similar to the built-in “Number” and “Text” actions. | ||
This can be useful if you want to create a variable that is initially set to a boolean. | ||
""", | ||
categoryName: "Parse / Generate" | ||
) | ||
|
||
@Parameter( | ||
title: "Boolean", | ||
displayName: Bool.IntentDisplayName(true: "true", false: "false") | ||
) | ||
var boolean: Bool | ||
|
||
static var parameterSummary: some ParameterSummary { | ||
Summary("\(\.$boolean)") | ||
} | ||
|
||
func perform() async throws -> some IntentResult & ReturnsValue<Bool> { | ||
.result(value: boolean) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import AppIntents | ||
import SwiftUI | ||
|
||
@available(iOS, unavailable) | ||
struct GetModifierKeyState: AppIntent { | ||
static let title: LocalizedStringResource = "Get Modifier Key State" | ||
|
||
static let description = IntentDescription( | ||
""" | ||
Returns which modifier keys are currently pressed. | ||
This can be useful to have alternative behavior when, for example, the user presses the Option key. | ||
Supported modifier keys: | ||
- Shift | ||
- Control | ||
- Option | ||
- Command | ||
- Function | ||
""", | ||
categoryName: "Device", | ||
searchKeywords: [ | ||
"keyboard", | ||
"shortcut", | ||
"hotkey" | ||
] | ||
) | ||
|
||
static var parameterSummary: some ParameterSummary { | ||
Summary("Get state of modifier keys") | ||
} | ||
|
||
func perform() async throws -> some IntentResult & ReturnsValue<ModifierKeyState_AppEntity> { | ||
.result(value: .init()) | ||
} | ||
} | ||
|
||
// Note: It should be possible to support iOS, but I don't have a physical keyboard to test with (doesn't work in the simulator), so I'm leaving it out for now. | ||
// `GCKeyboard.coalesced?.keyboardInput?.button(forKeyCode: .leftShift)?.isPressed`s | ||
|
||
struct ModifierKeyState_AppEntity: TransientAppEntity { | ||
static let typeDisplayRepresentation = TypeDisplayRepresentation(name: "Modifier Key State") | ||
|
||
@Property(title: "Shift") | ||
var shift: Bool | ||
|
||
@Property(title: "Control") | ||
var control: Bool | ||
|
||
@Property(title: "Option") | ||
var option: Bool | ||
|
||
@Property(title: "Command") | ||
var command: Bool | ||
|
||
@Property(title: "Function (Fn)") | ||
var function: Bool | ||
|
||
var displayRepresentation: DisplayRepresentation { | ||
.init( | ||
title: "Modifier keys", | ||
subtitle: | ||
""" | ||
Shift: \("\(shift)") | ||
Control: \("\(control)") | ||
Option: \("\(option)") | ||
Command: \("\(command)") | ||
Function: \("\(function)") | ||
""" | ||
) | ||
} | ||
|
||
init() { | ||
#if os(macOS) | ||
let flags = NSEvent.modifierFlags | ||
|
||
// I am intentionally excluding `.capsLock` because it's confusing since it works differently. It doesn't mean "pressed", it means "on". | ||
|
||
self.shift = flags.contains(.shift) | ||
self.control = flags.contains(.control) | ||
self.option = flags.contains(.option) | ||
self.command = flags.contains(.command) | ||
self.function = flags.contains(.function) | ||
#else | ||
self.shift = false | ||
self.control = false | ||
self.option = false | ||
self.command = false | ||
self.function = false | ||
#endif | ||
} | ||
} |
Oops, something went wrong.