Repository navigation
feat(android,ios): add custom shortcuts and a shortcut panel on the keyboard - #97
Merged
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
When controlling a computer (Windows / macOS / Linux) from the Android or iOS app:
The host, relay and protocol are unchanged. Shortcuts are sent as ordinary key presses (
Input.chord).Implementation
shortcuts.jsonon the controller,{ "<os>": [{ id, title, codes }] }. Only OSes you've changed are stored. Built-in ids are their string keys, and custom ids start withcustom:.data/Shortcuts.kt, whereShortcutStoreexposes aStateFlow.Session/Shortcuts.swift, whereShortcutStore.sharedis an@Observable.KeysBargets the toggle key and the panel underneath.Shortcutsis the one composable for both the menu list and the panel, andShortcutDialogis the editor.KeyBargets the toggle key. The panel (ShortcutInputPanel) becomes the text field'sinputView, with the extra keys row inside it so there's no gap, sized to the last system keyboard.ShortcutsPageis the menu list.KeyPickergains a keyboard-only mode (keyboardOnly,maxKeys).Testing
main:compileDebugKotlinbuilds without warnings, andtestDebugUnitTestpasses (190 tests, including the newShortcutsTest).中文说明
控制电脑时(Android / iOS):
被控端、中继和协议都没改,快捷键还是用现有的按键协议发出去。测试情况见上面的 Testing。iOS 改版后的界面代码还没有用 Xcode 编译过,发版前需要编译一次、在真机上试一下。