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

Commit 5f6e921

Browse files
committed
0.2.5 Release
1 parent 754e389 commit 5f6e921

File tree

14 files changed

+172
-86
lines changed

14 files changed

+172
-86
lines changed

DEVELOPERS.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Index:
1212

1313
## Properties
1414

15-
In addition to the following magisk properties
15+
In addition to the following required magisk properties
1616
```properties
1717
# Magisk supported properties
1818
id=<string>
@@ -22,8 +22,9 @@ versionCode=<int>
2222
author=<string>
2323
description=<string>
2424
```
25+
(Note: The Fox's mmm will not show the module if theses values are not filled properly)
2526

26-
This the manager support these new properties
27+
This the manager support these new optional properties
2728
```properties
2829
# Fox's Mmm supported properties
2930
minApi=<int>
@@ -38,7 +39,7 @@ config=<package>
3839
- `minApi` and `maxApi` tell the manager which is the SDK version range the module support
3940
(See: [Codenames, Tags, and Build Numbers](https://source.android.com/setup/start/build-numbers))
4041
- `minMagisk` tell the manager which is the minimum Magisk version required for the module
41-
(Often for magisk `xx.y` the version code is `xxy00`)
42+
(Often for magisk `xx.y` the version code is `xxyzz`, `zz` being non `00` on canary builds)
4243
- `support` support link to direct users when they need support for you modules
4344
- `donate` donate link to direct users to where they can financially support your project
4445
- `config` package name of the application that configure your module

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ So I made my own app to do that! :3
1010
Minimum:
1111
- Android 5.0+
1212
- Magisk 19.0+
13+
- An internet connection
1314

1415
Recommended:
1516
- Android 6.0+
1617
- Magisk 21.2+
18+
- An internet connection
19+
20+
Note: This app may require the use of a VPN in countries with a state wide firewall.
1721

1822
## For users
1923

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 31
13-
versionCode 14
14-
versionName "0.2.4"
13+
versionCode 15
14+
versionName "0.2.5"
1515

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

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
package="com.fox2code.mmm"
55
tools:ignore="QueryAllPackagesPermission">
66

7+
<!-- Wifi is not the only way to get an internet connection -->
8+
<uses-feature android:name="android.hardware.wifi" android:required="false" />
9+
710
<!-- Retrieve online modules -->
811
<uses-permission android:name="android.permission.INTERNET" />
912
<!-- Make sure of the module active state by checking enabled modules on boot -->

app/src/main/java/com/fox2code/mmm/AppUpdateManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ private AppUpdateManager() {
3737

3838
// Return true if should show a notification
3939
public boolean checkUpdate(boolean force) {
40-
if (this.peekShouldUpdate())
40+
if (!force && this.peekShouldUpdate())
4141
return true;
4242
long lastChecked = this.lastChecked;
43-
if (!force && lastChecked != 0 &&
43+
if (lastChecked != 0 &&
4444
// Avoid spam calls by putting a 10 seconds timer
4545
lastChecked < System.currentTimeMillis() - 10000L)
46-
return false;
46+
return force && this.peekShouldUpdate();
4747
synchronized (this.updateLock) {
4848
if (lastChecked != this.lastChecked)
4949
return this.peekShouldUpdate();

app/src/main/java/com/fox2code/mmm/MainActivity.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.fox2code.mmm.manager.ModuleManager;
2222
import com.fox2code.mmm.repo.RepoManager;
2323
import com.fox2code.mmm.settings.SettingsActivity;
24+
import com.fox2code.mmm.utils.Http;
2425
import com.fox2code.mmm.utils.IntentHelper;
2526
import com.google.android.material.progressindicator.LinearProgressIndicator;
2627

@@ -180,7 +181,7 @@ public void commonNext() {
180181
moduleViewListBuilder.addNotification(NotificationType.SHOWCASE_MODE);
181182
if (!RepoManager.getINSTANCE().hasConnectivity())
182183
moduleViewListBuilder.addNotification(NotificationType.NO_INTERNET);
183-
else if (AppUpdateManager.getAppUpdateManager().checkUpdate(true))
184+
else if (AppUpdateManager.getAppUpdateManager().checkUpdate(false))
184185
moduleViewListBuilder.addNotification(NotificationType.UPDATE_AVAILABLE);
185186
moduleViewListBuilder.appendRemoteModules();
186187
Log.i(TAG, "Common Before applyTo");
@@ -201,8 +202,14 @@ public void onRefresh() {
201202
this.progressIndicator.setProgressCompat(0, false);
202203
// this.swipeRefreshLayout.setRefreshing(true); ??
203204
new Thread(() -> {
205+
Http.cleanDnsCache(); // Allow DNS reload from network
204206
RepoManager.getINSTANCE().update(value -> runOnUiThread(() ->
205-
this.progressIndicator.setProgressCompat((int) (value * PRECISION), true)));
207+
this.progressIndicator.setProgressCompat(
208+
(int) (value * PRECISION), true)));
209+
if (!RepoManager.getINSTANCE().hasConnectivity())
210+
moduleViewListBuilder.addNotification(NotificationType.NO_INTERNET);
211+
else if (AppUpdateManager.getAppUpdateManager().checkUpdate(true))
212+
moduleViewListBuilder.addNotification(NotificationType.UPDATE_AVAILABLE);
206213
runOnUiThread(() -> {
207214
this.progressIndicator.setVisibility(View.GONE);
208215
this.swipeRefreshLayout.setRefreshing(false);

app/src/main/java/com/fox2code/mmm/ModuleViewAdapter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ public boolean update(ModuleHolder moduleHolder) {
261261
int backgroundAttr = R.attr.colorBackgroundFloating;
262262
if (type == ModuleHolder.Type.NOTIFICATION) {
263263
backgroundAttr = moduleHolder.notificationType.backgroundAttr;
264+
} else if (type == ModuleHolder.Type.INSTALLED &&
265+
moduleHolder.hasFlag(ModuleInfo.FLAG_METADATA_INVALID)) {
266+
backgroundAttr = R.attr.colorError;
264267
}
265268
Resources.Theme theme = this.cardView.getContext().getTheme();
266269
TypedValue value = new TypedValue();

app/src/main/java/com/fox2code/mmm/ModuleViewListBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ public void applyTo(RecyclerView moduleList, ModuleViewAdapter moduleViewAdapter
112112
}
113113
}
114114
newNotificationsLen = this.notifications.size() - special;
115-
EnumSet<ModuleHolder.Type> headerTypes = EnumSet.of(
116-
ModuleHolder.Type.NOTIFICATION, ModuleHolder.Type.SEPARATOR);
115+
EnumSet<ModuleHolder.Type> headerTypes = EnumSet.of(ModuleHolder.Type.SEPARATOR,
116+
ModuleHolder.Type.NOTIFICATION, ModuleHolder.Type.FOOTER);
117117
Iterator<ModuleHolder> moduleHolderIterator = this.mappedModuleHolders.values().iterator();
118118
synchronized (this.queryLock) {
119119
while (moduleHolderIterator.hasNext()) {

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

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ public final class ModuleManager {
2121
ModuleInfo.FLAG_MODULE_UNINSTALLING | ModuleInfo.FLAG_MODULE_ACTIVE;
2222
private static final int FLAGS_RESET_UPDATE = FLAG_MM_INVALID | FLAG_MM_UNPROCESSED;
2323
private final HashMap<String, ModuleInfo> moduleInfos;
24-
private final HashMap<String, ModuleInfo> invalidModules;
2524
private final SharedPreferences bootPrefs;
2625
private final Object scanLock = new Object();
27-
private boolean scanning, lastScanResult;
26+
private boolean scanning;
2827

2928
private static final ModuleManager INSTANCE = new ModuleManager();
3029

@@ -34,19 +33,17 @@ public static ModuleManager getINSTANCE() {
3433

3534
private ModuleManager() {
3635
this.moduleInfos = new HashMap<>();
37-
this.invalidModules = new HashMap<>();
3836
this.bootPrefs = MainApplication.getBootSharedPreferences();
3937
}
4038

4139
// MultiThread friendly method
42-
public final boolean scan() {
40+
public final void scan() {
4341
if (!this.scanning) {
4442
// Do scan
4543
synchronized (scanLock) {
4644
this.scanning = true;
4745
try {
48-
this.lastScanResult =
49-
this.scanInternal();
46+
this.scanInternal();
5047
} finally {
5148
this.scanning = false;
5249
}
@@ -55,7 +52,6 @@ public final boolean scan() {
5552
// Wait for current scan
5653
synchronized (scanLock) {}
5754
}
58-
return this.lastScanResult;
5955
}
6056

6157
// Pause execution until the scan is completed if one is currently running
@@ -69,13 +65,9 @@ public final void runAfterScan(Runnable runnable) {
6965
}
7066
}
7167

72-
private boolean scanInternal() {
68+
private void scanInternal() {
7369
boolean firstScan = this.bootPrefs.getBoolean("mm_first_scan", true);
74-
boolean changed = false;
7570
SharedPreferences.Editor editor = firstScan ? this.bootPrefs.edit() : null;
76-
// Reset existing ModuleInfo
77-
this.moduleInfos.putAll(this.invalidModules);
78-
this.invalidModules.clear();
7971
for (ModuleInfo v : this.moduleInfos.values()) {
8072
v.flags |= FLAG_MM_UNPROCESSED;
8173
v.flags &= ~FLAGS_RESET_INIT;
@@ -94,7 +86,6 @@ private boolean scanInternal() {
9486
if (moduleInfo == null) {
9587
moduleInfo = new ModuleInfo(module);
9688
moduleInfos.put(module, moduleInfo);
97-
changed = true;
9889
// Shis should not really happen, but let's handles theses cases anyway
9990
moduleInfo.flags |= ModuleInfo.FLAG_MODULE_UPDATING_ONLY;
10091
}
@@ -118,7 +109,7 @@ private boolean scanInternal() {
118109
}
119110
try {
120111
PropUtils.readProperties(moduleInfo,
121-
"/data/adb/modules/" + module + "/module.prop");
112+
"/data/adb/modules/" + module + "/module.prop", true);
122113
} catch (Exception e) {
123114
Log.d(TAG, "Failed to parse metadata!", e);
124115
moduleInfo.flags |= FLAG_MM_INVALID;
@@ -132,13 +123,12 @@ private boolean scanInternal() {
132123
if (moduleInfo == null) {
133124
moduleInfo = new ModuleInfo(module);
134125
moduleInfos.put(module, moduleInfo);
135-
changed = true;
136126
}
137127
moduleInfo.flags &= ~FLAGS_RESET_UPDATE;
138128
moduleInfo.flags |= ModuleInfo.FLAG_MODULE_UPDATING;
139129
try {
140130
PropUtils.readProperties(moduleInfo,
141-
"/data/adb/modules_update/" + module + "/module.prop");
131+
"/data/adb/modules_update/" + module + "/module.prop", true);
142132
} catch (Exception e) {
143133
Log.d(TAG, "Failed to parse metadata!", e);
144134
moduleInfo.flags |= FLAG_MM_INVALID;
@@ -152,10 +142,6 @@ private boolean scanInternal() {
152142
if ((moduleInfo.flags & FLAG_MM_UNPROCESSED) != 0) {
153143
moduleInfoIterator.remove();
154144
continue; // Don't process fallbacks if unreferenced
155-
} else if ((moduleInfo.flags & FLAG_MM_INVALID) != 0) {
156-
moduleInfo.flags &=~ FLAG_MM_INVALID;
157-
this.invalidModules.put(moduleInfo.id, moduleInfo);
158-
moduleInfoIterator.remove();
159145
}
160146
if (moduleInfo.name == null || (moduleInfo.name.equals(moduleInfo.id))) {
161147
moduleInfo.name = Character.toUpperCase(moduleInfo.id.charAt(0)) +
@@ -169,19 +155,13 @@ private boolean scanInternal() {
169155
editor.putBoolean("mm_first_scan", false);
170156
editor.apply();
171157
}
172-
return changed;
173158
}
174159

175160
public HashMap<String, ModuleInfo> getModules() {
176161
this.afterScan();
177162
return this.moduleInfos;
178163
}
179164

180-
public HashMap<String, ModuleInfo> getInvalidModules() {
181-
this.afterScan();
182-
return invalidModules;
183-
}
184-
185165
public boolean setEnabledState(ModuleInfo moduleInfo, boolean checked) {
186166
if (moduleInfo.hasFlag(ModuleInfo.FLAG_MODULE_UPDATING) && !checked) return false;
187167
SuFile disable = new SuFile("/data/adb/modules/" + moduleInfo.id + "/disable");

app/src/main/java/com/fox2code/mmm/repo/RepoData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public boolean tryLoadMetadata(RepoModule repoModule) {
112112
if (file.exists()) {
113113
try {
114114
ModuleInfo moduleInfo = repoModule.moduleInfo;
115-
PropUtils.readProperties(moduleInfo, file.getAbsolutePath());
115+
PropUtils.readProperties(moduleInfo, file.getAbsolutePath(), false);
116116
moduleInfo.flags &= ~ModuleInfo.FLAG_METADATA_INVALID;
117117
if (moduleInfo.version == null) {
118118
moduleInfo.version = "v" + moduleInfo.versionCode;

0 commit comments

Comments
 (0)