From 39d8d6f9f88b0b79cd58f4fda52db65f887f0195 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 30 Jul 2022 12:33:01 +0200 Subject: [PATCH] use date as version for debug builds --- app/build.gradle | 17 ++++++++++++ app/release/output-metadata.json | 26 +++++++++---------- .../libretube/services/ClosingService.kt | 7 +++-- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f999bb61a..319469cab 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,6 +21,17 @@ android { viewBinding true } + applicationVariants.all { variant -> + // use the date as version for debug builds + if (variant.name == 'debug') { + variant.outputs.each { output -> + def date = getDate() + output.versionCodeOverride = date + output.versionNameOverride = date + } + } + } + buildTypes { release { minifyEnabled true @@ -92,3 +103,9 @@ dependencies { implementation libs.cronet.okhttp implementation libs.coil } + +static def getDate() { + def date = new Date() + def formattedDate = date.format('yyyyMMddHH') + return Integer.parseInt(formattedDate) +} \ No newline at end of file diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index d258306df..64151e436 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -20,19 +20,6 @@ "versionName": "0.4.1", "outputFile": "app-x86_64-release.apk" }, - { - "type": "ONE_OF_MANY", - "filters": [ - { - "filterType": "ABI", - "value": "x86" - } - ], - "attributes": [], - "versionCode": 15, - "versionName": "0.4.1", - "outputFile": "app-x86-release.apk" - }, { "type": "ONE_OF_MANY", "filters": [ @@ -46,6 +33,19 @@ "versionName": "0.4.1", "outputFile": "app-arm64-v8a-release.apk" }, + { + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "x86" + } + ], + "attributes": [], + "versionCode": 15, + "versionName": "0.4.1", + "outputFile": "app-x86-release.apk" + }, { "type": "ONE_OF_MANY", "filters": [ diff --git a/app/src/main/java/com/github/libretube/services/ClosingService.kt b/app/src/main/java/com/github/libretube/services/ClosingService.kt index 716e6dff9..b54debbdc 100644 --- a/app/src/main/java/com/github/libretube/services/ClosingService.kt +++ b/app/src/main/java/com/github/libretube/services/ClosingService.kt @@ -5,8 +5,8 @@ import android.app.Service import android.content.Context import android.content.Intent import android.os.IBinder -import android.util.Log import androidx.annotation.Nullable +import com.github.libretube.PLAYER_NOTIFICATION_ID class ClosingService : Service() { private val TAG = "ClosingService" @@ -20,10 +20,9 @@ class ClosingService : Service() { override fun onTaskRemoved(rootIntent: Intent?) { super.onTaskRemoved(rootIntent) - // destroy all notifications (especially the player notification) + // destroy the player notification when the app gets destroyed val nManager = this.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager - nManager.cancelAll() - Log.e(TAG, "closed") + nManager.cancel(PLAYER_NOTIFICATION_ID) // Destroy the service stopSelf()