Skip to content

fix: resolve keyboard translation crash and reset (#630)#658

Open
prince-0408 wants to merge 1 commit into
scribe-org:mainfrom
prince-0408:fix/keyboard-translation-reset-630
Open

fix: resolve keyboard translation crash and reset (#630)#658
prince-0408 wants to merge 1 commit into
scribe-org:mainfrom
prince-0408:fix/keyboard-translation-reset-630

Conversation

@prince-0408

Copy link
Copy Markdown
Contributor

Summary

Resolves the keyboard translation crash and reset bug described in #630. The crash was caused by the app attempting to load TranslationData.sqlite from the bundle, which had been removed from target resource lists in #593. Additionally, empty command inputs or empty database translation query results caused index out-of-range crashes during string processing.

This PR restores the database to the main target, sets up a dynamic copy to the shared container on startup, and hardens the query methods to handle empty states gracefully.


File Changes

File Action Description of Changes
project.pbxproj Modified • Adds TranslationData.sqlite file reference.
• Includes the database file under the resources build phase of the main Scribe app target.
Intentionally excluded from individual keyboard extensions to optimize app size.
AppDelegate.swift Modified • Implements copyTranslationDataToSharedContainer() helper method.
• Copies TranslationData.sqlite dynamically from the main bundle to the Shared App Group container on launch.
• Compares modification dates to overwrite and sync files on app updates.
LanguageDBManager.swift Modified • Configures translations manager to first open TranslationData from the Shared App Group container.
• Removes force-unwrap (!) on path checks inside openDBQueue to handle missing resources safely.
Translate.swift Modified • Adds a guard against empty input strings inside queryWordToTranslate() to prevent out-of-bounds string slicing.
• Safely accesses query outputs using .first and empty checks instead of direct [0] subscripting.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Thank you for the pull request! 💙🩵

The Scribe-iOS team will do our best to address your contribution as soon as we can. The following are some important points:

  • Those interested in developing their skills and expanding their role in the community should read the mentorship and growth section of the contribution guide
  • If you're not already a member of our public Matrix community, please consider joining!
    • We'd suggest that you use the Element client as well as Element X for a mobile app
    • Join the General and iOS rooms once you're in
  • Also consider attending our bi-weekly Saturday developer syncs!
    • Details are shared in the General room on Matrix each Wednesday before the sync
    • It would be great to meet you 😊

Note

Scribe uses Conventional Comments in reviews to make sure that communication is as clear as possible.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Maintainer Checklist

The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

  • Tests for changes have been written and the CI unit test, linting and formatting workflows within the PR checks do not indicate new errors in the files changed

  • The CHANGELOG has been updated with a description of the changes for the upcoming release and the corresponding issue (if necessary)

@prince-0408 prince-0408 force-pushed the fix/keyboard-translation-reset-630 branch from 63116b0 to 58b91ae Compare July 2, 2026 19:56
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.

1 participant