Skip to content

Commit dc8e99d

Browse files
committed
refactor: Use UnobfuscatorCache for several methods
Wrapped multiple methods in `Unobfuscator.java` with the corresponding `UnobfuscatorCache` calls to improve performance by caching results.
1 parent 2c57808 commit dc8e99d

File tree

3 files changed

+102
-91
lines changed

3 files changed

+102
-91
lines changed

app/src/main/java/com/wmods/wppenhacer/xposed/core/FeatureLoader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
140140
registerReceivers();
141141
try {
142142
var timemillis = System.currentTimeMillis();
143+
SharedPreferencesWrapper.hookInit(mApp.getClassLoader());
144+
UnobfuscatorCache.init(mApp);
143145
boolean isSupported = supportedVersions.stream().anyMatch(s -> packageInfo.versionName.startsWith(s.replace(".xx", "")));
144146
if (!isSupported) {
145147
disableExpirationVersion(mApp.getClassLoader());
@@ -151,8 +153,6 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
151153
throw new Exception(sb);
152154
}
153155
}
154-
SharedPreferencesWrapper.hookInit(mApp.getClassLoader());
155-
UnobfuscatorCache.init(mApp);
156156
WppCore.Initialize(loader, pref);
157157
DesignUtils.setPrefs(pref);
158158
initComponents(loader, pref);
@@ -199,7 +199,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
199199
});
200200
}
201201

202-
public static void disableExpirationVersion(ClassLoader classLoader) {
202+
public static void disableExpirationVersion(ClassLoader classLoader) throws Exception {
203203
var expirationClass = Unobfuscator.loadExpirationClass(classLoader);
204204
var method = ReflectionUtils.findMethodUsingFilter(expirationClass, m -> m.getReturnType().equals(Date.class));
205205
XposedBridge.hookMethod(method, new XC_MethodHook() {

0 commit comments

Comments
 (0)