keymanapp / keymanapp/keyman

feat(ios): outdated version-query result cache entries should be purged

Open
#4,731 0 comments 0 reactions 0 assignees View on GitHub
feat ios/ low-priority
Dominant language
Pascal
Stars
534
Forks
143
Avg merge
2d 10h
Merged PRs (30d)
113

Description

**Describe the bug**
During work on #4729, I noticed that my package-version cache on my most-frequently used Simulator instance had around 26 separate entries. Many of those entries were uninstalled long, _long_ ago... but they continue to persist in data storage.

It's definitely a minor optimization - it's not like the entries are large. It's also likely an edge-case; most people aren't installing tons of keyboards for testing them like I do! But, it _can_ add up.

**To Reproduce**
1. Install a few packages, making note of your selections.
2. Immediately uninstall them.
3. Close the app.
4. Wait just over a week
- Or, manipulate system time
- Or, hack the cache-check to have all entries immediately time-out. https://github.com/keymanapp/keyman/blob/58a28252261ac284a6bcd87dcc595ad1fa3cefc5/ios/engine/KMEI/KeymanEngine/Classes/Resource%20Management/ResourceDownloadManager.swift#L391
5. Open the app and go to "Install From File"
6. Pick one of the previously-selected packages and install it from the local file.
7. Find its entry within the Settings > Installed Languages menu and drill down to its info view.
8. Repro success: the QR code is displayed. (It should only be displayed whenever the app knows that it's a package we publish. It should only track _that_ for any recently-installed packages with cache entries we wish to keep valid.)

**Expected behavior**
If the entry for a package within the cache has timed out _**and**_ it is not installed, we should purge its cache entries; no point in wasting extra space on the user's device. (Worst-case, the user should still have the original KMP on their device from when they originally downloaded it. Though, they can choose to purge that manually if they wish.)

Contributor guide

Open the contributing guide

Research direction

Start in ios/engine/KMEI/KeymanEngine/Classes/Resource Management/ResourceDownloadManager.swift around the cache-check at line 391. Reproduce the timeout and reinstall flow, then verify that timed-out entries for packages that are no longer installed are purged and no longer cause the QR code to appear in the installed-language info view.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.