various upgrades

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/31/head
androidacy-user 2 years ago
parent 573e54a324
commit 8ac8ac40b0

@ -3,9 +3,8 @@ on:
push:
branches:
- master # run the action on your projects default branch
pull_request:
branches:
- master # run the action on your projects default branch
paths-ignore:
- '**.md'
jobs:
build:

@ -4,12 +4,10 @@ import com.fox2code.mmm.utils.io.Files.Companion.write
import com.fox2code.mmm.utils.io.net.Http.Companion.doHttpGet
import org.json.JSONObject
import timber.log.Timber
import java.io.BufferedReader
import java.io.File
import java.io.FileInputStream
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.nio.charset.StandardCharsets
// See https://docs.github.com/en/rest/reference/repos#releases
@ -96,48 +94,11 @@ class AppUpdateManager private constructor() {
return if (!BuildConfig.ENABLE_AUTO_UPDATER || BuildConfig.DEBUG) false else peekShouldUpdate()
}
@Suppress("UNUSED_PARAMETER")
@Throws(IOException::class)
private fun parseCompatibilityFlags(inputStream: InputStream) {
compatDataId.clear()
val bufferedReader = BufferedReader(InputStreamReader(inputStream, StandardCharsets.UTF_8))
var line: String
while (bufferedReader.readLine().also { line = it } != null) {
line = line.trim { it <= ' ' }
if (line.isEmpty() || line.startsWith("#")) continue
val i = line.indexOf('/')
if (i == -1) continue
var value = 0
for (arg in line.substring(i + 1).split(",".toRegex()).dropLastWhile { it.isEmpty() }
.toTypedArray()) {
when (arg) {
"lowQuality" -> value = value or FLAG_COMPAT_LOW_QUALITY
"noExt" -> value = value or FLAG_COMPAT_NO_EXT
"magiskCmd" -> value = value or FLAG_COMPAT_MAGISK_CMD
"need32bit" -> value = value or FLAG_COMPAT_NEED_32BIT
"malware" -> value = value or FLAG_COMPAT_MALWARE
"noANSI" -> value = value or FLAG_COMPAT_NO_ANSI
"forceANSI" -> value = value or FLAG_COMPAT_FORCE_ANSI
"forceHide" -> value = value or FLAG_COMPAT_FORCE_HIDE
"mmtReborn" -> value = value or FLAG_COMPAT_MMT_REBORN
"wrapper" -> value = value or FLAG_COMPAT_ZIP_WRAPPER
else -> {
run {}
value = value or FLAG_COMPAT_LOW_QUALITY
value = value or FLAG_COMPAT_NO_EXT
value = value or FLAG_COMPAT_MAGISK_CMD
value = value or FLAG_COMPAT_NEED_32BIT
value = value or FLAG_COMPAT_MALWARE
value = value or FLAG_COMPAT_NO_ANSI
value = value or FLAG_COMPAT_FORCE_ANSI
value = value or FLAG_COMPAT_FORCE_HIDE
value = value or FLAG_COMPAT_MMT_REBORN
value = value or FLAG_COMPAT_ZIP_WRAPPER
}
}
}
compatDataId[line.substring(0, i)] = value
}
bufferedReader.close()
Timber.d("Not implemented")
}
fun getCompatibilityFlags(moduleId: String): Int {
@ -145,6 +106,7 @@ class AppUpdateManager private constructor() {
return compatFlags ?: 0
}
@Suppress("MemberVisibilityCanBePrivate")
companion object {
const val FLAG_COMPAT_LOW_QUALITY = 0x0001
const val FLAG_COMPAT_NO_EXT = 0x0002

File diff suppressed because it is too large Load Diff

@ -50,7 +50,7 @@ class ModuleViewListBuilder(private val activity: Activity) {
Timber.i("A1: %s", moduleManager.modules.size)
for (moduleInfo in moduleManager.modules.values) {
// add the local module to the list in MainActivity
MainActivity.localModuleInfoList.add(moduleInfo)
MainActivity.localModuleInfoList += moduleInfo
var moduleHolder = mappedModuleHolders[moduleInfo.id]
if (moduleHolder == null) {
mappedModuleHolders[moduleInfo.id] = ModuleHolder(moduleInfo.id).also {
@ -78,8 +78,9 @@ class ModuleViewListBuilder(private val activity: Activity) {
val no32bitSupport = Build.SUPPORTED_32_BIT_ABIS.isEmpty()
for (repoModule in repoManager.modules.values) {
// add the remote module to the list in MainActivity
MainActivity.onlineModuleInfoList.add(repoModule)
MainActivity.onlineModuleInfoList += repoModule
// if repoData is null, something is wrong
@Suppress("SENSELESS_COMPARISON")
if (repoModule.repoData == null) {
Timber.w("RepoData is null for module %s", repoModule.id)
continue

@ -103,7 +103,7 @@ public class RepoData extends XRepo {
this.metaDataCache = null;
this.moduleHashMap = new HashMap<>();
this.defaultName = url; // Set url as default name
this.forceHide = AppUpdateManager.shouldForceHide(this.id);
this.forceHide = AppUpdateManager.Companion.shouldForceHide(getPreferenceId());
// this.enable is set from the database
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().name("ReposList.realm").encryptionKey(MainApplication.getINSTANCE().getKey()).allowQueriesOnUiThread(true).allowWritesOnUiThread(true).directory(MainApplication.getINSTANCE().getDataDirWithPath("realms")).schemaVersion(1).build();
Realm realm = Realm.getInstance(realmConfiguration);
@ -334,7 +334,7 @@ public class RepoData extends XRepo {
return;
}
// if repo starts with repo_, it's always enabled bc custom repos can't be disabled without being deleted.
this.forceHide = AppUpdateManager.shouldForceHide(this.id);
this.forceHide = AppUpdateManager.Companion.shouldForceHide(getPreferenceId());
// reposlist realm
RealmConfiguration realmConfiguration2 = new RealmConfiguration.Builder().name("ReposList.realm").encryptionKey(MainApplication.getINSTANCE().getKey()).allowQueriesOnUiThread(true).allowWritesOnUiThread(true).directory(MainApplication.getINSTANCE().getDataDirWithPath("realms")).schemaVersion(1).build();
Realm realm2 = Realm.getInstance(realmConfiguration2);

@ -12,9 +12,10 @@ import timber.log.Timber
import java.nio.charset.StandardCharsets
import java.util.concurrent.atomic.AtomicBoolean
class RepoUpdater(val repoData2: RepoData) {
class RepoUpdater(repoData2: RepoData) {
private var indexRaw: ByteArray? = null
@JvmField public var repoData: RepoData = repoData2
@JvmField
var repoData: RepoData = repoData2
private var toUpdate: List<RepoModule>? = null
private var toApply: Collection<RepoModule>? = null
fun fetchIndex(): Int {

@ -445,7 +445,7 @@ enum class IntentHelper {;
openFileTo(compatActivity!!, destination, object : OnFileReceivedCallback {
override fun onReceived(target: File?, uri: Uri?, response: Int) {
if (response == RESPONSE_ERROR) {
MainActivity.getFoxActivity(compatActivity)?.runOnUiThread {
MainActivity.getFoxActivity(compatActivity).runOnUiThread {
Toast.makeText(
compatActivity, R.string.no_file_provided, Toast.LENGTH_SHORT
).show()

Loading…
Cancel
Save