tweaks + improvements

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/89/head
androidacy-user 2 years ago
parent 8af585e12e
commit bfc530fb7c

@ -28,6 +28,8 @@ import com.fox2code.foxcompat.app.internal.FoxProcessExt
import com.fox2code.foxcompat.view.FoxThemeWrapper
import com.fox2code.mmm.installer.InstallerInitializer
import com.fox2code.mmm.installer.InstallerInitializer.Companion.peekMagiskVersion
import com.fox2code.mmm.manager.LocalModuleInfo
import com.fox2code.mmm.repo.RepoModule
import com.fox2code.mmm.utils.TimberUtils.configTimber
import com.fox2code.mmm.utils.io.FileUtils
import com.fox2code.mmm.utils.io.GMSProviderInstaller.Companion.installIfNeeded
@ -79,6 +81,9 @@ class MainApplication : FoxApplication(), Configuration.Provider {
private var makingNewKey = false
private var isCrashHandler = false
var localModules: HashMap<String, LocalModuleInfo> = HashMap()
var repoModules: HashMap<String, RepoModule> = HashMap()
init {
check(!(INSTANCE != null && INSTANCE !== this)) { "Duplicate application instance!" }
INSTANCE = this

@ -207,14 +207,14 @@ class ModuleManager private constructor() : SyncManager() {
var modules: HashMap<String, LocalModuleInfo> = HashMap()
get() {
Timber.d("getModules")
afterScan()
return moduleInfos
}
set(value) {
Timber.d("setModules")
// add to MainApplication.INSTANCE!!.localModules hashmap
field = value
moduleInfos = value
MainApplication.INSTANCE!!.localModules = value
}
@Suppress("unused")

@ -342,12 +342,12 @@ open class RepoData(url: String, cacheRoot: File) : XRepo() {
readProperties(
moduleInfo,
file.absolutePath,
repoModule.repoName + "/" + moduleInfo.name,
"${repoModule.repoName}/${moduleInfo.name}",
false
)
moduleInfo.flags = moduleInfo.flags and ModuleInfo.FLAG_METADATA_INVALID.inv()
if (moduleInfo.version == null) {
moduleInfo.version = "v" + moduleInfo.versionCode
moduleInfo.version = "v${moduleInfo.versionCode}"
}
return true
} catch (ignored: Exception) {

@ -97,6 +97,8 @@ class RepoUpdater(repoData2: RepoData) {
toUpdate = repoData.populate(JSONObject(String(indexRaw!!, StandardCharsets.UTF_8)))
// Since we reuse instances this should work
toApply = HashSet(repoData.moduleHashMap.values)
// add toApply to the hashmap MainApplication.INSTANCE!!.repoModules
MainApplication.INSTANCE!!.repoModules.putAll(repoData.moduleHashMap)
(toUpdate as MutableList<RepoModule>?)?.let {
(toApply as HashSet<RepoModule>).removeAll(
it.toSet()

Loading…
Cancel
Save