2 Commits b2eb7e2be8 ... beb8fbbb25

Autor SHA1 Mensaje Fecha
  Tobi823 beb8fbbb25 - add build date to downloaded file name (to prevent caching an outdated APK file) hace 4 meses
  Tobi823 63f0f57a9b - fix that update notification is shown although no new updates are available hace 4 meses

+ 5 - 1
ffupdater/src/main/java/de/marmaro/krt/ffupdater/app/impl/base/ApkDownloader.kt

@@ -16,6 +16,7 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.channels.Channel
 import kotlinx.coroutines.withContext
 import java.io.File
+import java.time.format.DateTimeFormatter
 import java.util.zip.ZipFile
 
 @Keep
@@ -83,7 +84,10 @@ interface ApkDownloader : AppAttributes {
     }
 
     private fun getSanitizedVersion(latestVersion: LatestVersion): String {
-        return latestVersion.version.versionText.replace("""\W""".toRegex(), "_")
+        val version = latestVersion.version
+        val sanitizedVersionText = version.versionText.replace("""\W""".toRegex(), "_")
+        val dateOrEmptyString = version.buildDate?.format(DateTimeFormatter.BASIC_ISO_DATE)?.let { "_$it" } ?: ""
+        return sanitizedVersionText + dateOrEmptyString
     }
 
     private suspend fun <R> download(

+ 2 - 2
ffupdater/src/main/java/de/marmaro/krt/ffupdater/background/AppUpdater.kt

@@ -44,14 +44,14 @@ import kotlin.Result.Companion.success
 @Keep
 class AppUpdater(context: Context, workerParams: WorkerParameters) : CoroutineWorker(context, workerParams) {
 
-    private var showUpdateNotification = true
+    private var showUpdateNotification = false
 
     override suspend fun doWork(): Result {
         logInfo("Start doWork for ${getApp()}")
 
         return doWorkInternal().fold(onSuccess = { Result.success() }, onFailure = {
             logError("Failed to update app", it)
-            if (showUpdateNotification && (it !is AppUpdaterRetryableException || runAttemptCount >= MAX_RETRIES)) {
+            if (showUpdateNotification && !(it is AppUpdaterRetryableException && runAttemptCount < MAX_RETRIES)) {
                 showUpdateAvailableNotification(applicationContext, getApp())
             }
             if (it is AppUpdaterRetryableException) {