[Gradle] Add non-Play flavor without self-updater.

This commit is contained in:
Kuba Szczodrzyński 2022-02-21 20:19:29 +01:00
parent 98a89b1ca1
commit 5b5dc5cade
No known key found for this signature in database
GPG Key ID: 70CB8A85BA1633CB
3 changed files with 38 additions and 2 deletions

View File

@ -41,6 +41,7 @@ android {
buildTypes { buildTypes {
debug { debug {
getIsDefault().set(true)
minifyEnabled = false minifyEnabled = false
manifestPlaceholders = [ manifestPlaceholders = [
buildTimestamp: 0 buildTimestamp: 0
@ -55,7 +56,8 @@ android {
} }
flavorDimensions "platform" flavorDimensions "platform"
productFlavors { productFlavors {
main { unofficial {
getIsDefault().set(true)
versionName "${release.versionName}-${gitInfo.versionSuffix}" versionName "${release.versionName}-${gitInfo.versionSuffix}"
} }
official {} official {}
@ -63,7 +65,18 @@ android {
} }
variantFilter { variant -> variantFilter { variant ->
def flavors = variant.flavors*.name def flavors = variant.flavors*.name
setIgnore(variant.buildType.name == "debug" && !flavors.contains("main")) setIgnore(variant.buildType.name == "debug" && !flavors.contains("unofficial") || flavors.contains("main"))
}
sourceSets {
unofficial {
java.srcDirs = ["src/main/java", "src/play-not/java"]
}
official {
java.srcDirs = ["src/main/java", "src/play-not/java"]
}
play {
java.srcDirs = ["src/main/java", "src/play/java"]
}
} }
defaultConfig { defaultConfig {

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) Kuba Szczodrzyński 2022-2-21.
*/
package pl.szczodrzynski.edziennik.sync
import android.app.IntentService
import android.content.Intent
import android.widget.Toast
import pl.szczodrzynski.edziennik.utils.Utils
class UpdateDownloaderService : IntentService(UpdateDownloaderService::class.java.simpleName) {
override fun onHandleIntent(intent: Intent?) {
try {
Utils.openGooglePlay(this, application.packageName)
}
catch (e: Exception) {
e.printStackTrace()
Toast.makeText(this, "Nie znaleziono Google Play. Pobierz aktualizację ręcznie.", Toast.LENGTH_SHORT).show()
}
}
}