From 3cdf1a899ea5c7cf682b86b9e60e6229fe07af01 Mon Sep 17 00:00:00 2001 From: tom5079 Date: Sun, 12 Dec 2021 20:06:23 +0900 Subject: [PATCH] Potential Image load fail fix --- .idea/compiler.xml | 2 +- app/build.gradle | 2 +- app/release/output-metadata.json | 2 +- .../quaver/pupil/services/DownloadService.kt | 19 ++++--------------- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 61a9130c..fb7f4a8a 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 8e3d91a8..d98dac81 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -38,7 +38,7 @@ android { minSdkVersion 16 targetSdkVersion 30 versionCode 67 - versionName "5.1.18" + versionName "5.1.19" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true } diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index a184a4b9..5b5dd498 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -11,7 +11,7 @@ "type": "SINGLE", "filters": [], "versionCode": 67, - "versionName": "5.1.18", + "versionName": "5.1.19", "outputFile": "app-release.apk" } ] diff --git a/app/src/main/java/xyz/quaver/pupil/services/DownloadService.kt b/app/src/main/java/xyz/quaver/pupil/services/DownloadService.kt index 20bc08fc..201beb5a 100644 --- a/app/src/main/java/xyz/quaver/pupil/services/DownloadService.kt +++ b/app/src/main/java/xyz/quaver/pupil/services/DownloadService.kt @@ -27,6 +27,7 @@ import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import androidx.core.app.TaskStackBuilder import androidx.core.content.ContextCompat +import com.google.firebase.crashlytics.FirebaseCrashlytics import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job @@ -167,13 +168,7 @@ class DownloadService : Service() { private val interceptor: PupilInterceptor = { chain -> val request = chain.request() - var response = chain.proceed(request) - - var retry = 5 - while (!response.isSuccessful && retry > 0) { - response = chain.proceed(request) - retry-- - } + val response = chain.proceed(request) response.newBuilder() .body(response.body()?.let { @@ -202,14 +197,10 @@ class DownloadService : Service() { private val callback = object: Callback { override fun onFailure(call: Call, e: IOException) { - e.printStackTrace() + FirebaseCrashlytics.getInstance().recordException(e) if (e.message?.contains("cancel", true) == false) { val galleryID = (call.request().tag() as Tag).galleryID - - // Retry - cancel(galleryID) - download(galleryID) } } @@ -236,9 +227,7 @@ class DownloadService : Service() { startId?.let { stopSelf(it) } } }.onFailure { - it.printStackTrace() - cancel(galleryID) - download(galleryID) + FirebaseCrashlytics.getInstance().recordException(it) } } }