觅伊 v4.1.7版本的 MD5 值为:2a9d9e87c53524c098d85b78a90aa398
以下内容为反编译后的 WindApp.java 源代码,内容仅作参考
package com.wind.im;
import android.app.Application;
import android.content.Intent;
import android.os.Build;
import android.text.TextUtils;
import androidx.lifecycle.Observer;
import com.alibaba.android.arouter.launcher.ARouter;
import com.cf.msc.sdk.AppVest;
import com.fm.openinstall.OpenInstall;
import com.fm.openinstall.OpenInstallHelper;
import com.imacapp.message.ImKitMessage;
import com.jeremyliao.liveeventbus.LiveEventBus;
import com.tencent.bugly.crashreport.CrashReport;
import com.wind.im.push.KitPushApplication;
import com.wind.im.push.PushClientCallable;
import com.wind.im.service.WindMessageForegroundService;
import com.wind.imlib.WindClient;
import com.wind.imlib.bean.PushType;
import com.wind.imlib.bean.WindIMEvent;
import com.wind.imlib.bean.WindIMMessage;
import com.wind.imlib.bean.event.WindEvent;
import com.wind.imlib.connect.TokenManager;
import com.wind.imlib.connect.callback.ConnectStatusCallBack;
import com.wind.imlib.connect.http.error.ApiException;
import com.wind.imlib.connect.http.error.TokenInvalidException;
import com.wind.imlib.db.manager.CommSettingManager;
import com.wind.imlib.protocol.event.MessageRemindEvent;
import com.wind.kit.ImKit;
import com.wind.kit.KitRoutePath;
import com.wind.kit.common.KitToast;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.List;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import timber.log.Timber;
public class WindApp extends Application implements PushClientCallable {
@Override
public void onError(PushType type, String message) {
}
@Override
public void onReceivedToken(PushType type, String token) {
}
@Override
public void onCreate() {
super.onCreate();
handleSSLHandshake();
if (!TextUtils.isEmpty("9087ee0b49403c95a94af5f1795ebe67") && !TextUtils.isEmpty("oLqG+7DDfqHhGnV6HFEdznI5OQa9mEjc2QSQUpeo10n6OnFQesorjLELLXznqN5AE/xmquOHJGYn1cVRaysVaDkBaEfH10htiKYakLEr9D/WYVfhc+upOdCdbboDaqpR8OKP") && AppVest.init("9087ee0b49403c95a94af5f1795ebe67", "oLqG+7DDfqHhGnV6HFEdznI5OQa9mEjc2QSQUpeo10n6OnFQesorjLELLXznqN5AE/xmquOHJGYn1cVRaysVaDkBaEfH10htiKYakLEr9D/WYVfhc+upOdCdbboDaqpR8OKP") == -1) {
Timber.i("MainActivity Appvest init failed", new Object[0]);
}
ImKit.getInstance().init(this);
CrashReport.UserStrategy userStrategy = new CrashReport.UserStrategy(this);
userStrategy.setAppChannel("tmiyine.tmiyliaoshiduiejiqun.mi");
CrashReport.initCrashReport(getApplicationContext(), userStrategy);
if (!TextUtils.isEmpty("") && OpenInstallHelper.isMainProcess(getApplicationContext())) {
OpenInstall.init(getApplicationContext());
}
String userIpNode = TokenManager.getUserIpNode();
if (TextUtils.isEmpty(userIpNode)) {
userIpNode = "http://www.baidu.com:8803";
}
WindClient.getInstance().init(WindClient.ConnectMethod.HTTP, userIpNode, "http://www.baidu.com:8803", "", BuildConfig.IGNORE_IP_SERVERS, false, BuildConfig.HIDE_SERVER).connect(new ConnectStatusCallBack() {
@Override
public void onPingDelay(int timeout) {
LiveEventBus.get(WindEvent.PING, Integer.class).post(Integer.valueOf(timeout));
}
@Override
public void onError(Throwable throwable) {
if (throwable instanceof ApiException) {
ApiException apiException = (ApiException) throwable;
if (apiException.getCode() == 1004) {
LiveEventBus.get(WindEvent.PING, Integer.class).post(999);
return;
} else {
Timber.e(apiException.getDisplayMessage(), new Object[0]);
return;
}
}
Timber.e(throwable);
}
@Override
public void onConnectSuccess(WindClient.ConnectMethod method) {
Timber.i("%s Connect Success", method.name());
Timber.i("userId=%s,token=%s", Long.valueOf(TokenManager.getUserId()), TokenManager.getToken());
}
@Override
public void onTokenInvalid(TokenInvalidException e) {
Timber.e(e.getDisplayMessage(), new Object[0]);
WindClient.getInstance().quit();
KitToast.error("登录信息失效,请重新登录");
ARouter.getInstance().build(KitRoutePath.LOGIN).navigation();
}
@Override
public void onAuthSuccess() {
KitPushApplication.getInstance().onAuthSuccess();
}
@Override
public void onReceiveMessage(List<WindIMMessage> message) {
MessageCenter.receivedMessage(message);
}
@Override
public void onReceiveEvent(List<WindIMEvent> events) {
EventCenter.onReceiveEvent(events);
}
});
KitPushApplication.getInstance().init(this, this);
LiveEventBus.get(WindEvent.MESSAGE_REMIND_EVENT, MessageRemindEvent.class).observeForever(new Observer<MessageRemindEvent>() {
@Override
public void onChanged(MessageRemindEvent messageRemindEvent) {
ImKitMessage.getInstance().showGroupStrongRemind(messageRemindEvent);
}
});
LiveEventBus.get(WindEvent.PUSH_ENABLE, Boolean.class).observeForever(new Observer<Boolean>() {
@Override
public void onChanged(Boolean aBoolean) {
if (aBoolean.booleanValue()) {
KitPushApplication.getInstance().openPush();
} else {
KitPushApplication.getInstance().closePush();
}
}
});
LiveEventBus.get("strong_push", Boolean.class).observeForever(new Observer<Boolean>() {
@Override
public void onChanged(Boolean aBoolean) {
if (aBoolean.booleanValue()) {
Intent intent = new Intent(WindApp.this, WindMessageForegroundService.class);
if (Build.VERSION.SDK_INT >= 26) {
WindApp.this.startForegroundService(intent);
} else {
WindApp.this.startService(intent);
}
KitPushApplication.getInstance().closePush();
return;
}
WindApp.this.stopService(new Intent(WindApp.this, WindMessageForegroundService.class));
if (CommSettingManager.getPushEnable()) {
KitPushApplication.getInstance().openPush();
}
}
});
if (CommSettingManager.getStrongPushEnable()) {
Intent intent = new Intent(this, WindMessageForegroundService.class);
if (Build.VERSION.SDK_INT >= 26) {
startForegroundService(intent);
} else {
startService(intent);
}
KitPushApplication.getInstance().closePush();
} else if (CommSettingManager.getPushEnable()) {
KitPushApplication.getInstance().openPush();
}
}
public static void handleSSLHandshake() {
try {
TrustManager[] trustManagerArr = {new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
@Override
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
}};
SSLContext sSLContext = SSLContext.getInstance("TLS");
sSLContext.init(null, trustManagerArr, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sSLContext.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
});
} catch (Exception unused) {
}
}
}