Skip to content

Add Label Visibility Settings (#87)#164

Open
cl445 wants to merge 1 commit into
developfrom
feature/87-label-visibility
Open

Add Label Visibility Settings (#87)#164
cl445 wants to merge 1 commit into
developfrom
feature/87-label-visibility

Conversation

@cl445
Copy link
Copy Markdown
Owner

@cl445 cl445 commented Apr 11, 2026

Summary

  • Adds three independent toggles to hide letters, standard symbols, and extra symbols on the keyboard so users can practice the MessagEase layout from memory
  • Introduces a character-based LabelCategory classification so language-specific overrides (ä, ö, ü, …) inherit the correct category automatically
  • New Label Visibility settings screen with a live InteractiveKeyboardPreview
  • Numbers and functional keys are never hidden

Closes #87

Implementation notes

  • LabelCategory.swift: classifies a character into letter / standardSymbol / extraSymbol / number / functional; also exposes MessagEaseOutput.labelCategory for hint labels
  • LabelVisibilitySettings: SharedDefaults-backed ObservableObject, same pattern as HapticSettings / LayoutSettings; wired into KeyboardViewModel
  • KeyboardViewModel.displayText(for:) returns an empty string when the center character's category is hidden
  • KeyHintOverlay consults the settings per direction and skips rendering hidden hints
  • Host app: LabelVisibilitySettingsView with three "Show …" toggles (inverted bindings against the hide* keys) and a footer explaining the feature; linked from the Appearance section of SettingsView
  • Defaults (false for all three) registered in wurstfingerApp.init()

Test plan

  • xcodebuild build on iPhone 17 Pro simulator (iOS 26)
  • Full test suite: 548/548 passing
  • Existing Settings UI tests updated with scroll loops since the new row pushes "Haptic Feedback" off-screen
  • Manual smoke test in simulator: toggle each category and confirm the preview + real keyboard update, and numbers/functional keys stay visible

Summary by CodeRabbit

  • New Features
    • Added a new "Label Visibility" settings screen to customize keyboard display.
    • Users can independently toggle the visibility of letters, standard symbols, and extra symbols on keys.
    • Preferences are automatically saved and persist across app sessions.

Adds independent toggles to hide letters, standard symbols, and extra
symbols on the keyboard so users can practice the MessagEase layout from
memory. Numbers and functional keys stay visible.

Classification is character-based (via LabelCategory) rather than
slot-based, so language-specific overrides inherit the correct category
automatically.

- LabelCategory: derives category from character content
- LabelVisibilitySettings: SharedDefaults-backed observable
- KeyboardViewModel.displayText / KeyHintOverlay: suppress hidden labels
- LabelVisibilitySettingsView: host-app settings screen with live preview
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 11, 2026

📝 Walkthrough

Walkthrough

Added a label visibility feature allowing users to toggle display of letters, standard symbols, and extra symbols through a new settings UI. Introduced LabelCategory enum to classify keyboard outputs, implemented LabelVisibilitySettings to manage visibility state, and integrated visibility checks into keyboard rendering via KeyboardViewModel and KeyHintOverlay. Updated app defaults and tests accordingly.

Changes

Cohort / File(s) Summary
Settings UI & App Storage
wurstfinger/LabelVisibilitySettingsView.swift, wurstfinger/SettingsView.swift, wurstfinger/wurstfingerApp.swift
Added new settings view with three toggles for label visibility, persisted via AppStorage (hideLetters, hideStandardSymbols, hideExtraSymbols), and registered defaults in app initialization.
Label Classification
wurstfingerKeyboard/LabelCategory.swift
Introduced LabelCategory enum with letter, standardSymbol, extraSymbol, number, functional cases; includes classify(_:) method to categorize outputs by character properties and extension to MessagEaseOutput for category mapping.
Visibility Settings Management
wurstfingerKeyboard/KeyboardSettings.swift
Extended SettingsKey enum with three new cases and created LabelVisibilitySettings ObservableObject class with published hide flags, UserDefaults persistence, reload mechanism, and isVisible(_:) logic.
Keyboard View Integration
wurstfingerKeyboard/KeyboardViewModel.swift, wurstfingerKeyboard/KeyHintOverlay.swift, wurstfingerKeyboard/KeyboardRootView.swift
Updated KeyboardViewModel to own and forward labelVisibilitySettings, modified displayText(for:) to check visibility before rendering labels; refactored KeyHintOverlay to accept and use labelVisibilitySettings for per-category visibility and label transformation.
Test Updates
wurstfingerUITests/wurstfingerUITests.swift
Added scroll-up loop ensuring "Haptic Feedback" row is visible before interaction in settings tests.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant SettingsUI as Settings UI<br/>(LabelVisibilitySettingsView)
    participant AppStorage as AppStorage/<br/>UserDefaults
    participant ViewModel as KeyboardViewModel
    participant LVSettings as LabelVisibilitySettings
    participant KeyHint as KeyHintOverlay
    participant Keyboard as Keyboard View

    User->>SettingsUI: Toggle "Show Letters"
    SettingsUI->>AppStorage: Persist hideLetters = false
    AppStorage->>LVSettings: Observe change
    LVSettings->>ViewModel: objectWillChange (via forwarding)
    ViewModel->>LVSettings: reload()
    ViewModel->>Keyboard: update displayText(for:)
    Keyboard->>LVSettings: isVisible(.letter)?
    alt Letter visible
        LVSettings->>Keyboard: return true
        Keyboard->>KeyHint: render letter label
    else Letter hidden
        LVSettings->>Keyboard: return false
        Keyboard->>KeyHint: render empty label
    end
    KeyHint->>Keyboard: display updated key hints
    Keyboard->>User: Updated keyboard shown
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Label Visibility Settings' accurately reflects the main change: introducing toggles for users to control keyboard label visibility across letters, standard symbols, and extra symbols.
Linked Issues check ✅ Passed The PR meets issue #87's core requirements: users can hide/show letters and extra symbols, numbers and functional keys remain visible, and label visibility is implemented as app settings with independent toggles.
Out of Scope Changes check ✅ Passed All changes directly support label visibility functionality. Changes to KeyHintOverlay, KeyboardViewModel, and settings files are necessary for the feature. UI test updates for layout changes are appropriate maintenance.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/87-label-visibility

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
wurstfingerKeyboard/KeyboardViewModel.swift (1)

323-333: ⚠️ Potential issue | 🟠 Major

Use locale-aware uppercasing for center labels.

Line 331 uses uppercased() without locale, diverging from the keyboard's i18n design. Other UI-rendering methods in the codebase (KeyHintOverlay, resolvedText) already use locale-aware variants. The locale property is accessible within KeyboardViewModel, so the fix is straightforward:

Proposed fix
        case .upper:
-            key.center.uppercased()
+            key.center.uppercased(with: locale)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wurstfingerKeyboard/KeyboardViewModel.swift` around lines 323 - 333, The
center label uppercasing uses uppercased() without locale; update the
KeyboardViewModel code that returns key.center in the activeLayer .upper case to
call the locale-aware API (use uppercased(with: locale)) so the label respects
the VM's locale property; locate the switch on activeLayer in KeyboardViewModel
around the key.center handling and replace the plain uppercased() call with the
locale-aware variant (keeping the .lower case behavior unchanged unless you want
symmetry).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@wurstfingerKeyboard/KeyboardViewModel.swift`:
- Around line 323-333: The center label uppercasing uses uppercased() without
locale; update the KeyboardViewModel code that returns key.center in the
activeLayer .upper case to call the locale-aware API (use uppercased(with:
locale)) so the label respects the VM's locale property; locate the switch on
activeLayer in KeyboardViewModel around the key.center handling and replace the
plain uppercased() call with the locale-aware variant (keeping the .lower case
behavior unchanged unless you want symmetry).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5bbdebc7-90f9-421e-9f3b-5c1d6a069466

📥 Commits

Reviewing files that changed from the base of the PR and between 51aab32 and 09f8f8f.

⛔ Files ignored due to path filters (1)
  • wurstfinger.xcodeproj/project.pbxproj is excluded by !**/*.xcodeproj/**
📒 Files selected for processing (9)
  • wurstfinger/LabelVisibilitySettingsView.swift
  • wurstfinger/SettingsView.swift
  • wurstfinger/wurstfingerApp.swift
  • wurstfingerKeyboard/KeyHintOverlay.swift
  • wurstfingerKeyboard/KeyboardRootView.swift
  • wurstfingerKeyboard/KeyboardSettings.swift
  • wurstfingerKeyboard/KeyboardViewModel.swift
  • wurstfingerKeyboard/LabelCategory.swift
  • wurstfingerUITests/wurstfingerUITests.swift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show/Hide regular and special characters

1 participant