refactor: standardize conjugate label language checks using ScribeLan… - #690
Open
akkicodes-dev wants to merge 2 commits into
Open
refactor: standardize conjugate label language checks using ScribeLan…#690akkicodes-dev wants to merge 2 commits into
akkicodes-dev wants to merge 2 commits into
Conversation
Collaborator
|
The language list code is repeated in two places and could be combined into one, and it'd be good to add a test for what happens if an unrecognized language is passed in. |
…, add edge-case tests (scribe-org#426)
Author
|
Thanks for the feedback @Roniscend! I've made both changes:
All lint/detekt checks and unit tests pass. Let me know if this looks good! |
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.
Summary
Standardizes conjugate label mode switching logic to use the
ScribeLanguageenum instead of raw string comparisons, following the same pattern established in #672 and #673.Changes
KeyboardUIManager.kt: Replaced hardcoded string checks (language == "English",language in listOf("Russian", "Swedish")) withScribeLanguage.fromDisplayName()enum comparisons for conjugate grid layout selection (2x2/3x2)ConjugateViewModel.kt: Replaced duplicated hardcoded language alias list (listOf("EN", "FR", "DE", "IT", "PT", "RU", "ES", "SV"), used in 2 places) withScribeLanguage.entries.map { it.isoCode }as a single source of truthTesting
./gradlew lintKotlin detekt— passedKeyboardUIManagerTest.ktcovering grid layout selection for English/Russian/Swedish/German, sub-selection priority, and unknown-language fallbackConjugateViewModelTest.ktverifying the enum-derived alias list matches the previous hardcoded list exactly./gradlew testKeyboardsDebugUnitTest testConjugateDebugUnitTest— all tests pass (BUILD SUCCESSFUL)Note
Parts of this PR were AI-assisted (Antigravity); all changes were manually reviewed line-by-line, verified via local build/lint/test, and cross-checked against the codebase before submission.
Part of #426. Follows the pattern from #672 / #673.