fix: resolve keyboard translation crash and reset (#630)#658
Open
prince-0408 wants to merge 1 commit into
Open
fix: resolve keyboard translation crash and reset (#630)#658prince-0408 wants to merge 1 commit into
prince-0408 wants to merge 1 commit into
Conversation
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:
Note Scribe uses Conventional Comments in reviews to make sure that communication is as clear as possible. |
Maintainer ChecklistThe 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 :) |
63116b0 to
58b91ae
Compare
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
Resolves the keyboard translation crash and reset bug described in #630. The crash was caused by the app attempting to load
TranslationData.sqlitefrom 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
ModifiedTranslationData.sqlitefile 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.
ModifiedcopyTranslationDataToSharedContainer()helper method.• Copies
TranslationData.sqlitedynamically from the main bundle to the Shared App Group container on launch.• Compares modification dates to overwrite and sync files on app updates.
Modifiedtranslationsmanager to first openTranslationDatafrom the Shared App Group container.• Removes force-unwrap (
!) on path checks insideopenDBQueueto handle missing resources safely.ModifiedqueryWordToTranslate()to prevent out-of-bounds string slicing.• Safely accesses query outputs using
.firstand empty checks instead of direct[0]subscripting.