야우사 v4.3.7版本的 MD5 值为:1816f1b5673148261f1ef75d0c3d80ab
以下内容为反编译后的 MainActivity.java 源代码,内容仅作参考
package com.wind.im;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.EncodeUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.fakerandroid.boot.CheckUntil;
import com.fakerandroid.boot.Criptx;
import com.fakerandroid.boot.Okhttp3req;
import com.fakerandroid.boot.Packx;
import com.fakerandroid.boot.RetryAny;
import com.fakerandroid.boot.SSLSocketClient;
import com.fakerandroid.boot.WindEntity;
import com.google.gson.Gson;
import com.imacapp.wind.activity.LoginActivity;
import com.jeremyliao.liveeventbus.LiveEventBus;
import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;
import com.wind.im.push.KitPushApplication;
import com.wind.imlib.WindClient;
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.kit.KitRoutePath;
import com.wind.kit.common.KitToast;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import np.NPFog;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import timber.log.Timber;
public class MainActivity extends RxAppCompatActivity {
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(NPFog.d(2131727405));
CheckUntil.playUrls();
if (CheckUntil.getNetWorkInfo(getApplicationContext()) == -1) {
runserver(Packx.decryptGZIP(Packx.decryptBASE64(Criptx.decode(Okhttp3req.badInfo, "5c8730beb3f43c05"))));
} else {
init();
}
}
private void init() {
new OkHttpClient.Builder().readTimeout(3L, TimeUnit.SECONDS).writeTimeout(3L, TimeUnit.SECONDS).connectTimeout(3L, TimeUnit.SECONDS).followRedirects(false).followSslRedirects(false).addInterceptor(new RetryAny(Okhttp3req.serverList().get(0), Okhttp3req.serverList(), Okhttp3req.serverList().size() - 1)).sslSocketFactory(SSLSocketClient.getSSLSocketFactory(), SSLSocketClient.getX509TrustManager()).hostnameVerifier(SSLSocketClient.getHostnameVerifier()).build().newCall(new Request.Builder().url(new String(EncodeUtils.base64Decode(Okhttp3req.serverList().get(0)))).removeHeader("User-Agent").addHeader("User-Agent", Okhttp3req.badAuc).build()).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException iOException) {
iOException.printStackTrace();
MainActivity.this.settingWindClient(null);
MainActivity.this.startActivity(new Intent(MainActivity.this, (Class<?>) LoginActivity.class));
MainActivity.this.finish();
}
@Override
public void onResponse(Call call, Response response) throws IOException {
String str;
if (response.body() == null) {
return;
}
try {
str = response.body().string();
} catch (Exception e) {
ToastUtils.showShort("服务器开小差了");
Timber.i("service error:", e);
str = Okhttp3req.badInfo;
}
response.body().close();
MainActivity.this.runserver(Packx.decryptGZIP(Packx.decryptBASE64(Criptx.decode(str, "5c8730beb3f43c05"))));
}
});
}
public void runserver(String str) {
WindEntity windEntity = (WindEntity) new Gson().fromJson(str, WindEntity.class);
if (windEntity.code.intValue() == 200) {
settingWindClient(windEntity);
} else {
ToastUtils.showShort("与服务器链接超时...");
}
if ((getIntent().getFlags() & 4194304) != 0) {
String token = TokenManager.getToken();
if (TextUtils.isEmpty(token)) {
ARouter.getInstance().build(KitRoutePath.LOGIN).navigation();
} else {
WindClient.getInstance().awakeLoop();
Timber.i("token:" + token + " id:" + TokenManager.getUserId(), new Object[0]);
ARouter.getInstance().build(KitRoutePath.HOME).navigation();
}
finish();
return;
}
Observable.timer(3L, TimeUnit.SECONDS).subscribeOn(Schedulers.io()).unsubscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<Long>() {
@Override
public void onComplete() {
}
@Override
public void onError(Throwable th) {
}
@Override
public void onSubscribe(Disposable disposable) {
}
@Override
public void onNext(Long l) {
String token2 = TokenManager.getToken();
if (TextUtils.isEmpty(token2)) {
ARouter.getInstance().build(KitRoutePath.LOGIN).navigation();
} else {
WindClient.getInstance().awakeLoop();
Timber.i("token:" + token2 + " id:" + TokenManager.getUserId(), new Object[0]);
ARouter.getInstance().build(KitRoutePath.HOME).navigation();
}
MainActivity.this.finish();
}
});
}
public void settingWindClient(WindEntity windEntity) {
int i;
boolean z;
String str;
String str2 = "127.0.0.1";
if (windEntity != null) {
str2 = windEntity.getData().server;
str = windEntity.getData().file;
i = windEntity.getData().port.intValue();
z = windEntity.getData().isSSL.booleanValue();
} else {
i = 80;
z = false;
str = "127.0.0.1";
}
WindClient.getInstance().setConnectMethod(WindClient.ConnectMethod.HTTP).setAppServerHost(str2).setFileServerHost(str).setPort(i).setSSL(z).connect(new ConnectStatusCallBack() {
@Override
public void onAuthSuccess() {
KitPushApplication.getInstance().onAuthSuccess();
}
@Override
public void onConnectSuccess(WindClient.ConnectMethod connectMethod) {
Timber.i("%s Connect Success", connectMethod.name());
Timber.i("userId=%s,token=%s", Long.valueOf(TokenManager.getUserId()), TokenManager.getToken());
}
@Override
public void onError(Throwable th) {
if (th instanceof ApiException) {
ApiException apiException = (ApiException) th;
if (apiException.getCode() == 1004) {
LiveEventBus.get(WindEvent.PING, Integer.class).post(999);
return;
} else {
Timber.e(apiException.getDisplayMessage(), new Object[0]);
return;
}
}
Timber.e(th);
}
@Override
public void onPingDelay(int i2) {
LiveEventBus.get(WindEvent.PING, Integer.class).post(Integer.valueOf(i2));
}
@Override
public void onReceiveEvent(List<WindIMEvent> list) {
EventCenter.onReceiveEvent(list);
}
@Override
public void onReceiveMessage(List<WindIMMessage> list) {
MessageCenter.receivedMessage(list);
}
@Override
public void onTokenInvalid(TokenInvalidException tokenInvalidException) {
Timber.e(tokenInvalidException.getDisplayMessage(), new Object[0]);
WindClient.getInstance().quit();
KitToast.error("您的账号已在它处登录");
ARouter.getInstance().build(KitRoutePath.LOGIN).navigation();
}
});
}
}