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

Commit 584d8b1

Browse files
committed
0.2.7 Release
1 parent a4ed235 commit 584d8b1

33 files changed

+678
-154
lines changed

DEVELOPERS.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ So the original module maker can still override them
5555

5656
The Fox's Mmm also allow better control over it's installer interface
5757

58-
Fox's Mmm defined the variable `MMM_EXT_SUPPORT` to expose it's extension support
58+
Fox's Mmm define the variable `MMM_EXT_SUPPORT` to expose it's extensions support
5959

6060
All the commands start with it `#!`, by default the manager process command as log output
6161
unless `#!useExt` is sent to indicate that the app is ready to use commands
@@ -70,15 +70,21 @@ Commands:
7070
- `clearTerminal`: Clear the terminal of any text, making it empty
7171
- `scrollUp`: Scroll up at the top of the terminal
7272
- `scrollDown`: Scroll down at the bottom of the terminal
73-
- `showLoading`: Show an indeterminate progress bar
74-
(Note: the bar is automatically hidden when the install finish)
73+
- `showLoading <max>`: Show an indeterminate progress bar
74+
(Note: Status bar is indeterminate if 0 is provided)
75+
- `setLoading <progress>`: Set loading progress if the bar is not indeterminate.
7576
- `hideLoading`: Hide the indeterminate progress bar if previously shown
7677
- `setSupportLink <url>`: Set support link to show when the install finish
7778
(Note: Modules installed from repo will not show the config button if a link is set)
7879

80+
Variables:
81+
- `MMM_EXT_SUPPORT` declared if extensions are supported
82+
- `MMM_USER_LANGUAGE` the current user selected language
83+
- `MMM_APP_VERSION` display version of the app (Ex: `x.y.z`)
84+
7985
Note:
8086
The current behavior with unknown command is to ignore them,
81-
I may add or remove commands in the future depending of how they are used
87+
I may add or remove commands/variables in the future depending of how they are used
8288

8389
A wrapper script to use theses commands could be
8490
```sh

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ The app currently use these two repo as it's module sources, with it's benefits
3535

3636
[https://github.com/Magisk-Modules-Repo](https://github.com/Magisk-Modules-Repo)
3737
- No longer accept new modules or update to existing modules
38+
(Fox's MMM use a workaround to get latest version of modules, because the
39+
method used by the official Magisk app give outdated versions of the modules)
3840
- May be shut down at any moment
3941
- Official app dropped support for it
4042
- Officially supported by Fox's mmm

app/build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
applicationId "com.fox2code.mmm"
1111
minSdk 21
1212
targetSdk 32
13-
versionCode 17
14-
versionName "0.2.6"
13+
versionCode 18
14+
versionName "0.2.7"
1515

1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1717
}
@@ -31,8 +31,7 @@ android {
3131
sourceCompatibility JavaVersion.VERSION_1_8
3232
targetCompatibility JavaVersion.VERSION_1_8
3333
}
34-
35-
lintOptions {
34+
lint {
3635
disable 'MissingTranslation'
3736
}
3837
}

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
android:theme="@style/Theme.MagiskModuleManager"
2929
android:fullBackupContent="@xml/full_backup_content"
3030
android:dataExtractionRules="@xml/data_extraction_rules"
31+
android:usesCleartextTraffic="false"
3132
tools:targetApi="s">
3233
<receiver android:name="com.fox2code.mmm.manager.ModuleBootReceive"
3334
android:exported="true">
@@ -39,7 +40,7 @@
3940
android:name=".settings.SettingsActivity"
4041
android:parentActivityName=".MainActivity"
4142
android:exported="true"
42-
android:label="@string/title_activity_settings" >
43+
android:label="@string/title_activity_settings">
4344
<intent-filter>
4445
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
4546
</intent-filter>

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ public void update(ImageButton button, ModuleHolder moduleHolder) {
4343

4444
@Override
4545
public void doAction(ImageButton button, ModuleHolder moduleHolder) {
46-
RepoModule repoModule = moduleHolder.repoModule;
47-
if (repoModule == null) return;
48-
IntentHelper.openInstaller(button.getContext(), repoModule.zipUrl,
49-
repoModule.moduleInfo.name, repoModule.moduleInfo.config);
46+
ModuleInfo moduleInfo = moduleHolder.getMainModuleInfo();
47+
if (moduleInfo == null) return;
48+
String updateZipUrl = moduleHolder.getUpdateZipUrl();
49+
if (updateZipUrl == null) return;
50+
IntentHelper.openInstaller(button.getContext(), updateZipUrl,
51+
moduleInfo.name, moduleInfo.config);
5052
}
5153
},
5254
UNINSTALL() {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public boolean checkUpdate(boolean force) {
4141
return true;
4242
long lastChecked = this.lastChecked;
4343
if (lastChecked != 0 &&
44-
// Avoid spam calls by putting a 10 seconds timer
45-
lastChecked < System.currentTimeMillis() - 10000L)
44+
// Avoid spam calls by putting a 60 seconds timer
45+
lastChecked < System.currentTimeMillis() - 60000L)
4646
return force && this.peekShouldUpdate();
4747
synchronized (this.updateLock) {
4848
if (lastChecked != this.lastChecked)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class Constants {
1111
public static final String EXTRA_INSTALL_PATH = "extra_install_path";
1212
public static final String EXTRA_INSTALL_NAME = "extra_install_name";
1313
public static final String EXTRA_INSTALL_CONFIG = "extra_install_config";
14+
public static final String EXTRA_INSTALL_NO_PATCH = "extra_install_no_patch";
15+
public static final String EXTRA_INSTALL_NO_EXTENSIONS = "extra_install_no_extensions";
1416
public static final String EXTRA_MARKDOWN_URL = "extra_markdown_url";
1517
public static final String EXTRA_MARKDOWN_TITLE = "extra_markdown_title";
1618
public static final String EXTRA_MARKDOWN_CONFIG = "extra_markdown_config";

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

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.fox2code.mmm.compat.CompatActivity;
2020
import com.fox2code.mmm.installer.InstallerInitializer;
21+
import com.fox2code.mmm.manager.LocalModuleInfo;
2122
import com.fox2code.mmm.manager.ModuleManager;
2223
import com.fox2code.mmm.repo.RepoManager;
2324
import com.fox2code.mmm.settings.SettingsActivity;
@@ -115,16 +116,42 @@ public void commonNext() {
115116
progressIndicator.setMax(PRECISION);
116117
});
117118
Log.i(TAG, "Scanning for modules!");
118-
RepoManager.getINSTANCE().update(value -> runOnUiThread(() ->
119-
progressIndicator.setProgressCompat((int) (value * PRECISION), true)));
119+
final int max = ModuleManager.getINSTANCE().getUpdatableModuleCount();
120+
RepoManager.getINSTANCE().update(value -> runOnUiThread(max == 0 ? () ->
121+
progressIndicator.setProgressCompat(
122+
(int) (value * PRECISION), true) :() ->
123+
progressIndicator.setProgressCompat(
124+
(int) (value * PRECISION * 0.75F), true)));
125+
if (!RepoManager.getINSTANCE().hasConnectivity()) {
126+
moduleViewListBuilder.addNotification(NotificationType.NO_INTERNET);
127+
} else {
128+
if (AppUpdateManager.getAppUpdateManager().checkUpdate(true))
129+
moduleViewListBuilder.addNotification(NotificationType.UPDATE_AVAILABLE);
130+
if (max != 0) {
131+
int current = 0;
132+
for (LocalModuleInfo localModuleInfo :
133+
ModuleManager.getINSTANCE().getModules().values()) {
134+
if (localModuleInfo.updateJson != null) {
135+
try {
136+
localModuleInfo.checkModuleUpdate();
137+
} catch (Exception e) {
138+
Log.e("MainActivity", "Failed to fetch update of: "
139+
+ localModuleInfo.id, e);
140+
}
141+
current++;
142+
final int currentTmp = current;
143+
runOnUiThread(() -> progressIndicator.setProgressCompat(
144+
(int) ((1F * currentTmp / max) * PRECISION * 0.25F
145+
+ (PRECISION * 0.75F)), true));
146+
}
147+
}
148+
}
149+
}
120150
runOnUiThread(() -> {
151+
progressIndicator.setProgressCompat(PRECISION, true);
121152
progressIndicator.setVisibility(View.GONE);
122153
searchView.setEnabled(true);
123154
});
124-
if (!RepoManager.getINSTANCE().hasConnectivity())
125-
moduleViewListBuilder.addNotification(NotificationType.NO_INTERNET);
126-
else if (AppUpdateManager.getAppUpdateManager().checkUpdate(true))
127-
moduleViewListBuilder.addNotification(NotificationType.UPDATE_AVAILABLE);
128155
moduleViewListBuilder.appendRemoteModules();
129156
moduleViewListBuilder.applyTo(moduleList, moduleViewAdapter);
130157
Log.i(TAG, "Finished app opening state!");
@@ -156,6 +183,7 @@ public void refreshUI() {
156183
this.cardIconifyUpdate();
157184
this.moduleViewListBuilder.setQuery(null);
158185
Log.i(TAG, "Item After");
186+
this.moduleViewListBuilder.refreshNotificationsUI(this.moduleViewAdapter);
159187
InstallerInitializer.tryGetMagiskPathAsync(new InstallerInitializer.Callback() {
160188
@Override
161189
public void onPathReceived(String path) {

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

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,13 @@ public void setManagerThemeResId(@StyleRes int resId) {
212212
switch (this.managerThemeResId) {
213213
case R.style.Theme_MagiskModuleManager:
214214
this.nightModeOverride = null;
215+
break;
215216
case R.style.Theme_MagiskModuleManager_Light:
216217
this.nightModeOverride = Boolean.FALSE;
218+
break;
217219
case R.style.Theme_MagiskModuleManager_Dark:
218220
this.nightModeOverride = Boolean.TRUE;
221+
break;
219222
default:
220223
}
221224
if (this.markwonThemeContext != null) {
@@ -225,6 +228,25 @@ public void setManagerThemeResId(@StyleRes int resId) {
225228
this.markwon = null;
226229
}
227230

231+
public void updateTheme() {
232+
@StyleRes int themeResId;
233+
String theme;
234+
switch (theme = getSharedPreferences().getString("pref_theme", "system")) {
235+
default:
236+
Log.w("MainApplication", "Unknown theme id: " + theme);
237+
case "system":
238+
themeResId = R.style.Theme_MagiskModuleManager;
239+
break;
240+
case "dark":
241+
themeResId = R.style.Theme_MagiskModuleManager_Dark;
242+
break;
243+
case "light":
244+
themeResId = R.style.Theme_MagiskModuleManager_Light;
245+
break;
246+
}
247+
this.setManagerThemeResId(themeResId);
248+
}
249+
228250
@StyleRes
229251
public int getManagerThemeResId() {
230252
return managerThemeResId;
@@ -267,20 +289,7 @@ public void onCreate() {
267289
} else {
268290
MainApplication.firstBoot = bootPrefs.getBoolean("first_boot", false);
269291
}
270-
@StyleRes int themeResId;
271-
switch (getSharedPreferences().getString("pref_theme", "system")) {
272-
default:
273-
case "system":
274-
themeResId = R.style.Theme_MagiskModuleManager;
275-
break;
276-
case "dark":
277-
themeResId = R.style.Theme_MagiskModuleManager_Dark;
278-
break;
279-
case "light":
280-
themeResId = R.style.Theme_MagiskModuleManager_Light;
281-
break;
282-
}
283-
this.setManagerThemeResId(themeResId);
292+
this.updateTheme();
284293
// Update SSL Ciphers if update is possible
285294
GMSProviderInstaller.installIfNeeded(this);
286295
// Update emoji config

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import androidx.annotation.StringRes;
99

1010
import com.fox2code.mmm.installer.InstallerInitializer;
11+
import com.fox2code.mmm.manager.LocalModuleInfo;
1112
import com.fox2code.mmm.manager.ModuleInfo;
1213
import com.fox2code.mmm.repo.RepoModule;
1314
import com.fox2code.mmm.utils.IntentHelper;
@@ -24,7 +25,7 @@ public final class ModuleHolder implements Comparable<ModuleHolder> {
2425
public final NotificationType notificationType;
2526
public final Type separator;
2627
public final int footerPx;
27-
public ModuleInfo moduleInfo;
28+
public LocalModuleInfo moduleInfo;
2829
public RepoModule repoModule;
2930

3031
public ModuleHolder(String moduleId) {
@@ -60,7 +61,15 @@ public boolean isModuleHolder() {
6061
}
6162

6263
public ModuleInfo getMainModuleInfo() {
63-
return this.repoModule != null ? this.repoModule.moduleInfo : this.moduleInfo;
64+
return this.repoModule != null && (this.moduleInfo == null ||
65+
this.moduleInfo.versionCode < this.repoModule.moduleInfo.versionCode)
66+
? this.repoModule.moduleInfo : this.moduleInfo;
67+
}
68+
69+
public String getUpdateZipUrl() {
70+
return this.moduleInfo == null || (this.repoModule != null &&
71+
this.moduleInfo.updateVersionCode < this.repoModule.lastUpdated) ?
72+
this.repoModule.zipUrl : this.moduleInfo.updateZipUrl;
6473
}
6574

6675
public String getMainModuleName() {
@@ -103,10 +112,9 @@ public Type getType() {
103112
return Type.NOTIFICATION;
104113
} else if (this.moduleInfo == null) {
105114
return Type.INSTALLABLE;
106-
} else if (this.repoModule == null) {
107-
return Type.INSTALLED;
108-
} else if (this.moduleInfo.versionCode <
109-
this.repoModule.moduleInfo.versionCode) {
115+
} else if (this.moduleInfo.versionCode < this.moduleInfo.updateVersionCode ||
116+
(this.repoModule != null && this.moduleInfo.versionCode <
117+
this.repoModule.moduleInfo.versionCode)) {
110118
return Type.UPDATABLE;
111119
} else {
112120
return Type.INSTALLED;
@@ -139,7 +147,8 @@ public void getButtons(Context context, List<ActionButtonType> buttonTypeList, b
139147
if (this.repoModule != null) {
140148
buttonTypeList.add(ActionButtonType.INFO);
141149
}
142-
if (this.repoModule != null && !showcaseMode &&
150+
if ((this.repoModule != null || (this.moduleInfo != null &&
151+
this.moduleInfo.updateZipUrl != null)) && !showcaseMode &&
143152
InstallerInitializer.peekMagiskPath() != null) {
144153
buttonTypeList.add(ActionButtonType.UPDATE_INSTALL);
145154
}

0 commit comments

Comments
 (0)