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

Commit c010d7b

Browse files
committed
Release 0.1.1
- 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
1 parent 6574115 commit c010d7b

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
applicationId "com.fox2code.mmm"
1111
minSdk 21
1212
targetSdk 30
13-
versionCode 4
14-
versionName "0.1.0"
13+
versionCode 5
14+
versionName "0.1.1"
1515

1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1717
}

app/src/main/java/com/fox2code/mmm/manager/ModuleManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.fox2code.mmm.manager;
22

33
import android.content.SharedPreferences;
4+
import android.util.Log;
45

56
import com.fox2code.mmm.MainApplication;
67
import com.fox2code.mmm.utils.PropUtils;
@@ -11,6 +12,8 @@
1112
import java.util.Iterator;
1213

1314
public final class ModuleManager {
15+
private static final String TAG = "ModuleManager";
16+
1417
private static final int FLAG_MM_INVALID = ModuleInfo.FLAG_METADATA_INVALID;
1518
private static final int FLAG_MM_UNPROCESSED = 0x40000000;
1619
private static final int FLAGS_RESET_INIT = FLAG_MM_INVALID |
@@ -117,6 +120,7 @@ private boolean scanInternal() {
117120
PropUtils.readProperties(moduleInfo,
118121
"/data/adb/modules/" + module + "/module.prop");
119122
} catch (Exception e) {
123+
Log.d(TAG, "Failed to parse metadata!", e);
120124
moduleInfo.flags |= FLAG_MM_INVALID;
121125
}
122126
}
@@ -136,6 +140,7 @@ private boolean scanInternal() {
136140
PropUtils.readProperties(moduleInfo,
137141
"/data/adb/modules_update/" + module + "/module.prop");
138142
} catch (Exception e) {
143+
Log.d(TAG, "Failed to parse metadata!", e);
139144
moduleInfo.flags |= FLAG_MM_INVALID;
140145
}
141146
}

app/src/main/java/com/fox2code/mmm/utils/PropUtils.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.io.InputStreamReader;
1111
import java.nio.charset.StandardCharsets;
1212
import java.util.HashMap;
13+
import java.util.Locale;
1314

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

4648
public static void readProperties(ModuleInfo moduleInfo, String file) throws IOException {
47-
boolean readId = false, readVersionCode = false;
49+
boolean readId = false, readIdSec = false, readVersionCode = false;
4850
try (BufferedReader bufferedReader = new BufferedReader(
4951
new InputStreamReader(SuFileInputStream.open(file), StandardCharsets.UTF_8))) {
5052
String line;
@@ -63,7 +65,12 @@ public static void readProperties(ModuleInfo moduleInfo, String file) throws IOE
6365
}
6466
break;
6567
case "name":
68+
if (readIdSec && !moduleInfo.id.equals(value))
69+
throw new IOException("Duplicate module name!");
6670
moduleInfo.name = value;
71+
if (moduleInfo.id.equals(value)) {
72+
readIdSec = true;
73+
}
6774
break;
6875
case "version":
6976
moduleInfo.version = value;
@@ -124,7 +131,13 @@ public static void readProperties(ModuleInfo moduleInfo, String file) throws IOE
124131
}
125132
}
126133
if (!readId) {
127-
throw new IOException("Didn't read module id at least once!");
134+
if (readIdSec) {
135+
// Using the name for module id is not really appropriate, so beautify it a bit
136+
moduleInfo.name = moduleInfo.id.substring(0, 1).toUpperCase(Locale.ROOT) +
137+
moduleInfo.id.substring(1).replace('_', ' ');
138+
} else {
139+
throw new IOException("Didn't read module id at least once!");
140+
}
128141
}
129142
if (!readVersionCode) {
130143
throw new IOException("Didn't read module versionCode at least once!");

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
mavenCentral()
66
gradlePluginPortal()
77
}
8-
project.ext.latestAboutLibsRelease = "8.9.3"
8+
project.ext.latestAboutLibsRelease = "8.9.4"
99
dependencies {
1010
classpath "com.android.tools.build:gradle:7.0.3"
1111
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:${latestAboutLibsRelease}"

0 commit comments

Comments
 (0)