龙将斩千 v5.5.5.39856版本的 MD5 值为:5c05b1d6f8d872ca3fe0343d6ff07caf
以下内容为反编译后的 c.java 源代码,内容仅作参考
package com.qiyukf.unicorn;
import android.content.Context;
import android.os.Looper;
import android.text.TextUtils;
import com.qiyukf.module.log.LogPulseClient;
import com.qiyukf.nimlib.sdk.NIMClient;
import com.qiyukf.nimlib.sdk.RequestCallback;
import com.qiyukf.nimlib.sdk.SDKOptions;
import com.qiyukf.nimlib.sdk.StatusBarNotificationConfig;
import com.qiyukf.nimlib.sdk.msg.constant.MsgDirectionEnum;
import com.qiyukf.nimlib.sdk.msg.model.IMMessage;
import com.qiyukf.sentry.a.ai;
import com.qiyukf.sentry.a.aq;
import com.qiyukf.sentry.a.au;
import com.qiyukf.sentry.a.av;
import com.qiyukf.sentry.a.e.q;
import com.qiyukf.sentry.a.e.t;
import com.qiyukf.sentry.android.core.w;
import com.qiyukf.sentry.android.core.x;
import com.qiyukf.uikit.session.emoji.StickerManager;
import com.qiyukf.unicorn.api.UnicornImageLoader;
import com.qiyukf.unicorn.api.YSFOptions;
import com.qiyukf.unicorn.api.YSFUserInfo;
import com.qiyukf.unicorn.api.event.UnicornEventBase;
import com.qiyukf.unicorn.api.event.entry.ClickAvatarEntry;
import com.qiyukf.unicorn.c;
import com.qiyukf.unicorn.n.b.e;
import com.qiyukf.unicorn.n.j;
import com.qiyukf.unicorn.n.k;
import com.qiyukf.unicorn.n.l;
import com.qiyukf.unicorn.n.m;
import com.qiyukf.unicorn.n.p;
import com.umarkgame.umarksdk.constant.FinalValue;
import com.yaya.sdk.constants.Constants;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class c {
private static Locale i;
private static c m;
private Context b;
private String c;
private YSFOptions d;
private UnicornImageLoader e;
private com.qiyukf.unicorn.k.d f;
private b g;
private com.qiyukf.unicorn.h.a h;
private static final Logger a = LoggerFactory.getLogger((Class<?>) c.class);
private static boolean j = false;
private static boolean k = false;
private static final Object l = new Object();
private static List<a> n = new ArrayList();
public interface a {
void onInit();
}
static void a(Context context, YSFOptions ySFOptions) {
com.qiyukf.unicorn.n.e.d.a(context);
LogPulseClient.configLog(a().b, ySFOptions.logSwitch, "");
}
static boolean o() {
k = true;
return true;
}
private c() {
}
public static c a() {
if (m == null) {
throw new IllegalStateException("QIYU not initialized!");
}
return m;
}
public static c a(Context context, final String str, final YSFOptions ySFOptions, final UnicornImageLoader unicornImageLoader) {
final Context applicationContext = context.getApplicationContext();
if (Looper.myLooper() == Looper.getMainLooper()) {
d(applicationContext, str, ySFOptions, unicornImageLoader);
} else {
k.b(new Runnable() {
@Override
public final void run() {
c.d(applicationContext, str, ySFOptions, unicornImageLoader);
synchronized (c.l) {
c.l.notifyAll();
}
}
});
try {
synchronized (l) {
l.wait();
}
} catch (InterruptedException e) {
a.error("init in background thread interrupt", (Throwable) e);
}
}
return m;
}
public static c b(Context context, String str, YSFOptions ySFOptions, UnicornImageLoader unicornImageLoader) {
f(context, str, ySFOptions, unicornImageLoader);
return m;
}
public static void b() {
q();
}
public static boolean c() {
return k;
}
public static void d(Context context, String str, YSFOptions ySFOptions, UnicornImageLoader unicornImageLoader) {
try {
if (k) {
b(ySFOptions);
} else {
e(context, str, ySFOptions, unicornImageLoader);
}
} catch (Throwable th) {
a.error(FinalValue.INIT_FAIL_MSG, th);
}
}
public static void a(a aVar) {
if (!n.contains(aVar)) {
n.add(aVar);
}
}
public static void b(a aVar) {
n.remove(aVar);
}
public static void a(String str, String str2) {
i = new Locale(str, str2);
}
public static Locale d() {
return i;
}
public static Context e() {
return a().b;
}
public static String f() {
return a().c;
}
public static YSFOptions g() {
return a().d;
}
public static UnicornImageLoader h() {
return a().e;
}
public static com.qiyukf.unicorn.k.d i() {
return a().f;
}
public static b j() {
return a().g;
}
public final void b(final String str, final String str2) {
new com.qiyukf.unicorn.n.a<Void, Void>(com.qiyukf.unicorn.n.a.HTTP_TAG) {
@Override
protected final Void doInBackground(Void[] voidArr) {
com.qiyukf.unicorn.i.a.a(c.f(), com.qiyukf.unicorn.d.c.d(), str, str2);
return null;
}
}.execute(new Void[0]);
}
public final boolean a(YSFUserInfo ySFUserInfo, RequestCallback<Void> requestCallback) {
if (ySFUserInfo != null) {
try {
t tVar = new t();
tVar.a(ySFUserInfo.userId);
HashMap hashMap = new HashMap();
hashMap.put("appKey", m.c);
hashMap.put("appName", l.b(m.b));
hashMap.put("isFusion", String.valueOf(m.d.isMixSDK));
hashMap.put(Constants.LOADDATAREQ_USERDATA, ySFUserInfo.data);
tVar.b(hashMap);
ai.a(tVar);
} catch (Throwable th) {
a.error("setUserInfo exception.", th);
return false;
}
}
return this.h.a(ySFUserInfo, requestCallback);
}
public final void a(YSFOptions ySFOptions) {
if (!k || ySFOptions == null) {
return;
}
try {
b(ySFOptions);
if (d.a()) {
com.qiyukf.unicorn.d.a.a(this.b, this.c, ySFOptions);
}
} catch (Throwable th) {
a.error("update options error.", th);
}
}
public final boolean a(boolean z) {
return this.h.a(z);
}
public static void a(String str, long j2) {
com.qiyukf.unicorn.k.c.a(new com.qiyukf.unicorn.h.a.f.k(com.qiyukf.unicorn.d.c.d(), j2), str);
}
private static void e(Context context, String str, YSFOptions ySFOptions, UnicornImageLoader unicornImageLoader) {
f(context, str, ySFOptions, unicornImageLoader);
q();
}
private static void f(Context context, String str, YSFOptions ySFOptions, final UnicornImageLoader unicornImageLoader) {
try {
if (j) {
a.info("initialize has started");
return;
}
boolean z = true;
j = true;
d.a(context);
j.a(context);
if (ySFOptions == null || !ySFOptions.isMixSDK) {
z = false;
}
com.qiyukf.unicorn.d.c.a(context, str, z);
if (d.a()) {
p.a(context);
m.a(context);
com.qiyukf.unicorn.a.b.a(context);
c cVar = new c();
m = cVar;
cVar.b = context;
m.c = str;
m.d = ySFOptions == null ? YSFOptions.DEFAULT : ySFOptions;
}
if (ySFOptions == null) {
ySFOptions = YSFOptions.DEFAULT;
}
a(context, str, ySFOptions);
a.info("config sdk is end");
k.a(new Runnable() {
@Override
public final void run() {
try {
if (d.a()) {
c.m.e = UnicornImageLoader.this;
}
} catch (Throwable th) {
c.a.error(FinalValue.INIT_FAIL_MSG, th);
}
}
});
} catch (Throwable th) {
m = null;
b(th);
}
}
private static void q() {
a.info("init sdk is start");
if (d.a() && (m == null || m.b == null || TextUtils.isEmpty(m.c) || m.d == null)) {
throw new IllegalStateException("initSdkPrivate,SDK should be config on Application#onCreate()!");
}
k.a(new AnonymousClass4());
}
public static class AnonymousClass4 implements Runnable {
AnonymousClass4() {
}
@Override
public final void run() {
try {
if (d.a()) {
com.qiyukf.unicorn.d.a.a(c.m.b, c.m.c, c.m.d);
}
YSFOptions ySFOptions = c.m.d;
Context unused = c.m.b;
String unused2 = c.m.c;
c.n();
c.a(c.m.b, ySFOptions);
if (d.a()) {
c.a(c.m, c.m.b);
com.qiyukf.unicorn.f.a.a((Throwable) null);
}
w.a(c.m.b, new ai.a() {
@Override
public final void configure(av avVar) {
c.AnonymousClass4.a((x) avVar);
}
});
t tVar = new t();
HashMap hashMap = new HashMap();
hashMap.put("appKey", c.m.c);
hashMap.put("appName", l.b(c.m.b));
hashMap.put("isFusion", String.valueOf(c.m.d.isMixSDK));
tVar.b(hashMap);
ai.a(tVar);
c.o();
k.b(new Runnable() {
@Override
public final void run() {
for (a aVar : c.n) {
if (aVar != null) {
aVar.onInit();
}
}
}
});
c.a.info("init sdk is end");
} catch (Throwable th) {
if (c.m != null) {
Context unused3 = c.m.b;
c.b(th);
}
}
}
public static void a(x xVar) {
xVar.a("https://8593144935bb47e4aeb6c1436e86aa68@sentry.music.163.com/1537");
xVar.d(String.format("%s@%s+%d", "com.qiyukf.unicorn", "7.8.0", 121));
xVar.g(String.format("%d", 121));
xVar.a(false);
xVar.f(c.m.b.getPackageName());
xVar.a(new av.b() {
@Override
public final aq execute(aq aqVar, Object obj) {
aq a;
a = c.AnonymousClass4.a(aqVar, obj);
return a;
}
});
}
public static aq a(aq aqVar, Object obj) {
if (au.INFO.equals(aqVar.j()) && aqVar.c().a().length() > 0) {
return aqVar;
}
if (aqVar.i() != null && aqVar.i().size() > 0) {
List<q> a = aqVar.i().get(0).b().a();
for (int size = a.size() - 1; size >= 0; size--) {
q qVar = a.get(size);
if (qVar.b().booleanValue() || qVar.a().startsWith("android.app.Instrumentation")) {
return null;
}
if (qVar.a().startsWith("com.qiyukf")) {
return aqVar;
}
}
}
return null;
}
}
public static void b(Throwable th) {
a.error("init error.", th);
if (d.a()) {
com.qiyukf.unicorn.f.a.a(th);
}
}
private static void b(YSFOptions ySFOptions) {
if (ySFOptions != null) {
if (!d.a() && !d.b()) {
return;
}
com.qiyukf.nimlib.c.g().statusBarNotificationConfig = ySFOptions.statusBarNotificationConfig;
LogPulseClient.configLog(a().b, ySFOptions.logSwitch, "");
if (d.a()) {
m.d = ySFOptions;
}
}
}
private static void a(Context context, String str, YSFOptions ySFOptions) {
if (!ySFOptions.isMixSDK) {
StatusBarNotificationConfig statusBarNotificationConfig = ySFOptions.statusBarNotificationConfig;
SDKOptions sDKOptions = new SDKOptions();
if (ySFOptions.isUseYsfNotificationConfig) {
sDKOptions.messageNotifierCustomization = new com.qiyukf.uikit.a.a();
}
sDKOptions.disableAwake = true;
sDKOptions.appKey = str;
sDKOptions.statusBarNotificationConfig = statusBarNotificationConfig;
sDKOptions.sdkStorageRootPath = e.a(context);
sDKOptions.userInfoProvider = null;
if (ySFOptions.serverAddresses != null) {
sDKOptions.serverConfig = ySFOptions.serverAddresses;
}
if (com.qiyukf.unicorn.d.c.k() == 0) {
com.qiyukf.unicorn.d.c.a(com.qiyukf.unicorn.d.c.a() == null ? 2 : 1);
}
NIMClient.config(context, com.qiyukf.unicorn.h.a.b(), sDKOptions);
}
}
static void n() {
NIMClient.initSDK();
com.qiyukf.nimlib.c.a(com.qiyukf.nimlib.ysf.b.b.a().a());
}
static void a(c cVar, Context context) {
com.qiyukf.unicorn.i.a.a.a().a(context);
com.qiyukf.unicorn.e.a.a(context);
if (cVar.g == null) {
cVar.g = new b();
}
if (cVar.f == null) {
cVar.f = new com.qiyukf.unicorn.k.d(context);
}
if (cVar.h == null) {
cVar.h = new com.qiyukf.unicorn.h.a();
}
StickerManager.getInstance().init();
com.qiyukf.unicorn.l.b.a();
com.qiyukf.unicorn.l.b.b();
com.qiyukf.unicorn.m.a.a().b();
com.qiyukf.uikit.b.a(context, cVar.f.c());
if (a().d.isMixSDK) {
com.qiyukf.uikit.b.a(com.qiyukf.nimlib.c.k());
}
if (a().d.sdkEvents == null || a().d.sdkEvents.eventProcessFactory == null) {
return;
}
com.qiyukf.uikit.b.a(new com.qiyukf.uikit.session.b() {
@Override
public final void a(Context context2, IMMessage iMMessage) {
UnicornEventBase eventOf = c.g().sdkEvents.eventProcessFactory.eventOf(4);
if (eventOf == null) {
return;
}
boolean z = iMMessage.getDirect() == MsgDirectionEnum.In;
ClickAvatarEntry clickAvatarEntry = new ClickAvatarEntry();
if (!z) {
clickAvatarEntry.setUserId(c.this.h.a());
clickAvatarEntry.setStaff(false);
} else {
clickAvatarEntry.setStaffId(iMMessage.getFromAccount());
clickAvatarEntry.setStaff(true);
}
eventOf.onEvent(clickAvatarEntry, context2, null);
}
});
}
}