QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 UserCenterUtils.java 源代码,内容仅作参考
package com.tencent.mtt.browser.account.usercenter;
import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.taf.JceInputStream;
import com.taf.JceOutputStream;
import com.taf.JceStruct;
import com.taf.JceSynchronizedPool;
import com.tencent.common.task.RoutineDaemon;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.FileUtils;
import com.tencent.common.wup.IWUPRequestCallBack;
import com.tencent.common.wup.WUPRequestBase;
import com.tencent.common.wup.WUPResponseBase;
import com.tencent.common.wup.WUPTaskProxy;
import com.tencent.map.geolocation.util.DateUtils;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.account.base.IAccount;
import com.tencent.mtt.base.account.AccountConst;
import com.tencent.mtt.base.account.AccountInfo;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.utils.QBUrlUtils;
import com.tencent.mtt.base.wup.GUIDManager;
import com.tencent.mtt.base.wup.WUPRequest;
import com.tencent.mtt.base.wup.facade.WUPBusinessConst;
import com.tencent.mtt.browser.account.MTT.GetLifeUserAddressReq;
import com.tencent.mtt.browser.account.MTT.GetLifeUserAddressRsp;
import com.tencent.mtt.browser.account.MTT.WriteLifeUserAddressReq;
import com.tencent.mtt.browser.account.MTT.WriteLifeUserAddressRsp;
import com.tencent.mtt.browser.account.usercenter.MTT.CommonUserInfo;
import com.tencent.mtt.browser.account.usercenter.MTT.ModifyInfoReq;
import com.tencent.mtt.browser.account.usercenter.MTT.ModifyInfoRsp;
import com.tencent.mtt.browser.account.usercenter.MTT.UserCenterInfoReq;
import com.tencent.mtt.browser.account.usercenter.MTT.UserCenterInfoRsp;
import com.tencent.mtt.browser.account.usercenter.UserCenterAddressSelectPage;
import com.tencent.mtt.browser.feeds.facade.IFeedsService;
import com.tencent.mtt.browser.window.WindowManager;
import com.tencent.mtt.operation.event.EventLog;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.qbinfo.QUAUtils;
import com.tencent.mtt.sdkcontext.SDKContext;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.useraddress.City;
import com.tencent.mtt.useraddress.Province;
import com.tencent.mtt.useraddress.RegionUtil;
import com.tencent.mtt.view.dialog.alert.MttLoadingDialog;
import com.tencent.mtt.view.dialog.newui.SimpleDialogBuilder;
import com.tencent.mtt.view.dialog.newui.builder.api.INoImageDialogBuilder;
import com.tencent.mtt.view.dialog.newui.dialog.DialogBase;
import com.tencent.mtt.view.dialog.newui.view.ViewOnClickListener;
import com.tencent.mtt.view.toast.MttToaster;
import java.io.File;
import java.nio.ByteBuffer;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class UserCenterUtils {
public static String f34860a;
static final String f34861b = FileUtils.e() + "/usercenter";
static class AnonymousClass2 implements IWUPRequestCallBack {
final boolean[] f34862a;
final UserCenterAddressSelectPage.EventListener f34863b;
final GetLifeUserAddressReq f34864c;
AnonymousClass2(boolean[] zArr, UserCenterAddressSelectPage.EventListener eventListener, GetLifeUserAddressReq getLifeUserAddressReq) {
this.f34862a = zArr;
this.f34863b = eventListener;
this.f34864c = getLifeUserAddressReq;
}
@Override
public void onWUPTaskFail(WUPRequestBase wUPRequestBase) {
boolean[] zArr = this.f34862a;
if (zArr[0]) {
return;
}
zArr[0] = true;
this.f34863b.a(null);
}
@Override
public void onWUPTaskSuccess(WUPRequestBase wUPRequestBase, WUPResponseBase wUPResponseBase) {
if (wUPResponseBase != null) {
Object obj = wUPResponseBase.get(HiAnalyticsConstant.Direction.RESPONSE, getClass().getClassLoader());
if (!(obj instanceof GetLifeUserAddressRsp)) {
return;
}
GetLifeUserAddressRsp getLifeUserAddressRsp = (GetLifeUserAddressRsp) obj;
boolean[] zArr = this.f34862a;
if (zArr[0]) {
return;
}
zArr[0] = true;
if (!TextUtils.isEmpty(getLifeUserAddressRsp.sContent)) {
BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
@Override
public void run() {
String str = "https://life.html5.qq.com/addressSelectList?qbid=" + AnonymousClass2.this.f34864c.sQbid;
UserCenterAddressSelectContainer userCenterAddressSelectContainer = new UserCenterAddressSelectContainer(ContextHolder.getAppContext(), WindowManager.a().s());
UserCenterAddressSelectPage userCenterAddressSelectPage = (UserCenterAddressSelectPage) userCenterAddressSelectContainer.buildEntryPage(null);
userCenterAddressSelectPage.loadUrl(str);
userCenterAddressSelectPage.setEventListener(new UserCenterAddressSelectPage.EventListener() {
@Override
public void a(Bundle bundle) {
AnonymousClass2.this.f34863b.a(bundle);
}
});
userCenterAddressSelectContainer.addPage(userCenterAddressSelectPage);
userCenterAddressSelectContainer.forward(true);
}
});
return;
}
} else {
boolean[] zArr2 = this.f34862a;
if (zArr2[0]) {
return;
} else {
zArr2[0] = true;
}
}
this.f34863b.a(null);
}
}
static class AnonymousClass5 implements IWUPRequestCallBack {
AnonymousClass5() {
}
@Override
public void onWUPTaskFail(WUPRequestBase wUPRequestBase) {
}
@Override
public void onWUPTaskSuccess(WUPRequestBase wUPRequestBase, WUPResponseBase wUPResponseBase) {
Object obj;
if (wUPRequestBase == null || wUPResponseBase == null || (obj = wUPResponseBase.get(HiAnalyticsConstant.Direction.RESPONSE, getClass().getClassLoader())) == null || !(obj instanceof UserCenterInfoRsp)) {
return;
}
final UserCenterInfoRsp userCenterInfoRsp = (UserCenterInfoRsp) obj;
RegionUtil regionUtil = new RegionUtil(null, null);
if (regionUtil.d()) {
UserCenterUtils.a(userCenterInfoRsp, regionUtil.c());
} else {
regionUtil.a(new RegionUtil.IRegionLoadListener() {
@Override
public void a(List<Province> list) {
UserCenterUtils.a(userCenterInfoRsp, list);
}
}).c();
}
}
}
public static Typeface a(String str, Context context) {
try {
return Typeface.createFromAsset(context.getAssets(), "fonts/" + str);
} catch (Exception unused) {
return null;
}
}
public static CommonUserInfo a() {
String str;
CommonUserInfo commonUserInfo = new CommonUserInfo();
AccountInfo currentUserInfo = ((IAccount) SDKContext.getInstance().getService(IAccount.class)).getCurrentUserInfo();
if (currentUserInfo.isQQAccount()) {
commonUserInfo.eTokenType = 1;
commonUserInfo.iIdType = 1;
commonUserInfo.sToken = currentUserInfo.A2;
str = String.valueOf(728024701);
} else if (currentUserInfo.isConnectAccount()) {
commonUserInfo.eTokenType = 4;
commonUserInfo.iIdType = 3;
commonUserInfo.sToken = currentUserInfo.access_token;
str = AccountConst.QQ_CONNECT_APPID;
} else {
if (!currentUserInfo.isWXAccount()) {
if (currentUserInfo.isPhoneAccount()) {
commonUserInfo.eTokenType = 7;
commonUserInfo.iIdType = 6;
commonUserInfo.sToken = currentUserInfo.access_token;
str = AccountConst.PHONE_APPID;
}
commonUserInfo.sQbid = currentUserInfo.qbId;
commonUserInfo.sUserId = currentUserInfo.getQQorWxId();
return commonUserInfo;
}
commonUserInfo.eTokenType = 2;
commonUserInfo.iIdType = 2;
commonUserInfo.sToken = currentUserInfo.access_token;
str = AccountConst.WX_APPID;
}
commonUserInfo.sAppId = str;
commonUserInfo.sQbid = currentUserInfo.qbId;
commonUserInfo.sUserId = currentUserInfo.getQQorWxId();
return commonUserInfo;
}
public static MttLoadingDialog a(Context context) {
return new MttLoadingDialog(context);
}
public static void a(JceStruct jceStruct, String str) {
try {
JceOutputStream acquireout = JceSynchronizedPool.getInstance().acquireout();
acquireout.setServerEncoding("UTF-8");
jceStruct.writeTo(acquireout);
AccountInfo currentUserInfo = ((IAccount) SDKContext.getInstance().getService(IAccount.class)).getCurrentUserInfo();
FileUtils.a(new File(f34861b, currentUserInfo.qbId + str), acquireout.toByteArray());
JceSynchronizedPool.getInstance().releaseOut(acquireout);
} catch (Exception unused) {
}
}
public static void a(IWUPRequestCallBack iWUPRequestCallBack) {
WUPRequest wUPRequest = new WUPRequest("QBUserInfo", "getUserCenterInfo", iWUPRequestCallBack);
UserCenterInfoReq userCenterInfoReq = new UserCenterInfoReq();
userCenterInfoReq.stCommonUserInfo = a();
wUPRequest.putRequestParam(HiAnalyticsConstant.Direction.REQUEST, userCenterInfoReq);
WUPTaskProxy.send(wUPRequest);
}
public static void a(UserCenterInfoRsp userCenterInfoRsp, List<Province> list) {
if (list != null) {
try {
if (!TextUtils.isEmpty(userCenterInfoRsp.sProvince)) {
for (Province province : list) {
if (TextUtils.equals(province.getId(), userCenterInfoRsp.stLocationCode.sProvinceCode)) {
userCenterInfoRsp.sProvince = province.getName();
Iterator<City> it = province.getCities().iterator();
while (true) {
if (it.hasNext()) {
City next = it.next();
if (TextUtils.equals(next.getId(), userCenterInfoRsp.stLocationCode.sCityCode)) {
userCenterInfoRsp.sCity = next.getName();
break;
}
}
}
}
}
}
} catch (Exception unused) {
return;
}
}
JceOutputStream acquireout = JceSynchronizedPool.getInstance().acquireout();
acquireout.setServerEncoding("UTF-8");
userCenterInfoRsp.writeTo(acquireout);
AccountInfo currentUserInfo = ((IAccount) SDKContext.getInstance().getService(IAccount.class)).getCurrentUserInfo();
FileUtils.a(new File(f34861b, currentUserInfo.getQQorWxId() + "usercenter_info.dat"), acquireout.toByteArray());
JceSynchronizedPool.getInstance().releaseOut(acquireout);
}
public static void a(final UserCenterAddressSelectPage.EventListener eventListener) {
AccountInfo currentUserInfo = ((IAccount) SDKContext.getInstance().getService(IAccount.class)).getCurrentUserInfo();
if (!currentUserInfo.isLogined()) {
eventListener.a(null);
return;
}
final boolean[] zArr = {false};
GetLifeUserAddressReq getLifeUserAddressReq = new GetLifeUserAddressReq();
getLifeUserAddressReq.sGuid = GUIDManager.a().f();
getLifeUserAddressReq.sQbid = currentUserInfo.qbId;
getLifeUserAddressReq.sQua = QUAUtils.a();
WUPRequest wUPRequest = new WUPRequest("LifeService", "GetLifeUserAddress", new AnonymousClass2(zArr, eventListener, getLifeUserAddressReq));
wUPRequest.putRequestParam(HiAnalyticsConstant.Direction.REQUEST, getLifeUserAddressReq);
WUPTaskProxy.send(wUPRequest);
RoutineDaemon.a().a(new Runnable() {
@Override
public void run() {
boolean[] zArr2 = zArr;
if (zArr2[0]) {
return;
}
zArr2[0] = true;
eventListener.a(null);
}
}, DateUtils.TEN_SECOND);
}
public static void a(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
AccountInfo currentUserInfo = ((IAccount) SDKContext.getInstance().getService(IAccount.class)).getCurrentUserInfo();
if (currentUserInfo.isLogined()) {
WriteLifeUserAddressReq writeLifeUserAddressReq = new WriteLifeUserAddressReq();
writeLifeUserAddressReq.sContent = str;
writeLifeUserAddressReq.sGuid = GUIDManager.a().f();
writeLifeUserAddressReq.sQbid = currentUserInfo.qbId;
writeLifeUserAddressReq.sQua = QUAUtils.a();
WUPRequest wUPRequest = new WUPRequest("LifeService", "writeLifeUserAddress", new IWUPRequestCallBack() {
@Override
public void onWUPTaskFail(WUPRequestBase wUPRequestBase) {
}
@Override
public void onWUPTaskSuccess(WUPRequestBase wUPRequestBase, WUPResponseBase wUPResponseBase) {
if (wUPResponseBase != null) {
Object obj = wUPResponseBase.get(HiAnalyticsConstant.Direction.RESPONSE, getClass().getClassLoader());
if (obj instanceof WriteLifeUserAddressRsp) {
}
}
}
});
wUPRequest.putRequestParam(HiAnalyticsConstant.Direction.REQUEST, writeLifeUserAddressReq);
WUPTaskProxy.send(wUPRequest);
}
}
public static void a(String str, String str2) {
if (!b(str, WUPBusinessConst.R) || TextUtils.isEmpty(QBUrlUtils.l(str2))) {
return;
}
PublicSettingManager.a().setString("key_openplatform_recharge_url", str2);
}
public static void a(final String str, boolean z) {
if (z) {
BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
@Override
public void run() {
INoImageDialogBuilder e = SimpleDialogBuilder.e();
e.e(str);
e.a(MttResources.l(R.string.atp));
e.a_(new ViewOnClickListener() {
@Override
public void onClick(View view, DialogBase dialogBase) {
dialogBase.dismiss();
}
});
e.e();
}
});
} else {
MttToaster.show(str, 1);
}
}
public static void a(final Map<Integer, String> map) {
WUPRequest wUPRequest = new WUPRequest("QBUserInfo", "ModifyUserCenterInfo", new IWUPRequestCallBack() {
@Override
public void onWUPTaskFail(WUPRequestBase wUPRequestBase) {
EventLog.a("账号中心", "修改账号信息", "修改账号信息失败", "", "alinli", -1);
}
@Override
public void onWUPTaskSuccess(WUPRequestBase wUPRequestBase, WUPResponseBase wUPResponseBase) {
Object obj;
if (wUPRequestBase == null || wUPResponseBase == null || (obj = wUPResponseBase.get(HiAnalyticsConstant.Direction.RESPONSE, getClass().getClassLoader())) == null || !(obj instanceof ModifyInfoRsp)) {
return;
}
ModifyInfoRsp modifyInfoRsp = (ModifyInfoRsp) obj;
EventLog.a("账号中心", "修改账号信息", "修改账号信息结果 " + modifyInfoRsp.iRet, "", "alinli", 1);
if (modifyInfoRsp.iRet == 0) {
((IFeedsService) QBContext.getInstance().getService(IFeedsService.class)).sendAccountInfoChangeNotify(map);
}
}
});
ModifyInfoReq modifyInfoReq = new ModifyInfoReq();
modifyInfoReq.mModifyValues = map;
modifyInfoReq.stCommonUserInfo = a();
wUPRequest.putRequestParam(HiAnalyticsConstant.Direction.REQUEST, modifyInfoReq);
WUPTaskProxy.send(wUPRequest);
}
public static UserCenterInfoRsp b() {
AccountInfo currentUserInfo = ((IAccount) SDKContext.getInstance().getService(IAccount.class)).getCurrentUserInfo();
File file = new File(f34861b, currentUserInfo.getQQorWxId() + "usercenter_info.dat");
if (!file.exists()) {
return null;
}
try {
ByteBuffer h = FileUtils.h(file);
JceInputStream jceInputStream = new JceInputStream(h);
jceInputStream.setServerEncoding("UTF-8");
UserCenterInfoRsp userCenterInfoRsp = new UserCenterInfoRsp();
try {
userCenterInfoRsp.readFrom(jceInputStream);
FileUtils.h().a(h);
} catch (Exception | OutOfMemoryError unused) {
}
return userCenterInfoRsp;
} catch (Exception | OutOfMemoryError unused2) {
return null;
}
}
public static void b(JceStruct jceStruct, String str) {
AccountInfo currentUserInfo = ((IAccount) SDKContext.getInstance().getService(IAccount.class)).getCurrentUserInfo();
File file = new File(f34861b, currentUserInfo.qbId + str);
if (file.exists()) {
try {
ByteBuffer h = FileUtils.h(file);
JceInputStream jceInputStream = new JceInputStream(h);
jceInputStream.setServerEncoding("UTF-8");
jceStruct.readFrom(jceInputStream);
FileUtils.h().a(h);
} catch (Exception | OutOfMemoryError unused) {
}
}
}
private static boolean b(String str, String str2) {
if (str != null && str.length() == str2.length()) {
return str.equals(str2);
}
return false;
}
}