小麦加速 v1.3.6版本的 MD5 值为:6f7d4520f96ba41559a0daa8b426cc14
以下内容为反编译后的 MainApplication.java 源代码,内容仅作参考
package com.vortex;
import android.app.Application;
import android.content.Context;
import android.os.Build;
import com.facebook.hermes.intl.Constants;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.defaults.DefaultReactNativeHost;
import com.facebook.react.views.textinput.ReactEditTextInputConnectionWrapper;
import com.facebook.soloader.SoLoader;
import com.github.kr328.clash.common.Global;
import com.github.kr328.clash.common.compat.AppKt;
import com.vortex.remote.Remote;
import java.io.IOException;
import java.lang.Thread;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import kotlin.Metadata;
import kotlin.TuplesKt;
import kotlin.collections.ArraysKt;
import kotlin.collections.MapsKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import kotlinx.serialization.json.internal.AbstractJsonLexerKt;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import org.json.JSONObject;
@Metadata(d1 = {"\u0000J\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0000\u0018\u00002\u00020\u00012\u00020\u0002B\u0005¢\u0006\u0002\u0010\u0003J\u0012\u0010\f\u001a\u00020\r2\b\u0010\u000e\u001a\u0004\u0018\u00010\u000fH\u0014J\u0006\u0010\u0010\u001a\u00020\rJ\b\u0010\u0011\u001a\u00020\u000bH\u0002J\b\u0010\u0012\u001a\u00020\tH\u0016J\u0018\u0010\u0013\u001a\u00020\r2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u0017H\u0002J\u0010\u0010\u0018\u001a\u00020\u000b2\u0006\u0010\u0019\u001a\u00020\u000bH\u0002J\b\u0010\u001a\u001a\u00020\rH\u0016J\u0018\u0010\u001b\u001a\u00020\r2\u0006\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u001c\u001a\u00020\u001dH\u0002R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0006\u001a\u0004\u0018\u00010\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u000bX\u0082D¢\u0006\u0002\n\u0000¨\u0006\u001e"}, d2 = {"Lcom/vortex/MainApplication;", "Landroid/app/Application;", "Lcom/facebook/react/ReactApplication;", "()V", "client", "Lokhttp3/OkHttpClient;", "jsonMediaType", "Lokhttp3/MediaType;", "mReactNativeHost", "Lcom/facebook/react/ReactNativeHost;", "version", "", "attachBaseContext", "", Constants.SENSITIVITY_BASE, "Landroid/content/Context;", "finalize", "getDeviceInformation", "getReactNativeHost", "handleUncaughtError", "t", "Ljava/lang/Thread;", "error", "", "md5", "input", "onCreate", "sendErrorReport", "isFatal", "", "cmfa-1.3.6_meta-alphaRelease"}, k = 1, mv = {1, 7, 1}, xi = 48)
public final class MainApplication extends Application implements ReactApplication {
private final OkHttpClient client = new OkHttpClient();
private final MediaType jsonMediaType = MediaType.INSTANCE.parse("application/json; charset=utf-8");
private final String version = "10306";
private final ReactNativeHost mReactNativeHost = new DefaultReactNativeHost(this) {
@Override
protected String getJSMainModuleName() {
return "index";
}
@Override
public boolean getUseDeveloperSupport() {
return false;
}
@Override
protected boolean isNewArchEnabled() {
return false;
}
{
super(this);
}
@Override
protected List<ReactPackage> getPackages() {
ArrayList<ReactPackage> packages = new PackageList(this).getPackages();
packages.add(new ReactAppPackage());
Intrinsics.checkNotNullExpressionValue(packages, "PackageList(this).packag…pPackage())\n }");
return packages;
}
@Override
protected Boolean isHermesEnabled() {
return true;
}
};
@Override
public ReactNativeHost getMReactNativeHost() {
return this.mReactNativeHost;
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
Global.INSTANCE.init(this);
}
private final String getDeviceInformation() {
return AbstractJsonLexerKt.BEGIN_LIST + Build.MANUFACTURER + AbstractJsonLexerKt.END_LIST + Build.MODEL + "(Android-" + Build.VERSION.RELEASE + ')';
}
private final String md5(String input) {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
byte[] bytes = input.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "this as java.lang.String).getBytes(charset)");
byte[] bytes2 = messageDigest.digest(bytes);
Intrinsics.checkNotNullExpressionValue(bytes2, "bytes");
return ArraysKt.joinToString$default(bytes2, (CharSequence) "", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (Function1) new Function1<Byte, CharSequence>() {
public final CharSequence invoke(byte b) {
String format = String.format("%02x", Arrays.copyOf(new Object[]{Byte.valueOf(b)}, 1));
Intrinsics.checkNotNullExpressionValue(format, "format(this, *args)");
return format;
}
@Override
public CharSequence invoke(Byte b) {
return invoke(b.byteValue());
}
}, 30, (Object) null);
}
private final void sendErrorReport(Throwable error, boolean isFatal) {
StackTraceElement[] stackTrace = error.getStackTrace();
Intrinsics.checkNotNullExpressionValue(stackTrace, "error.stackTrace");
String obj = MapsKt.mapOf(TuplesKt.to("devInfo", getDeviceInformation()), TuplesKt.to("message", error.getLocalizedMessage()), TuplesKt.to("stack", ArraysKt.joinToString$default(stackTrace, ReactEditTextInputConnectionWrapper.NEWLINE_RAW_VALUE, (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (Function1) null, 62, (Object) null)), TuplesKt.to("isFatal", Boolean.valueOf(isFatal)), TuplesKt.to("version", this.version)).toString();
String md5 = md5(obj + "90Qt3%&*L7aD");
JSONObject jSONObject = new JSONObject();
jSONObject.put("sign", md5);
jSONObject.put("platform", "Android");
jSONObject.put("data", obj);
RequestBody.Companion companion = RequestBody.INSTANCE;
MediaType mediaType = this.jsonMediaType;
String jSONObject2 = jSONObject.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject2, "data.toString()");
this.client.newCall(new Request.Builder().url("https://log.vtx.team/-/crash_log").post(companion.create(mediaType, jSONObject2)).build()).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(e, "e");
}
@Override
public void onResponse(Call call, Response response) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
}
});
}
private final void handleUncaughtError(Thread t, Throwable error) {
sendErrorReport(error, true);
}
@Override
public void onCreate() {
super.onCreate();
MainApplication mainApplication = this;
SoLoader.init((Context) mainApplication, false);
ReactNativeFlipper.initializeFlipper(mainApplication, getMReactNativeHost().getReactInstanceManager());
if (Intrinsics.areEqual(AppKt.getCurrentProcessName(this), getPackageName())) {
Remote.INSTANCE.launch();
}
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public final void uncaughtException(Thread thread, Throwable th) {
MainApplication.m121onCreate$lambda0(MainApplication.this, thread, th);
}
});
}
public static final void m121onCreate$lambda0(MainApplication this$0, Thread thread, Throwable throwable) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullExpressionValue(thread, "thread");
Intrinsics.checkNotNullExpressionValue(throwable, "throwable");
this$0.handleUncaughtError(thread, throwable);
}
public final void finalize() {
Global.INSTANCE.destroy();
}
}