more fixes

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/277/head
androidacy-user 1 year ago
parent d7f8c02302
commit c92f26d65f

@ -65,18 +65,6 @@ public final class AndroidacyRepoData extends RepoData {
public AndroidacyRepoData(File cacheRoot, SharedPreferences cachedPreferences, boolean testMode) {
super(testMode ? RepoManager.ANDROIDACY_TEST_MAGISK_REPO_ENDPOINT : RepoManager.ANDROIDACY_MAGISK_REPO_ENDPOINT, cacheRoot, cachedPreferences);
// make sure the modules.json exists
File modulesJson = new File(cacheRoot, "modules.json");
if (!modulesJson.exists()) {
try {
if (!modulesJson.createNewFile()) {
throw new IOException("Failed to create modules.json");
}
} catch (
IOException e) {
e.printStackTrace();
}
}
this.defaultName = "Androidacy Modules Repo";
this.defaultWebsite = RepoManager.ANDROIDACY_MAGISK_REPO_HOMEPAGE;
this.defaultSupport = "https://t.me/androidacy_discussions";

@ -13,6 +13,7 @@ import com.fox2code.mmm.MainApplication;
import com.fox2code.mmm.R;
import com.fox2code.mmm.XRepo;
import com.fox2code.mmm.manager.ModuleInfo;
import com.fox2code.mmm.utils.db.ModuleCache;
import com.fox2code.mmm.utils.io.Files;
import com.fox2code.mmm.utils.io.PropUtils;
@ -47,7 +48,8 @@ public class RepoData extends XRepo {
this.id = RepoManager.internalIdOfUrl(url);
this.cacheRoot = cacheRoot;
this.cachedPreferences = cachedPreferences;
this.metaDataCache = new File(cacheRoot, "modules.json");
assert ModuleCache.getInstance() != null;
this.metaDataCache = ModuleCache.getInstance().moduleDao();
this.moduleHashMap = new HashMap<>();
this.defaultName = url; // Set url as default name
this.forceHide = AppUpdateManager.shouldForceHide(this.id);
@ -59,6 +61,11 @@ public class RepoData extends XRepo {
throw new RuntimeException("Failed to create cache directory");
}
} else {
// ensure module cache db is created
ModuleCache.getInstance().moduleDao();
// get all modules from the db as a json object
//JSONObject modules = new JSONObject();
// TODO: migrate this to db format. Storing the cache in a json file is a bad idea
if (this.metaDataCache.exists()) {
this.lastUpdate = metaDataCache.lastModified();
if (this.lastUpdate > System.currentTimeMillis()) {

@ -28,4 +28,9 @@ public abstract class ModuleCache extends RoomDatabase {
// db structure is: internal name, pretty name, repo url, enabled
// create the database
public abstract <ModuleDao> ModuleDao moduleDao();
// returns the instance
public static ModuleCache getInstance() {
return null;
}
}

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="colorSecondaryContainer" format="color" />
<attr name="colorSecondary" format="color" />
<attr name="colorPrimarySurface" format="color" />
</resources>

@ -15,8 +15,8 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:Reserv
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
# android.enableJetifier=true
# Automatically convert third-` 1party libraries to use AndroidX
android.enableJetifier=true
# Fox builds props mods
org.gradle.parallel=true

Loading…
Cancel
Save