-
Notifications
You must be signed in to change notification settings - Fork 10
Feature: Thumbnail Cache Improvements #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
c3c46ff to
6844583
Compare
2758a89 to
4b68373
Compare
|
I haven't looked at the code, but I don't think this should be one PR. |
Im experimenting here, can u look forward to the upload cancellation and improvement? i already noted it, im just playing around here and gonna split it! dont worry :) |
badec2f to
6db3309
Compare
|
solved |
|
I will give feedback if its "perfect" I am still facing issues. Its not that consistent / stable. Sometimes it stops loading thumbnails, when i set an avatar on opencloud it doesn't show that Avatar on the App. But otherwise, its really far! |
|
Its solved :D works good now. Fix: Thumbnail Loading IssueProblemThumbnails intermittently fail to load, requiring a full app restart to resolve. This occurs because:
Root CauseFile: ThumbnailsRequester.kt fun getCoilImageLoader(account: Account): ImageLoader {
val accountName = account.name
return imageLoaders.getOrPut(accountName) {
val openCloudClient = clientManager.getClientForCoilThumbnails(accountName)
val coilRequestHeaderInterceptor = CoilRequestHeaderInterceptor(
requestHeaders = hashMapOf(
AUTHORIZATION_HEADER to openCloudClient.credentials.headerAuth, // ⚠️ STATIC VALUE
// ...
)
)
// ... ImageLoader is cached with static credentials
}
}The SolutionThumbnailsRequester.ktStrategy: Make credential retrieval dynamic instead of static by modifying Changes Made
Modified Constructorprivate class CoilRequestHeaderInterceptor(
private val clientManager: ClientManager,
private val accountName: String
) : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val openCloudClient = clientManager.getClientForCoilThumbnails(accountName)
val requestHeaders = hashMapOf(
AUTHORIZATION_HEADER to openCloudClient.credentials.headerAuth,
ACCEPT_ENCODING_HEADER to ACCEPT_ENCODING_IDENTITY,
USER_AGENT_HEADER to SingleSessionManager.getUserAgent(),
OC_X_REQUEST_ID to RandomUtils.generateRandomUUID(),
)
val request = chain.request().newBuilder()
requestHeaders.toHeaders().forEach { request.addHeader(it.first, it.second) }
return chain.proceed(request.build()).newBuilder()
.removeHeader("Cache-Control")
.addHeader("Cache-Control", "max-age=5000, must-revalidate")
.build()
.also { Timber.d("Header :" + it.headers) }
}
}Modified
|
|
100% battle-tested. It seems to be perfect now. Only the avatar issue is still there. But Image thumbnails etc are cached for around 1,5 hours. (ensures that if the Server has the exact same name for a File but the File itself is different it won't give wrong thumbnail... ) |
40d99b2 to
b0f73b6
Compare
|
solved, if server sends header it respects that with fallback to 5000 secs. |
1e74b97 to
63923ac
Compare
Comprehensive update addressing thumbnail caching, avatar display, and login state management: - Dynamic credential retrieval for thumbnail loading - Account-specific ImageLoaders with shared caches - Removed deprecated AvatarManager - Fixed invisible avatars - Moved avatar loading off main thread - Fixed startup crashes - Removed duplicate methods - Code cleanup and refactoring
9403687 to
cfe9ae5
Compare
|
we need to figure out in new PR how to solve the Avatar loading issue, it's also not working on iOS. But the Caching works so far. Limit: 100 MB, 25% RAM Usage for Caching. It's totally fine for todays Smartphones. |
Pull Request: Feature/Thumbnail Cache Fix & Login Improvements
Summary
This PR consolidates several critical improvements and fixes, including a complete migration of the thumbnail caching system to Coil, fixes for authentication state loss, and enhancements to the TUS upload mechanism.
Key Changes
1. Full Coil Migration (Thumbnail Caching)
ThumbnailsCacheManagerwith the modern, efficient Coil image loading library.ThumbnailsCacheManager.javaandDiskLruImageCache.java(Legacy blocking cache).ReceiveExternalFilesAdapter,ShareFileFragment,RemoveFilesDialogFragment,FileDetailsFragment,AvatarUtils) now useThumbnailsRequester(Coil).MainApp.kt, significantly improving app startup time.AvatarUtilsto use Coil for on-demand avatar fetching and caching.2. Authentication State Fix
LoginActivity.ktforserverBaseUrlandoidcSupported.Verification
To accelerate development, parts of the caching logic mechanisms were drafted with the assistance of Gemini 3 Pro. I have refined and validated the code to ensure it matches our standards. Please review with a focus on edge cases.