diff --git a/app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java b/app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java index bb6340a..b436d30 100644 --- a/app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java +++ b/app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java @@ -65,6 +65,18 @@ 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"; diff --git a/app/src/main/java/com/fox2code/mmm/repo/RepoData.java b/app/src/main/java/com/fox2code/mmm/repo/RepoData.java index fad9c9d..6804f36 100644 --- a/app/src/main/java/com/fox2code/mmm/repo/RepoData.java +++ b/app/src/main/java/com/fox2code/mmm/repo/RepoData.java @@ -13,7 +13,6 @@ 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; @@ -48,8 +47,7 @@ public class RepoData extends XRepo { this.id = RepoManager.internalIdOfUrl(url); this.cacheRoot = cacheRoot; this.cachedPreferences = cachedPreferences; - assert ModuleCache.getInstance() != null; - this.metaDataCache = ModuleCache.getInstance().moduleDao(); + this.metaDataCache = new File(cacheRoot, "modules.json"); this.moduleHashMap = new HashMap<>(); this.defaultName = url; // Set url as default name this.forceHide = AppUpdateManager.shouldForceHide(this.id); @@ -61,11 +59,6 @@ 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()) { diff --git a/app/src/main/java/com/fox2code/mmm/utils/db/ModuleCache.java b/app/src/main/java/com/fox2code/mmm/utils/db/ModuleCache.java index 5654c6a..e569981 100644 --- a/app/src/main/java/com/fox2code/mmm/utils/db/ModuleCache.java +++ b/app/src/main/java/com/fox2code/mmm/utils/db/ModuleCache.java @@ -28,9 +28,4 @@ public abstract class ModuleCache extends RoomDatabase { // db structure is: internal name, pretty name, repo url, enabled // create the database public abstract ModuleDao moduleDao(); - - // returns the instance - public static ModuleCache getInstance() { - return null; - } } diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml deleted file mode 100644 index 422b4db..0000000 --- a/app/src/main/res/values/attrs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 74feaae..3cce4fe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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-` 1party libraries to use AndroidX -android.enableJetifier=true +# Automatically convert third-party libraries to use AndroidX +# android.enableJetifier=true # Fox builds props mods org.gradle.parallel=true