mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 10:54:36 -06:00
[App] Fix detecting signed builds.
This commit is contained in:
parent
1108f2eb71
commit
114d855c81
@ -14,6 +14,7 @@ import pl.szczodrzynski.edziennik.*
|
|||||||
import pl.szczodrzynski.edziennik.data.api.szkolny.interceptor.Signing
|
import pl.szczodrzynski.edziennik.data.api.szkolny.interceptor.Signing
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.base.BuildInvalidActivity
|
import pl.szczodrzynski.edziennik.ui.modules.base.BuildInvalidActivity
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils
|
import pl.szczodrzynski.edziennik.utils.Utils
|
||||||
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
import java.time.ZonedDateTime
|
import java.time.ZonedDateTime
|
||||||
@ -42,7 +43,7 @@ class BuildManager(val app: App) : CoroutineScope {
|
|||||||
var gitRemote: String? = ""
|
var gitRemote: String? = ""
|
||||||
var gitAuthor: String? = ""
|
var gitAuthor: String? = ""
|
||||||
|
|
||||||
val isSigned = Signing.appCertificate.md5() == "d8bab5259fda7d72121fe5db526a3d4d"
|
val isSigned = Signing.appCertificate.md5() == "f98c600d6ea0cb5bc40ffc8e6f7824ac"
|
||||||
|
|
||||||
val isPlayRelease = isRelease && buildFlavor == "play"
|
val isPlayRelease = isRelease && buildFlavor == "play"
|
||||||
val isApkRelease = isRelease && buildFlavor == "official"
|
val isApkRelease = isRelease && buildFlavor == "official"
|
||||||
@ -188,14 +189,7 @@ class BuildManager(val app: App) : CoroutineScope {
|
|||||||
fun validateBuild(activity: AppCompatActivity) {
|
fun validateBuild(activity: AppCompatActivity) {
|
||||||
launch {
|
launch {
|
||||||
gitRemote = getRemoteRepo()
|
gitRemote = getRemoteRepo()
|
||||||
if (gitRemote == null && !isDebug) {
|
d("BuildManager", "isSigned = $isSigned, buildType = $buildType, buildFlavor = $buildFlavor, remote = $gitRemote")
|
||||||
invalidateBuild(activity, null, InvalidBuildReason.NO_REMOTE_REPO)
|
|
||||||
return@launch
|
|
||||||
}
|
|
||||||
if (gitHash == null) {
|
|
||||||
invalidateBuild(activity, null, InvalidBuildReason.NO_COMMIT_HASH)
|
|
||||||
return@launch
|
|
||||||
}
|
|
||||||
|
|
||||||
// officially signed package
|
// officially signed package
|
||||||
if (isSigned)
|
if (isSigned)
|
||||||
@ -207,6 +201,16 @@ class BuildManager(val app: App) : CoroutineScope {
|
|||||||
return@launch
|
return@launch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// probably no git repository, disabled on debug
|
||||||
|
if (gitRemote == null && !isDebug) {
|
||||||
|
invalidateBuild(activity, null, InvalidBuildReason.NO_REMOTE_REPO)
|
||||||
|
return@launch
|
||||||
|
}
|
||||||
|
if (gitHash == null) {
|
||||||
|
invalidateBuild(activity, null, InvalidBuildReason.NO_COMMIT_HASH)
|
||||||
|
return@launch
|
||||||
|
}
|
||||||
|
|
||||||
// debug build, invalidate once
|
// debug build, invalidate once
|
||||||
if (isDebug) {
|
if (isDebug) {
|
||||||
if (app.config.validation != "debug${Signing.appCertificate}".md5()) {
|
if (app.config.validation != "debug${Signing.appCertificate}".md5()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user