Populate Config variables based on update channel parameters.
With thanks to @diareuse.
This commit is contained in:
parent
7918fc3528
commit
ed43ec8ea2
@ -3,6 +3,7 @@ package com.topjohnwu.magisk.data.repository
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import com.topjohnwu.magisk.App
|
import com.topjohnwu.magisk.App
|
||||||
|
import com.topjohnwu.magisk.Config
|
||||||
import com.topjohnwu.magisk.KConfig
|
import com.topjohnwu.magisk.KConfig
|
||||||
import com.topjohnwu.magisk.data.database.base.su
|
import com.topjohnwu.magisk.data.database.base.su
|
||||||
import com.topjohnwu.magisk.data.database.base.suRaw
|
import com.topjohnwu.magisk.data.database.base.suRaw
|
||||||
@ -52,6 +53,17 @@ class MagiskRepository(
|
|||||||
KConfig.UpdateChannel.CANARY_DEBUG -> apiRaw.fetchCanaryDebugConfig()
|
KConfig.UpdateChannel.CANARY_DEBUG -> apiRaw.fetchCanaryDebugConfig()
|
||||||
KConfig.UpdateChannel.CUSTOM -> apiRaw.fetchCustomConfig(KConfig.customUpdateChannel)
|
KConfig.UpdateChannel.CUSTOM -> apiRaw.fetchCustomConfig(KConfig.customUpdateChannel)
|
||||||
}
|
}
|
||||||
|
.doOnSuccess {
|
||||||
|
Config.remoteMagiskVersionCode = it.magisk.versionCode.toIntOrNull() ?: 0
|
||||||
|
Config.magiskLink = it.magisk.link
|
||||||
|
Config.magiskNoteLink = it.magisk.note
|
||||||
|
Config.magiskMD5 = it.magisk.hash
|
||||||
|
Config.remoteManagerVersionCode = it.app.versionCode.toIntOrNull() ?: 0
|
||||||
|
Config.remoteManagerVersionString = it.app.version
|
||||||
|
Config.managerLink = it.app.link
|
||||||
|
Config.managerNoteLink = it.app.note
|
||||||
|
Config.uninstallerLink = it.uninstaller.link
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun fetchMagiskVersion(): Single<Version> = Single.zip(
|
fun fetchMagiskVersion(): Single<Version> = Single.zip(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user