From 56b7a8e5cc29733728e0389c9fd6a6e73d77675b Mon Sep 17 00:00:00 2001 From: Bnyro Date: Thu, 21 Jul 2022 18:52:32 +0200 Subject: [PATCH] fix version checker --- app/proguard-rules.pro | 3 +++ app/release/output-metadata.json | 16 ++++++++-------- .../github/libretube/preferences/MainSettings.kt | 14 +++++++++++--- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 6cd107af9d..057b8b6901 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -22,3 +22,6 @@ #uncomment for debug #-keepnames class ** -keep class com.github.libretube.obj.** { *; } + +# prevents android from removing it +-keep class com.github.libretube.update.** { ; } diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index dff25728af..d258306df5 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -16,7 +16,7 @@ } ], "attributes": [], - "versionCode": 14, + "versionCode": 15, "versionName": "0.4.1", "outputFile": "app-x86_64-release.apk" }, @@ -29,7 +29,7 @@ } ], "attributes": [], - "versionCode": 14, + "versionCode": 15, "versionName": "0.4.1", "outputFile": "app-x86-release.apk" }, @@ -38,26 +38,26 @@ "filters": [ { "filterType": "ABI", - "value": "armeabi-v7a" + "value": "arm64-v8a" } ], "attributes": [], - "versionCode": 14, + "versionCode": 15, "versionName": "0.4.1", - "outputFile": "app-armeabi-v7a-release.apk" + "outputFile": "app-arm64-v8a-release.apk" }, { "type": "ONE_OF_MANY", "filters": [ { "filterType": "ABI", - "value": "arm64-v8a" + "value": "armeabi-v7a" } ], "attributes": [], - "versionCode": 14, + "versionCode": 15, "versionName": "0.4.1", - "outputFile": "app-arm64-v8a-release.apk" + "outputFile": "app-armeabi-v7a-release.apk" } ], "elementType": "File" diff --git a/app/src/main/java/com/github/libretube/preferences/MainSettings.kt b/app/src/main/java/com/github/libretube/preferences/MainSettings.kt index 51aff4da6f..b21b41bd46 100644 --- a/app/src/main/java/com/github/libretube/preferences/MainSettings.kt +++ b/app/src/main/java/com/github/libretube/preferences/MainSettings.kt @@ -1,7 +1,6 @@ package com.github.libretube.preferences import android.os.Bundle -import android.util.Log import androidx.fragment.app.Fragment import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat @@ -82,8 +81,17 @@ class MainSettings : PreferenceFragmentCompat() { CoroutineScope(Dispatchers.IO).launch { // check for update val updateInfo = UpdateChecker.getLatestReleaseInfo() - Log.e(TAG, updateInfo?.name.toString()) - if (updateInfo?.name != null && BuildConfig.VERSION_NAME != updateInfo?.name) { + if (updateInfo?.name == null) { + // request failed + val settingsActivity = activity as SettingsActivity + val snackBar = Snackbar + .make( + settingsActivity.binding.root, + R.string.unknown_error, + Snackbar.LENGTH_SHORT + ) + snackBar.show() + } else if (BuildConfig.VERSION_NAME != updateInfo.name) { // show the UpdateAvailableDialog if there's an update available val updateAvailableDialog = UpdateDialog(updateInfo) updateAvailableDialog.show(childFragmentManager, "UpdateAvailableDialog")