You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/auto/AlbumArtContentProvider.kt
Timber.tag("AlbumArtProvider").d("Content uri received ${uri.lastPathSegment}")
34
-
35
-
// Extract the image uri e.g. https://static.pocketcasts.net/discover/images/webp/480/220e7cc0-d53e-0133-2e9f-6dc413d6d41d.webp
36
-
val imageUri =Uri.parse(uri.lastPathSegment)
37
-
// Create the cache file name e.g. static.pocketcasts.net:discover:images:webp:480:220e7cc0-d53e-0133-2e9f-6dc413d6d41d.webp
38
-
val cachePath ="${imageUri.host}${imageUri.encodedPath}".replace(oldChar ='/', newChar =':')
39
-
// Create the cache file path e.g. /data/user/0/au.com.shiftyjelly.pocketcasts.debug/cache/static.pocketcasts.net:discover:images:webp:480:220e7cc0-d53e-0133-2e9f-6dc413d6d41d.webp
40
-
val file =File(context.cacheDir, cachePath)
41
-
// Cache the image
42
-
if (!file.exists()) {
43
-
Timber.tag("AlbumArtProvider").d("Executing call for $imageUri")
44
-
val appContext = context.applicationContext
45
-
val entryPoint =EntryPointAccessors.fromApplication(appContext, AlbumArtEntryPoint::class.java)
46
-
val client = entryPoint.okHttpClient()
47
-
val request =Request.Builder().url(imageUri.toString()).build()
0 commit comments