fix version checker

This commit is contained in:
Bnyro 2022-07-21 18:52:32 +02:00
parent 1f453c0cec
commit 56b7a8e5cc
3 changed files with 30 additions and 19 deletions

View File

@ -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.** { <fields>; }

View File

@ -16,7 +16,7 @@
}
],
"attributes": [],
"versionCode": 14,
"versionCode": 15,
"versionName": "0.4.1",
"outputFile": "app-x86_64-release.apk"
},
@ -29,23 +29,10 @@
}
],
"attributes": [],
"versionCode": 14,
"versionCode": 15,
"versionName": "0.4.1",
"outputFile": "app-x86-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 14,
"versionName": "0.4.1",
"outputFile": "app-armeabi-v7a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
@ -55,9 +42,22 @@
}
],
"attributes": [],
"versionCode": 14,
"versionCode": 15,
"versionName": "0.4.1",
"outputFile": "app-arm64-v8a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 15,
"versionName": "0.4.1",
"outputFile": "app-armeabi-v7a-release.apk"
}
],
"elementType": "File"

View File

@ -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")