-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change(mac): store partial path in UserDefaults #12144
Conversation
converts partial paths to full paths as needed and vice-versa when moving between file system access and referencing keyboards in UserDefaults
Mostly taking advantage of KMSettingsRepository so that more of the UserDefaults changes happen through it Still some refactoring remains for active keyboards list
testing showed that when an option already existed, it would be deleted when attempting to update it to a new value
Test ResultsI retested this issue with the attached "Keyman 18.0.86-alpha-test" build on the macOS. Here is my observation.
|
…mac/2542-use-partial-keyboard-paths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
for (NSString *kmxFile in [self getKmxFilesAtPath:keyboardFolderPath]) { | ||
NSString *partialPath = [KMDataRepository.shared buildPartialPathFrom:folderName keyboardFile:[kmxFile lastPathComponent]]; | ||
// TODO: encapsulate this in KMSettingsRepository, insertIfNotExists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: encapsulate this in KMSettingsRepository, insertIfNotExists
Changes in this pull request will be available for download in Keyman version 18.0.102-alpha |
Rather than store the full path of keyboard files throughout the Keyman settings in the UserDefaults, simply store the relative path from the Keyman-Keyboards directory.
With the encapsulation of the settings/UserDefaults in KMSettingsRepository, this also allowed other references to the settings to access it directly rather than gaining access via the application delegate.
This is dependent on #12106 which changed the location of the Keyman data on disk.
Fixes #2542
For testing purposes, the current values of Keyman's settings in the UserDefaults can be found by executing the following command in a terminal window:
defaults read keyman.inputmethod.Keyman
These settings can be written to a plist file in the current directory with
defaults read keyman.inputmethod.Keyman > ./keyman-userdefaults.plist
These settings can be imported back into the UserDefaults as follows:
defaults import keyman.inputmethod.Keyman ./keyman-userdefaults.plist
Other commands are also useful for testing:
delete all Keyman settings:
defaults delete keyman.inputmethod.Keyman
delete a single setting:
defaults delete keyman.inputmethod.Keyman KMDataModelVersion
set a single setting:
defaults write keyman.inputmethod.Keyman KMDataModelVersion 1
get documentation:
'defaults help'
User Testing
TEST_KEYBOARDS_MOVED_TO_LIBRARY
Support/keyman.inputmethod.Keyman/Keyman-Keyboards
TEST_ARMENIAN_OPTION_ENABLED:
defaults read keyman.inputmethod.Keyman
option_ligature_ew
with a value of1
.TEST_ARMENIAN_OPTION_DISABLED:
option_ligature_ew
defaults read keyman.inputmethod.Keyman
option_ligature_ew
with a value of0
.TEST_SELECTED_KEYBOARD:
defaults read keyman.inputmethod.Keyman
KMSelectedKeyboardKey
is set to the value"/sil_euro_latin/sil_euro_latin.kmx"