Skip to content
This repository has been archived by the owner on May 4, 2023. It is now read-only.

Commit

Permalink
Release 0.1.1
Browse files Browse the repository at this point in the history
- Improve the reading of invalid `module.prop` files
  (Should fix Substratum not appearing in the module list)
- Add fallback support link for substratum
- Update Libraries
  • Loading branch information
Fox2Code committed Oct 24, 2021
1 parent 6574115 commit c010d7b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.fox2code.mmm"
minSdk 21
targetSdk 30
versionCode 4
versionName "0.1.0"
versionCode 5
versionName "0.1.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/com/fox2code/mmm/manager/ModuleManager.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.fox2code.mmm.manager;

import android.content.SharedPreferences;
import android.util.Log;

import com.fox2code.mmm.MainApplication;
import com.fox2code.mmm.utils.PropUtils;
Expand All @@ -11,6 +12,8 @@
import java.util.Iterator;

public final class ModuleManager {
private static final String TAG = "ModuleManager";

private static final int FLAG_MM_INVALID = ModuleInfo.FLAG_METADATA_INVALID;
private static final int FLAG_MM_UNPROCESSED = 0x40000000;
private static final int FLAGS_RESET_INIT = FLAG_MM_INVALID |
Expand Down Expand Up @@ -117,6 +120,7 @@ private boolean scanInternal() {
PropUtils.readProperties(moduleInfo,
"/data/adb/modules/" + module + "/module.prop");
} catch (Exception e) {
Log.d(TAG, "Failed to parse metadata!", e);
moduleInfo.flags |= FLAG_MM_INVALID;
}
}
Expand All @@ -136,6 +140,7 @@ private boolean scanInternal() {
PropUtils.readProperties(moduleInfo,
"/data/adb/modules_update/" + module + "/module.prop");
} catch (Exception e) {
Log.d(TAG, "Failed to parse metadata!", e);
moduleInfo.flags |= FLAG_MM_INVALID;
}
}
Expand Down
19 changes: 16 additions & 3 deletions app/src/main/java/com/fox2code/mmm/utils/PropUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Locale;

public class PropUtils {
private static final HashMap<String, String> moduleSupportsFallbacks = new HashMap<>();
Expand All @@ -24,7 +25,8 @@ public class PropUtils {
moduleSupportsFallbacks.put("aospill", "https://t.me/PannekoX");
moduleSupportsFallbacks.put("quickstepswitcher", "https://t.me/QuickstepSwitcherSupport");
moduleSupportsFallbacks.put("riru_edxposed", "https://t.me/EdXposed");
moduleSupportsFallbacks.put("riru_lsposed", "https://github.com/LSPosed/LSPosed/issues/");
moduleSupportsFallbacks.put("riru_lsposed", "https://github.com/LSPosed/LSPosed/issues");
moduleSupportsFallbacks.put("substratum", "https://github.com/substratum/substratum/issues");
// Config are application installed by modules that allow them to be configured
moduleConfigsFallbacks.put("quickstepswitcher", "xyz.paphonb.quickstepswitcher");
moduleConfigsFallbacks.put("riru_edxposed", "org.meowcat.edxposed.manager");
Expand All @@ -44,7 +46,7 @@ public class PropUtils {
}

public static void readProperties(ModuleInfo moduleInfo, String file) throws IOException {
boolean readId = false, readVersionCode = false;
boolean readId = false, readIdSec = false, readVersionCode = false;
try (BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(SuFileInputStream.open(file), StandardCharsets.UTF_8))) {
String line;
Expand All @@ -63,7 +65,12 @@ public static void readProperties(ModuleInfo moduleInfo, String file) throws IOE
}
break;
case "name":
if (readIdSec && !moduleInfo.id.equals(value))
throw new IOException("Duplicate module name!");
moduleInfo.name = value;
if (moduleInfo.id.equals(value)) {
readIdSec = true;
}
break;
case "version":
moduleInfo.version = value;
Expand Down Expand Up @@ -124,7 +131,13 @@ public static void readProperties(ModuleInfo moduleInfo, String file) throws IOE
}
}
if (!readId) {
throw new IOException("Didn't read module id at least once!");
if (readIdSec) {
// Using the name for module id is not really appropriate, so beautify it a bit
moduleInfo.name = moduleInfo.id.substring(0, 1).toUpperCase(Locale.ROOT) +
moduleInfo.id.substring(1).replace('_', ' ');
} else {
throw new IOException("Didn't read module id at least once!");
}
}
if (!readVersionCode) {
throw new IOException("Didn't read module versionCode at least once!");
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
gradlePluginPortal()
}
project.ext.latestAboutLibsRelease = "8.9.3"
project.ext.latestAboutLibsRelease = "8.9.4"
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:${latestAboutLibsRelease}"
Expand Down

0 comments on commit c010d7b

Please sign in to comment.