-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Closed
[Feature]: Implement background task cancellation and SHA-1 pre-calculation for Custom Selector#6607
Feature
Copy link
Labels
Description
What is the user problem or growth opportunity you want to see solved?
Currently, the ImageFileLoader within the Custom Selector contains two significant technical debts marked as TODOs:
- Resource Leakage: There is no mechanism to abort image loading. If a user exits the selector, background processes continue scanning the device gallery, wasting battery and CPU cycles.
- Performance Bottleneck: SHA-1 hashes (digital fingerprints) are not calculated during the initial scan. Consequently, the app must perform expensive file I/O to calculate the hash every time it needs to check if an image already exists on Commons, leading to UI stuttering during scrolling.
How do you know that this problem exists today? Why is this important?
This problem is documented in in the source code of ImageFileLoader.kt:
- // todo Abort loading images.
- // todo : Sha1 for image (original image).
It is important because the Custom Selector is a high-traffic part of the app. Efficient resource management ensures the app remains performant on lower-end devices, and pre-calculated SHA-1 hashes are critical for the "already uploaded" detection feature to feel instantaneous rather than laggy.
Who will benefit from it?
- Users: Will experience better battery life and a smoother, more responsive gallery scrolling experience.
- Community: Faster and more reliable duplicate detection prevents accidental double-uploads.
Anything else you would like to add?
No response