Merge pull request #921 from Bnyro/master

use date as version for debug builds
This commit is contained in:
Bnyro 2022-07-30 12:40:14 +02:00 committed by GitHub
commit 4cfa4d8fb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 5 deletions

View File

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

View File

@ -61,4 +61,4 @@
}
],
"elementType": "File"
}
}

View File

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