package jd.im; import android.os.Bundle; import android.text.TextUtils; import android.widget.LinearLayout; import base.utils.ShowTools; import com.huawei.hms.framework.network.grs.GrsBaseInfo; import com.jd.sentry.performance.activity.core.trace.StartUpTrace; import com.jingdong.pdj.jddjcommonlib.R; import com.sobot.chat.ZCSobotApi; import com.sobot.chat.api.enumtype.SobotChatAvatarDisplayMode; import com.sobot.chat.api.enumtype.SobotChatTitleDisplayMode; import com.sobot.chat.api.model.Information; import jd.MyInfoHelper; import jd.MyInfoShippingAddress; import jd.app.BaseFragmentActivity; import jd.app.JDApplication; import jd.im.IMNetTools; import jd.net.ServiceProtocol; import org.apache.http.protocol.HTTP; import org.json.JSONException; import org.json.JSONObject; import shopcart.PayTools; public class ImActivity extends BaseFragmentActivity { String bizType = ""; String customer_role = "kefu"; String frontendInfo = GrsBaseInfo.CountryCodeSource.APP; String groupid = "0018fd7aa508482484bdbea21ac324cc"; String identity = "1"; private JSONObject medJson; String params; private LinearLayout root; String service_mode = "1"; String sourceType = "11"; String tenantId = PayTools.FROM_PAGE_DADA; private String to; String usertype = "2"; /* access modifiers changed from: protected */ @Override // androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, androidx.fragment.app.FragmentActivity, jd.app.BaseFragmentActivity, com.jddj.dp.BaseDpActivity public void onCreate(Bundle bundle) { StartUpTrace.recordActivityOnCreateStart("jd.im.ImActivity"); super.onCreate(bundle); setContentView(R.layout.activity_im); getBundle(); findViewById(); processBiz(); } private void processBiz() { if (!TextUtils.isEmpty(JDApplication.ciphertext)) { goEgoo(JDApplication.ciphertext); } else { new IMNetTools(this, this.root).setEncodeCallBack(new IMNetTools.EncodeCallBack() { /* class jd.im.ImActivity.AnonymousClass1 */ @Override // jd.im.IMNetTools.EncodeCallBack public void success(String str) { if (!TextUtils.isEmpty(str)) { ImActivity.this.goEgoo(str); } else { ShowTools.toast("启动在线客服失败,请稍后重试"); } } }); } } private void findViewById() { this.root = (LinearLayout) findViewById(R.id.root); } public void parseParams() { try { if (this.medJson != null) { if (this.medJson.has("bizType")) { this.bizType = this.medJson.getString("bizType"); } if (this.medJson.has("sourceType")) { this.sourceType = this.medJson.getString("sourceType"); } if (this.medJson.has(HTTP.IDENTITY_CODING)) { this.identity = this.medJson.getString(HTTP.IDENTITY_CODING); } if (this.medJson.has("frontendInfo")) { this.frontendInfo = this.medJson.getString("frontendInfo"); } if (this.medJson.has("groupid")) { this.groupid = this.medJson.getString("groupid"); } if (this.medJson.has("tenantId")) { this.tenantId = this.medJson.getString("tenantId"); } if (this.medJson.has("usertype")) { this.usertype = this.medJson.getString("usertype"); } if (this.medJson.has("params")) { this.params = this.medJson.getString("params"); } if (this.medJson.has("customer_role")) { this.customer_role = this.medJson.getString("customer_role"); } if (this.medJson.has("service_mode")) { this.service_mode = this.medJson.getString("service_mode"); } } } catch (JSONException e) { e.printStackTrace(); } } public void getBundle() { if (getIntent().getExtras() != null && !TextUtils.isEmpty(getIntent().getExtras().getString("to"))) { this.to = getIntent().getExtras().getString("to"); if (!TextUtils.isEmpty(getIntent().getExtras().getString("params"))) { try { JSONObject jSONObject = new JSONObject(getIntent().getExtras().getString("params")); if (jSONObject.has("app")) { this.medJson = new JSONObject(jSONObject.getString("app")); } parseParams(); } catch (JSONException e) { e.printStackTrace(); } } } } public void goEgoo(String str) { if (!IMLocalManager.getInstance().isImAvailable()) { IMLocalManager.getInstance().showCallDialog(); finish(); return; } Information information = new Information(); information.setApp_key(ServiceProtocol._T ? "875f3459a4b5444c8d3305f815dafd4e" : "49ba5decdaee4234b978cb96eb2176bd"); information.setPartnerid(str); ZCSobotApi.setChatTitleDisplayMode(getApplicationContext(), SobotChatTitleDisplayMode.ShowFixedText, "京东到家", true); ZCSobotApi.setSwitchMarkStatus(16, true); ZCSobotApi.setChatAvatarDisplayMode(getApplicationContext(), SobotChatAvatarDisplayMode.Default, "https://sobot-test.oss-cn-beijing.aliyuncs.com/console/66a522ea3ef944a98af45bac09220861/userImage/20191024164346682.PNG", false); ZCSobotApi.setNotificationFlag(getApplicationContext(), true, R.drawable.sobot_logo_small_icon, R.drawable.sobot_logo_icon); information.setCustomer_role(this.customer_role); information.setRobotUserPin(str); information.setTenantId(this.tenantId); information.setGroupid(this.groupid); information.setService_mode(Integer.parseInt(this.service_mode)); information.setIdentity(this.identity); information.setBizType(this.bizType); information.setSourceType(this.sourceType); information.setUsertype(this.usertype); information.setFrontendInfo(this.frontendInfo); information.setParams(this.params); MyInfoShippingAddress myInfoShippingAddress = MyInfoHelper.getMyInfoShippingAddress(); if (myInfoShippingAddress != null && myInfoShippingAddress.getCityId() > 0) { information.setCityId(myInfoShippingAddress.getCityId() + ""); } ZCSobotApi.openZCChat(this, information); finish(); } }