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: push:
branches: branches:
- master # run the action on your projects default branch - master # run the action on your projects default branch
pull_request: paths-ignore:
branches: - '**.md'
- master # run the action on your projects default branch
jobs: jobs:
build: 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 com.fox2code.mmm.utils.io.net.Http.Companion.doHttpGet
import org.json.JSONObject import org.json.JSONObject
import timber.log.Timber import timber.log.Timber
import java.io.BufferedReader
import java.io.File import java.io.File
import java.io.FileInputStream import java.io.FileInputStream
import java.io.IOException import java.io.IOException
import java.io.InputStream import java.io.InputStream
import java.io.InputStreamReader
import java.nio.charset.StandardCharsets import java.nio.charset.StandardCharsets
// See https://docs.github.com/en/rest/reference/repos#releases // 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() return if (!BuildConfig.ENABLE_AUTO_UPDATER || BuildConfig.DEBUG) false else peekShouldUpdate()
} }
@Suppress("UNUSED_PARAMETER")
@Throws(IOException::class) @Throws(IOException::class)
private fun parseCompatibilityFlags(inputStream: InputStream) { private fun parseCompatibilityFlags(inputStream: InputStream) {
compatDataId.clear() compatDataId.clear()
val bufferedReader = BufferedReader(InputStreamReader(inputStream, StandardCharsets.UTF_8)) Timber.d("Not implemented")
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()
} }
fun getCompatibilityFlags(moduleId: String): Int { fun getCompatibilityFlags(moduleId: String): Int {
@ -145,6 +106,7 @@ class AppUpdateManager private constructor() {
return compatFlags ?: 0 return compatFlags ?: 0
} }
@Suppress("MemberVisibilityCanBePrivate")
companion object { companion object {
const val FLAG_COMPAT_LOW_QUALITY = 0x0001 const val FLAG_COMPAT_LOW_QUALITY = 0x0001
const val FLAG_COMPAT_NO_EXT = 0x0002 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) Timber.i("A1: %s", moduleManager.modules.size)
for (moduleInfo in moduleManager.modules.values) { for (moduleInfo in moduleManager.modules.values) {
// add the local module to the list in MainActivity // add the local module to the list in MainActivity
MainActivity.localModuleInfoList.add(moduleInfo) MainActivity.localModuleInfoList += moduleInfo
var moduleHolder = mappedModuleHolders[moduleInfo.id] var moduleHolder = mappedModuleHolders[moduleInfo.id]
if (moduleHolder == null) { if (moduleHolder == null) {
mappedModuleHolders[moduleInfo.id] = ModuleHolder(moduleInfo.id).also { 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() val no32bitSupport = Build.SUPPORTED_32_BIT_ABIS.isEmpty()
for (repoModule in repoManager.modules.values) { for (repoModule in repoManager.modules.values) {
// add the remote module to the list in MainActivity // add the remote module to the list in MainActivity
MainActivity.onlineModuleInfoList.add(repoModule) MainActivity.onlineModuleInfoList += repoModule
// if repoData is null, something is wrong // if repoData is null, something is wrong
@Suppress("SENSELESS_COMPARISON")
if (repoModule.repoData == null) { if (repoModule.repoData == null) {
Timber.w("RepoData is null for module %s", repoModule.id) Timber.w("RepoData is null for module %s", repoModule.id)
continue continue

@ -103,7 +103,7 @@ public class RepoData extends XRepo {
this.metaDataCache = null; this.metaDataCache = null;
this.moduleHashMap = new HashMap<>(); this.moduleHashMap = new HashMap<>();
this.defaultName = url; // Set url as default name 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 // 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(); 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); Realm realm = Realm.getInstance(realmConfiguration);
@ -334,7 +334,7 @@ public class RepoData extends XRepo {
return; return;
} }
// if repo starts with repo_, it's always enabled bc custom repos can't be disabled without being deleted. // 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 // 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(); 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); Realm realm2 = Realm.getInstance(realmConfiguration2);

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

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

Loading…
Cancel
Save