mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-01-17 20:36:44 -06:00
[App] Disable R8 full mode, support devModePassword, fix build timestamp
This commit is contained in:
parent
6e19f37d79
commit
77e1acbb1e
2
.github/workflows/schedule-dispatch.yml
vendored
2
.github/workflows/schedule-dispatch.yml
vendored
@ -31,7 +31,7 @@ jobs:
|
|||||||
name: Build nightly release (APK)
|
name: Build nightly release (APK)
|
||||||
needs:
|
needs:
|
||||||
- check
|
- check
|
||||||
if: ${{ needs.check.outputs.hasNewChanges }}
|
if: ${{ needs.check.outputs.hasNewChanges == 'true' }}
|
||||||
uses: szkolny-eu/szkolny-android/.github/workflows/_build.yml@develop
|
uses: szkolny-eu/szkolny-android/.github/workflows/_build.yml@develop
|
||||||
with:
|
with:
|
||||||
nightly: true
|
nightly: true
|
||||||
|
@ -50,7 +50,7 @@ android {
|
|||||||
minifyEnabled = false
|
minifyEnabled = false
|
||||||
applicationIdSuffix = ".debug"
|
applicationIdSuffix = ".debug"
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
buildTimestamp: 0
|
buildTimestamp: "0"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.whenTaskAdded { task ->
|
tasks.whenTaskAdded { task ->
|
||||||
if (!(task.name == "minifyUnofficialReleaseWithR8" || task.name == "minifyOfficialReleaseWithR8" || task.name == "signPlayReleaseBundle"))
|
if (!(task.name == "assembleUnofficialRelease" || task.name == "assembleOfficialRelease" || task.name == "signPlayReleaseBundle"))
|
||||||
return
|
return
|
||||||
|
|
||||||
def renameTaskName = "rename${task.name.capitalize()}"
|
def renameTaskName = "rename${task.name.capitalize()}"
|
||||||
@ -148,14 +148,12 @@ tasks.whenTaskAdded { task ->
|
|||||||
if (task.name.startsWith("sign"))
|
if (task.name.startsWith("sign"))
|
||||||
flavor = task.name.substring("sign".length(), task.name.indexOf("Release")).uncapitalize()
|
flavor = task.name.substring("sign".length(), task.name.indexOf("Release")).uncapitalize()
|
||||||
|
|
||||||
def taskName = "package${flavor.capitalize()}Release"
|
|
||||||
|
|
||||||
if (flavor != "") {
|
if (flavor != "") {
|
||||||
tasks.register(renameTaskName, Copy) {
|
tasks.register(renameTaskName, Copy) {
|
||||||
dependsOn(taskName)
|
dependsOn(task.name)
|
||||||
|
duplicatesStrategy DuplicatesStrategy.FAIL
|
||||||
from file("${projectDir}/${flavor}/release/"),
|
from file("${projectDir}/${flavor}/release/"),
|
||||||
file("${buildDir}/outputs/mapping/${flavor}Release/"),
|
file("${buildDir}/outputs/mapping/${flavor}Release/"),
|
||||||
file("${buildDir}/outputs/apk/${flavor}/release/"),
|
|
||||||
file("${buildDir}/outputs/bundle/${flavor}Release/")
|
file("${buildDir}/outputs/bundle/${flavor}Release/")
|
||||||
include "*.aab", "*.apk", "mapping.txt", "output-metadata.json"
|
include "*.aab", "*.apk", "mapping.txt", "output-metadata.json"
|
||||||
destinationDir file("${projectDir}/release/")
|
destinationDir file("${projectDir}/release/")
|
||||||
|
28
app/proguard-rules.pro
vendored
28
app/proguard-rules.pro
vendored
@ -25,7 +25,7 @@
|
|||||||
-keep class * extends com.google.gson.reflect.TypeToken
|
-keep class * extends com.google.gson.reflect.TypeToken
|
||||||
|
|
||||||
-keep class pl.szczodrzynski.edziennik.utils.models.** { *; }
|
-keep class pl.szczodrzynski.edziennik.utils.models.** { *; }
|
||||||
-keep class pl.szczodrzynski.edziennik.data.db.enums.* { *; }
|
-keep class pl.szczodrzynski.edziennik.data.enums.* { *; }
|
||||||
-keep class pl.szczodrzynski.edziennik.data.db.entity.Event { *; }
|
-keep class pl.szczodrzynski.edziennik.data.db.entity.Event { *; }
|
||||||
-keep class pl.szczodrzynski.edziennik.data.db.full.EventFull { *; }
|
-keep class pl.szczodrzynski.edziennik.data.db.full.EventFull { *; }
|
||||||
-keep class pl.szczodrzynski.edziennik.data.db.entity.FeedbackMessage { *; }
|
-keep class pl.szczodrzynski.edziennik.data.db.entity.FeedbackMessage { *; }
|
||||||
@ -100,29 +100,3 @@
|
|||||||
|
|
||||||
-keepclassmembernames class pl.szczodrzynski.fslogin.realm.RealmData { *; }
|
-keepclassmembernames class pl.szczodrzynski.fslogin.realm.RealmData { *; }
|
||||||
-keepclassmembernames class pl.szczodrzynski.fslogin.realm.RealmData$Type { *; }
|
-keepclassmembernames class pl.szczodrzynski.fslogin.realm.RealmData$Type { *; }
|
||||||
|
|
||||||
# Exclude Retrofit2
|
|
||||||
-keepattributes Signature, InnerClasses, EnclosingMethod
|
|
||||||
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
|
|
||||||
-keepattributes AnnotationDefault
|
|
||||||
|
|
||||||
-keepclassmembers,allowshrinking,allowobfuscation interface * {
|
|
||||||
@retrofit2.http.* <methods>;
|
|
||||||
}
|
|
||||||
|
|
||||||
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
|
|
||||||
-dontwarn javax.annotation.**
|
|
||||||
-dontwarn kotlin.Unit
|
|
||||||
-dontwarn retrofit2.KotlinExtensions
|
|
||||||
-dontwarn retrofit2.KotlinExtensions$*
|
|
||||||
|
|
||||||
-if interface * { @retrofit2.http.* <methods>; }
|
|
||||||
-keep,allowobfuscation interface <1>
|
|
||||||
|
|
||||||
-if interface * { @retrofit2.http.* <methods>; }
|
|
||||||
-keep,allowobfuscation interface * extends <1>
|
|
||||||
|
|
||||||
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
|
|
||||||
-if interface * { @retrofit2.http.* public *** *(...); }
|
|
||||||
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
|
|
||||||
-keep,allowobfuscation,allowshrinking class retrofit2.Response
|
|
||||||
|
@ -90,7 +90,6 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
get() = profile.id
|
get() = profile.id
|
||||||
|
|
||||||
var enableChucker = false
|
var enableChucker = false
|
||||||
var debugMode = false
|
|
||||||
var devMode = false
|
var devMode = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,8 +212,11 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
App.db = AppDb(this)
|
App.db = AppDb(this)
|
||||||
App.config = Config(this)
|
App.config = Config(this)
|
||||||
App.config.migrate()
|
App.config.migrate()
|
||||||
debugMode = BuildConfig.DEBUG
|
|
||||||
devMode = config.devMode ?: debugMode
|
devMode = config.devMode ?: BuildConfig.DEBUG
|
||||||
|
if (config.devModePassword != null)
|
||||||
|
checkDevModePassword()
|
||||||
|
|
||||||
enableChucker = config.enableChucker ?: devMode
|
enableChucker = config.enableChucker ?: devMode
|
||||||
uiManager.applyNightMode()
|
uiManager.applyNightMode()
|
||||||
uiManager.applyLanguage(this)
|
uiManager.applyLanguage(this)
|
||||||
@ -240,9 +242,6 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.Default) {
|
||||||
SSLProviderInstaller.install(applicationContext, this@App::buildHttp)
|
SSLProviderInstaller.install(applicationContext, this@App::buildHttp)
|
||||||
|
|
||||||
if (config.devModePassword != null)
|
|
||||||
checkDevModePassword()
|
|
||||||
|
|
||||||
if (config.sync.enabled)
|
if (config.sync.enabled)
|
||||||
SyncWorker.scheduleNext(this@App, false)
|
SyncWorker.scheduleNext(this@App, false)
|
||||||
else
|
else
|
||||||
@ -474,8 +473,8 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun checkDevModePassword() {
|
fun checkDevModePassword() {
|
||||||
devMode = try {
|
devMode = devMode || try {
|
||||||
Utils.AESCrypt.decrypt("nWFVxY65Pa8/aRrT7EylNAencmOD+IxUY2Gg/beiIWY=", config.devModePassword) == "ok here you go it's enabled now" || BuildConfig.DEBUG
|
Utils.AESCrypt.decrypt("nWFVxY65Pa8/aRrT7EylNAencmOD+IxUY2Gg/beiIWY=", config.devModePassword) == "ok here you go it's enabled now"
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
false
|
false
|
||||||
|
@ -145,7 +145,7 @@ abstract class Data(val app: App, val profile: Profile?, val loginStore: LoginSt
|
|||||||
val db: AppDb by lazy { app.db }
|
val db: AppDb by lazy { app.db }
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (App.debugMode) {
|
if (BuildConfig.DEBUG) {
|
||||||
fakeLogin = loginStore.hasLoginData("fakeLogin")
|
fakeLogin = loginStore.hasLoginData("fakeLogin")
|
||||||
}
|
}
|
||||||
clear()
|
clear()
|
||||||
|
@ -11,6 +11,7 @@ import kotlinx.coroutines.launch
|
|||||||
import pl.szczodrzynski.edziennik.App
|
import pl.szczodrzynski.edziennik.App
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.ConfigEntry
|
import pl.szczodrzynski.edziennik.data.db.entity.ConfigEntry
|
||||||
import pl.szczodrzynski.edziennik.ext.takePositive
|
import pl.szczodrzynski.edziennik.ext.takePositive
|
||||||
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
|
||||||
abstract class BaseConfig<T>(
|
abstract class BaseConfig<T>(
|
||||||
@ -19,6 +20,9 @@ abstract class BaseConfig<T>(
|
|||||||
val profileId: Int? = null,
|
val profileId: Int? = null,
|
||||||
protected var entries: List<ConfigEntry>? = null,
|
protected var entries: List<ConfigEntry>? = null,
|
||||||
) : CoroutineScope {
|
) : CoroutineScope {
|
||||||
|
companion object {
|
||||||
|
private const val TAG = "BaseConfig"
|
||||||
|
}
|
||||||
|
|
||||||
private val job = Job()
|
private val job = Job()
|
||||||
override val coroutineContext: CoroutineContext
|
override val coroutineContext: CoroutineContext
|
||||||
@ -66,6 +70,7 @@ abstract class BaseConfig<T>(
|
|||||||
operator fun set(key: String, value: String?) {
|
operator fun set(key: String, value: String?) {
|
||||||
values[key] = value
|
values[key] = value
|
||||||
launch(Dispatchers.IO) {
|
launch(Dispatchers.IO) {
|
||||||
|
d(TAG, "Setting config value ($profileId): $key = $value")
|
||||||
app.db.configDao().add(ConfigEntry(profileId ?: -1, key, value))
|
app.db.configDao().add(ConfigEntry(profileId ?: -1, key, value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,10 @@ class SzkolnyAppFirebase(val app: App, val profiles: List<Profile>, val message:
|
|||||||
}
|
}
|
||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.Default) {
|
||||||
app.db.feedbackMessageDao().add(message)
|
app.db.feedbackMessageDao().add(message)
|
||||||
|
if (message.text.startsWith("devmode")) {
|
||||||
|
app.config.devModePassword = message.text.substringAfter("devmode")
|
||||||
|
app.checkDevModePassword()
|
||||||
|
}
|
||||||
if (!EventBus.getDefault().hasSubscriberForEvent(FeedbackMessageEvent::class.java)) {
|
if (!EventBus.getDefault().hasSubscriberForEvent(FeedbackMessageEvent::class.java)) {
|
||||||
val notification = Notification(
|
val notification = Notification(
|
||||||
id = System.currentTimeMillis(),
|
id = System.currentTimeMillis(),
|
||||||
|
@ -254,6 +254,11 @@ class FeedbackFragment : Fragment(), CoroutineScope {
|
|||||||
message
|
message
|
||||||
} ?: return@launch
|
} ?: return@launch
|
||||||
|
|
||||||
|
if (message.text.startsWith("devmode")) {
|
||||||
|
app.config.devModePassword = message.text.substringAfter("devmode")
|
||||||
|
app.checkDevModePassword()
|
||||||
|
}
|
||||||
|
|
||||||
b.chatLayout.visibility = View.VISIBLE
|
b.chatLayout.visibility = View.VISIBLE
|
||||||
b.inputLayout.visibility = View.GONE
|
b.inputLayout.visibility = View.GONE
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ import kotlinx.coroutines.CoroutineScope
|
|||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import pl.szczodrzynski.edziennik.App
|
import pl.szczodrzynski.edziennik.App
|
||||||
|
import pl.szczodrzynski.edziennik.BuildConfig
|
||||||
import pl.szczodrzynski.edziennik.R
|
import pl.szczodrzynski.edziennik.R
|
||||||
import pl.szczodrzynski.edziennik.data.enums.LoginMode
|
import pl.szczodrzynski.edziennik.data.enums.LoginMode
|
||||||
import pl.szczodrzynski.edziennik.data.enums.LoginType
|
import pl.szczodrzynski.edziennik.data.enums.LoginType
|
||||||
@ -256,7 +257,7 @@ class LoginFormFragment : Fragment(), CoroutineScope {
|
|||||||
"loginMode" to loginMode
|
"loginMode" to loginMode
|
||||||
)
|
)
|
||||||
|
|
||||||
if (App.debugMode && b.fakeLogin.isChecked) {
|
if (BuildConfig.DEBUG && b.fakeLogin.isChecked) {
|
||||||
payload.putBoolean("fakeLogin", true)
|
payload.putBoolean("fakeLogin", true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import kotlinx.coroutines.CoroutineScope
|
|||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import pl.szczodrzynski.edziennik.App
|
import pl.szczodrzynski.edziennik.App
|
||||||
|
import pl.szczodrzynski.edziennik.BuildConfig
|
||||||
import pl.szczodrzynski.edziennik.R
|
import pl.szczodrzynski.edziennik.R
|
||||||
import pl.szczodrzynski.edziennik.databinding.LoginPrizeFragmentBinding
|
import pl.szczodrzynski.edziennik.databinding.LoginPrizeFragmentBinding
|
||||||
import pl.szczodrzynski.edziennik.ext.onClick
|
import pl.szczodrzynski.edziennik.ext.onClick
|
||||||
@ -67,8 +68,8 @@ class LoginPrizeFragment : Fragment(), CoroutineScope {
|
|||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
.setNegativeButton(R.string.no) { _, _ ->
|
.setNegativeButton(R.string.no) { _, _ ->
|
||||||
app.config.devMode = App.debugMode
|
app.config.devMode = BuildConfig.DEBUG
|
||||||
App.devMode = App.debugMode
|
App.devMode = BuildConfig.DEBUG
|
||||||
activity.finish()
|
activity.finish()
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
@ -55,7 +55,7 @@ class BuildManager(val app: App) : CoroutineScope {
|
|||||||
get() {
|
get() {
|
||||||
val info = app.packageManager.getApplicationInfo(app.packageName, PackageManager.GET_META_DATA)
|
val info = app.packageManager.getApplicationInfo(app.packageName, PackageManager.GET_META_DATA)
|
||||||
val metadata = info.metaData
|
val metadata = info.metaData
|
||||||
return metadata?.getFloat("buildTimestamp")?.toLong() ?: 0
|
return metadata?.getString("buildTimestamp")?.toLongOrNull() ?: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
val gitHash = BuildConfig.GIT_INFO["hash"]
|
val gitHash = BuildConfig.GIT_INFO["hash"]
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
android.enableR8.fullMode=false
|
||||||
android.ndk.suppressMinSdkVersionError=21
|
android.ndk.suppressMinSdkVersionError=21
|
||||||
android.nonFinalResIds=true
|
android.nonFinalResIds=true
|
||||||
android.nonTransitiveRClass=false
|
android.nonTransitiveRClass=false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user