use date as version for debug builds

This commit is contained in:
Bnyro 2022-07-30 12:33:01 +02:00
parent 357978f09e
commit 39d8d6f9f8
3 changed files with 33 additions and 17 deletions

View File

@ -21,6 +21,17 @@ android {
viewBinding true 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 { buildTypes {
release { release {
minifyEnabled true minifyEnabled true
@ -92,3 +103,9 @@ dependencies {
implementation libs.cronet.okhttp implementation libs.cronet.okhttp
implementation libs.coil implementation libs.coil
} }
static def getDate() {
def date = new Date()
def formattedDate = date.format('yyyyMMddHH')
return Integer.parseInt(formattedDate)
}

View File

@ -20,19 +20,6 @@
"versionName": "0.4.1", "versionName": "0.4.1",
"outputFile": "app-x86_64-release.apk" "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", "type": "ONE_OF_MANY",
"filters": [ "filters": [
@ -46,6 +33,19 @@
"versionName": "0.4.1", "versionName": "0.4.1",
"outputFile": "app-arm64-v8a-release.apk" "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", "type": "ONE_OF_MANY",
"filters": [ "filters": [

View File

@ -5,8 +5,8 @@ import android.app.Service
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.IBinder import android.os.IBinder
import android.util.Log
import androidx.annotation.Nullable import androidx.annotation.Nullable
import com.github.libretube.PLAYER_NOTIFICATION_ID
class ClosingService : Service() { class ClosingService : Service() {
private val TAG = "ClosingService" private val TAG = "ClosingService"
@ -20,10 +20,9 @@ class ClosingService : Service() {
override fun onTaskRemoved(rootIntent: Intent?) { override fun onTaskRemoved(rootIntent: Intent?) {
super.onTaskRemoved(rootIntent) 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 val nManager = this.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
nManager.cancelAll() nManager.cancel(PLAYER_NOTIFICATION_ID)
Log.e(TAG, "closed")
// Destroy the service // Destroy the service
stopSelf() stopSelf()