package com.gaoyuan.mianshu; import android.content.Context; import android.content.pm.ApplicationInfo; import android.os.Build; import android.util.Base64; import android.util.Log; import android.view.inputmethod.InputMethodManager; import android.widget.TextView; import com.gaoyuan.mianshu.bean.c; import com.netease.nim.uikit.bean.AppConfigResBean; import com.netease.nim.uikit.bean.EquipBean; import com.netease.nim.uikit.common.util.sys.TimeUtil; import com.netease.nim.uikit.utils.GlobalConstants; import com.netease.nim.uikit.utils.SPUtils; import java.lang.reflect.Type; import java.math.BigInteger; import java.nio.charset.Charset; import java.security.MessageDigest; import java.util.ArrayList; import java.util.List; import java.util.Objects; import kotlin.h; import kotlin.jvm.internal.i; import kotlin.text.d; import kotlin.text.g; @h /* compiled from: MyUtils.kt */ public final class f { public static final f a = new f(); @h /* compiled from: MyUtils.kt */ public static final class a extends com.google.gson.p.a<List<com.gaoyuan.mianshu.bean.h>> { a() { } } @h /* compiled from: MyUtils.kt */ public static final class b extends com.google.gson.p.a<List<c>> { b() { } } private f() { } private final EquipBean g() { String str = Build.PRODUCT; i.d(str, "PRODUCT"); String str2 = Build.TAGS; i.d(str2, "TAGS"); String str3 = Build.VERSION.INCREMENTAL; i.d(str3, "INCREMENTAL"); String str4 = Build.VERSION.RELEASE; i.d(str4, "RELEASE"); String str5 = Build.MODEL; i.d(str5, "MODEL"); String str6 = Build.DEVICE; i.d(str6, "DEVICE"); String str7 = Build.DISPLAY; i.d(str7, "DISPLAY"); String str8 = Build.BRAND; i.d(str8, "BRAND"); String str9 = Build.BOARD; i.d(str9, "BOARD"); String str10 = Build.FINGERPRINT; i.d(str10, "FINGERPRINT"); String str11 = Build.ID; i.d(str11, "ID"); String str12 = Build.MANUFACTURER; i.d(str12, "MANUFACTURER"); String str13 = Build.USER; i.d(str13, "USER"); String str14 = Build.HARDWARE; i.d(str14, "HARDWARE"); String str15 = Build.HOST; i.d(str15, "HOST"); String str16 = Build.TYPE; i.d(str16, "TYPE"); return new EquipBean(str, str2, str3, str4, str5, str6, str7, str8, str9, str10, str11, str12, str13, str14, str15, str16, String.valueOf(Build.TIME)); } public final void A(String str) { i.e(str, "type"); SPUtils sPUtils = SPUtils.INSTANCE; sPUtils.put(GlobalConstants.CONSTANTS_ENTER_TYPE, "okhttp-" + str); } public final void B(String str, String str2, String str3) { i.e(str, com.heytap.mcssdk.a.a.j); i.e(str2, "url"); i.e(str3, "msg"); com.gaoyuan.mianshu.bean.h hVar = new com.gaoyuan.mianshu.bean.h(str, str2, str3, null, null, null, null, null, 248, null); List<com.gaoyuan.mianshu.bean.h> i = i(); String nowDatetime = TimeUtil.getNowDatetime(); i.d(nowDatetime, "getNowDatetime()"); hVar.i(nowDatetime); i.add(hVar); SPUtils sPUtils = SPUtils.INSTANCE; String r = sPUtils.getGson().r(i); i.d(r, "SPUtils.gson.toJson(list)"); sPUtils.put(GlobalConstants.CONSTANTS_INIT_ERRORMSG, r); } public final void C(String str) { i.e(str, "token"); SPUtils.INSTANCE.put(GlobalConstants.CONSTANTS_JWT_TOKEN, str); } public final void D(String str) { i.e(str, "res"); SPUtils.INSTANCE.put(GlobalConstants.CONSTANTS_LAUNCH_SATE, str); } public final void E(String str, String str2, String str3) { i.e(str, com.heytap.mcssdk.a.a.j); i.e(str2, "url"); i.e(str3, "msg"); c cVar = new c(str, str2, str3); List<c> m = m(); m.add(cVar); SPUtils sPUtils = SPUtils.INSTANCE; String r = sPUtils.getGson().r(m); i.d(r, "SPUtils.gson.toJson(list)"); sPUtils.put(GlobalConstants.CONSTANTS_LAUNCH_STEP, r); } public final void F(String str) { i.e(str, "url"); if (!g.G(str, "http://second", false, 2, null)) { E("1008", str, "网络框架初始化"); SPUtils.INSTANCE.put(GlobalConstants.CONSTANTS_URL_CACHE, str); } } public final void G(String str) { i.e(str, "res"); SPUtils sPUtils = SPUtils.INSTANCE; if (SPUtils.getString$default(sPUtils, GlobalConstants.WEBDOMAIN_DATA, null, 2, null).length() == 0) { sPUtils.put(GlobalConstants.WEBDOMAIN_DATA, str); } } public final String a(String str) { i.e(str, "str"); Charset charset = d.b; byte[] bytes = str.getBytes(charset); i.d(bytes, "this as java.lang.String).getBytes(charset)"); byte[] decode = Base64.decode(bytes, 0); i.d(decode, "decode(str.toByteArray(), Base64.DEFAULT)"); return new String(decode, charset); } public final String b(String str) { i.e(str, "str"); byte[] bytes = str.getBytes(d.b); i.d(bytes, "this as java.lang.String).getBytes(charset)"); String encodeToString = Base64.encodeToString(bytes, 0); i.d(encodeToString, "encodeToString(str.toByteArray(), Base64.DEFAULT)"); return g.E0(encodeToString).toString(); } public final String c() { return SPUtils.getString$default(SPUtils.INSTANCE, GlobalConstants.API_LINK_DATA, null, 2, null); } public final String d() { SPUtils sPUtils = SPUtils.INSTANCE; if (SPUtils.getString$default(sPUtils, GlobalConstants.CONSTANTS_DEVICES_ID, null, 2, null).length() == 0) { sPUtils.put(GlobalConstants.CONSTANTS_DEVICES_ID, n(g().toString())); } return SPUtils.getString$default(sPUtils, GlobalConstants.CONSTANTS_DEVICES_ID, null, 2, null); } public final boolean e() { return SPUtils.INSTANCE.getBoolean(GlobalConstants.CONSTANTS_ERRORUPLOADRES); } public final String f() { return SPUtils.getString$default(SPUtils.INSTANCE, GlobalConstants.CONSTANTS_ENTER_TYPE, null, 2, null); } public final String h() { return SPUtils.getString$default(SPUtils.INSTANCE, GlobalConstants.CONSTANTS_INIT_ERRORMSG, null, 2, null); } public final List<com.gaoyuan.mianshu.bean.h> i() { String h = h(); Type e = new a().e(); i.d(e, "object : TypeToken<Mutab…tErrorReqBean>>() {}.type"); List<com.gaoyuan.mianshu.bean.h> list = (List) SPUtils.INSTANCE.getGson().j(h, e); return list == null ? new ArrayList() : list; } public final String j() { return SPUtils.getString$default(SPUtils.INSTANCE, GlobalConstants.CONSTANTS_JWT_TOKEN, null, 2, null); } public final String k() { return SPUtils.getString$default(SPUtils.INSTANCE, GlobalConstants.CONSTANTS_LAUNCH_SATE, null, 2, null); } public final String l() { return SPUtils.getString$default(SPUtils.INSTANCE, GlobalConstants.CONSTANTS_LAUNCH_STEP, null, 2, null); } public final List<c> m() { String l = l(); Type e = new b().e(); i.d(e, "object : TypeToken<Mutab…aunchStepBean>>() {}.type"); List<c> list = (List) SPUtils.INSTANCE.getGson().j(l, e); return list == null ? new ArrayList() : list; } public final String n(String str) { i.e(str, "input"); MessageDigest instance = MessageDigest.getInstance("MD5"); byte[] bytes = str.getBytes(d.b); i.d(bytes, "this as java.lang.String).getBytes(charset)"); String bigInteger = new BigInteger(1, instance.digest(bytes)).toString(16); i.d(bigInteger, "BigInteger(1, md.digest(…yteArray())).toString(16)"); return g.b0(bigInteger, 32, '0'); } public final String o() { return SPUtils.getString$default(SPUtils.INSTANCE, GlobalConstants.CONSTANTS_NIM_KEY, null, 2, null); } public final String p() { return SPUtils.getString$default(SPUtils.INSTANCE, GlobalConstants.CONSTANTS_APP_VERSIONNAME, null, 2, null); } public final String q() { return SPUtils.getString$default(SPUtils.INSTANCE, GlobalConstants.WEBDOMAIN_DATA, null, 2, null); } public final void r(Context context, TextView textView) { i.e(context, "context"); i.e(textView, "tv"); Object systemService = context.getSystemService("input_method"); Objects.requireNonNull(systemService, "null cannot be cast to non-null type android.view.inputmethod.InputMethodManager"); ((InputMethodManager) systemService).hideSoftInputFromWindow(textView.getWindowToken(), 0); } public final void s() { SPUtils sPUtils = SPUtils.INSTANCE; sPUtils.put(GlobalConstants.CONSTANTS_INIT_ERRORMSG, ""); sPUtils.put(GlobalConstants.CONSTANTS_LAUNCH_STEP, ""); y(false); D(""); } public final void t(Context context) { String str = ""; i.e(context, "context"); try { ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(c.c().getPackageName(), 128); i.d(applicationInfo, "context.packageManager.g…T_META_DATA\n )"); String string = applicationInfo.metaData.getString("com.netease.nim.appKey"); if (string != null) { str = string; } } catch (Exception e) { e.printStackTrace(); } SPUtils.INSTANCE.put(GlobalConstants.CONSTANTS_NIM_KEY, str); } public final void u(Context context) { i.e(context, "context"); String str = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; SPUtils sPUtils = SPUtils.INSTANCE; i.d(str, "res"); sPUtils.put(GlobalConstants.CONSTANTS_APP_VERSIONNAME, str); } public final void v() { SPUtils.INSTANCE.put(GlobalConstants.WEBDOMAIN_DATA, ""); } public final void w(AppConfigResBean appConfigResBean) { i.e(appConfigResBean, "bean"); Log.e("setAppConf", appConfigResBean.toString()); SPUtils.INSTANCE.put(GlobalConstants.CONSTANTS_APPCONFIG_RESBEAN, appConfigResBean); } public final void x(String str) { i.e(str, "res"); SPUtils.INSTANCE.put(GlobalConstants.API_LINK_DATA, str); } public final void y(boolean z) { SPUtils.INSTANCE.put(GlobalConstants.CONSTANTS_ERRORUPLOADRES, Boolean.valueOf(z)); } public final void z(String str) { i.e(str, "url"); SPUtils.INSTANCE.put(GlobalConstants.CONSTANTS_FENFA_CACHE, str); } }