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)
|
||||
needs:
|
||||
- check
|
||||
if: ${{ needs.check.outputs.hasNewChanges }}
|
||||
if: ${{ needs.check.outputs.hasNewChanges == 'true' }}
|
||||
uses: szkolny-eu/szkolny-android/.github/workflows/_build.yml@develop
|
||||
with:
|
||||
nightly: true
|
||||
|
@ -50,7 +50,7 @@ android {
|
||||
minifyEnabled = false
|
||||
applicationIdSuffix = ".debug"
|
||||
manifestPlaceholders = [
|
||||
buildTimestamp: 0
|
||||
buildTimestamp: "0"
|
||||
]
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ android {
|
||||
}
|
||||
|
||||
tasks.whenTaskAdded { task ->
|
||||
if (!(task.name == "minifyUnofficialReleaseWithR8" || task.name == "minifyOfficialReleaseWithR8" || task.name == "signPlayReleaseBundle"))
|
||||
if (!(task.name == "assembleUnofficialRelease" || task.name == "assembleOfficialRelease" || task.name == "signPlayReleaseBundle"))
|
||||
return
|
||||
|
||||
def renameTaskName = "rename${task.name.capitalize()}"
|
||||
@ -148,14 +148,12 @@ tasks.whenTaskAdded { task ->
|
||||
if (task.name.startsWith("sign"))
|
||||
flavor = task.name.substring("sign".length(), task.name.indexOf("Release")).uncapitalize()
|
||||
|
||||
def taskName = "package${flavor.capitalize()}Release"
|
||||
|
||||
if (flavor != "") {
|
||||
tasks.register(renameTaskName, Copy) {
|
||||
dependsOn(taskName)
|
||||
dependsOn(task.name)
|
||||
duplicatesStrategy DuplicatesStrategy.FAIL
|
||||
from file("${projectDir}/${flavor}/release/"),
|
||||
file("${buildDir}/outputs/mapping/${flavor}Release/"),
|
||||
file("${buildDir}/outputs/apk/${flavor}/release/"),
|
||||
file("${buildDir}/outputs/bundle/${flavor}Release/")
|
||||
include "*.aab", "*.apk", "mapping.txt", "output-metadata.json"
|
||||
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 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.full.EventFull { *; }
|
||||
-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$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
|
||||
|
||||
var enableChucker = false
|
||||
var debugMode = false
|
||||
var devMode = false
|
||||
}
|
||||
|
||||
@ -213,8 +212,11 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
||||
App.db = AppDb(this)
|
||||
App.config = Config(this)
|
||||
App.config.migrate()
|
||||
debugMode = BuildConfig.DEBUG
|
||||
devMode = config.devMode ?: debugMode
|
||||
|
||||
devMode = config.devMode ?: BuildConfig.DEBUG
|
||||
if (config.devModePassword != null)
|
||||
checkDevModePassword()
|
||||
|
||||
enableChucker = config.enableChucker ?: devMode
|
||||
uiManager.applyNightMode()
|
||||
uiManager.applyLanguage(this)
|
||||
@ -240,9 +242,6 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
||||
withContext(Dispatchers.Default) {
|
||||
SSLProviderInstaller.install(applicationContext, this@App::buildHttp)
|
||||
|
||||
if (config.devModePassword != null)
|
||||
checkDevModePassword()
|
||||
|
||||
if (config.sync.enabled)
|
||||
SyncWorker.scheduleNext(this@App, false)
|
||||
else
|
||||
@ -474,8 +473,8 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
||||
}
|
||||
|
||||
fun checkDevModePassword() {
|
||||
devMode = try {
|
||||
Utils.AESCrypt.decrypt("nWFVxY65Pa8/aRrT7EylNAencmOD+IxUY2Gg/beiIWY=", config.devModePassword) == "ok here you go it's enabled now" || BuildConfig.DEBUG
|
||||
devMode = devMode || try {
|
||||
Utils.AESCrypt.decrypt("nWFVxY65Pa8/aRrT7EylNAencmOD+IxUY2Gg/beiIWY=", config.devModePassword) == "ok here you go it's enabled now"
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
false
|
||||
|
@ -145,7 +145,7 @@ abstract class Data(val app: App, val profile: Profile?, val loginStore: LoginSt
|
||||
val db: AppDb by lazy { app.db }
|
||||
|
||||
init {
|
||||
if (App.debugMode) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
fakeLogin = loginStore.hasLoginData("fakeLogin")
|
||||
}
|
||||
clear()
|
||||
|
@ -11,6 +11,7 @@ import kotlinx.coroutines.launch
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.data.db.entity.ConfigEntry
|
||||
import pl.szczodrzynski.edziennik.ext.takePositive
|
||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
abstract class BaseConfig<T>(
|
||||
@ -19,6 +20,9 @@ abstract class BaseConfig<T>(
|
||||
val profileId: Int? = null,
|
||||
protected var entries: List<ConfigEntry>? = null,
|
||||
) : CoroutineScope {
|
||||
companion object {
|
||||
private const val TAG = "BaseConfig"
|
||||
}
|
||||
|
||||
private val job = Job()
|
||||
override val coroutineContext: CoroutineContext
|
||||
@ -66,6 +70,7 @@ abstract class BaseConfig<T>(
|
||||
operator fun set(key: String, value: String?) {
|
||||
values[key] = value
|
||||
launch(Dispatchers.IO) {
|
||||
d(TAG, "Setting config value ($profileId): $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) {
|
||||
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)) {
|
||||
val notification = Notification(
|
||||
id = System.currentTimeMillis(),
|
||||
|
@ -254,6 +254,11 @@ class FeedbackFragment : Fragment(), CoroutineScope {
|
||||
message
|
||||
} ?: return@launch
|
||||
|
||||
if (message.text.startsWith("devmode")) {
|
||||
app.config.devModePassword = message.text.substringAfter("devmode")
|
||||
app.checkDevModePassword()
|
||||
}
|
||||
|
||||
b.chatLayout.visibility = View.VISIBLE
|
||||
b.inputLayout.visibility = View.GONE
|
||||
|
||||
|
@ -25,6 +25,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.BuildConfig
|
||||
import pl.szczodrzynski.edziennik.R
|
||||
import pl.szczodrzynski.edziennik.data.enums.LoginMode
|
||||
import pl.szczodrzynski.edziennik.data.enums.LoginType
|
||||
@ -256,7 +257,7 @@ class LoginFormFragment : Fragment(), CoroutineScope {
|
||||
"loginMode" to loginMode
|
||||
)
|
||||
|
||||
if (App.debugMode && b.fakeLogin.isChecked) {
|
||||
if (BuildConfig.DEBUG && b.fakeLogin.isChecked) {
|
||||
payload.putBoolean("fakeLogin", true)
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.BuildConfig
|
||||
import pl.szczodrzynski.edziennik.R
|
||||
import pl.szczodrzynski.edziennik.databinding.LoginPrizeFragmentBinding
|
||||
import pl.szczodrzynski.edziennik.ext.onClick
|
||||
@ -67,8 +68,8 @@ class LoginPrizeFragment : Fragment(), CoroutineScope {
|
||||
.show()
|
||||
}
|
||||
.setNegativeButton(R.string.no) { _, _ ->
|
||||
app.config.devMode = App.debugMode
|
||||
App.devMode = App.debugMode
|
||||
app.config.devMode = BuildConfig.DEBUG
|
||||
App.devMode = BuildConfig.DEBUG
|
||||
activity.finish()
|
||||
}
|
||||
.show()
|
||||
|
@ -55,7 +55,7 @@ class BuildManager(val app: App) : CoroutineScope {
|
||||
get() {
|
||||
val info = app.packageManager.getApplicationInfo(app.packageName, PackageManager.GET_META_DATA)
|
||||
val metadata = info.metaData
|
||||
return metadata?.getFloat("buildTimestamp")?.toLong() ?: 0
|
||||
return metadata?.getString("buildTimestamp")?.toLongOrNull() ?: 0
|
||||
}
|
||||
|
||||
val gitHash = BuildConfig.GIT_INFO["hash"]
|
||||
|
@ -7,6 +7,7 @@
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
android.enableJetifier=true
|
||||
android.enableR8.fullMode=false
|
||||
android.ndk.suppressMinSdkVersionError=21
|
||||
android.nonFinalResIds=true
|
||||
android.nonTransitiveRClass=false
|
||||
|
Loading…
x
Reference in New Issue
Block a user