正在查看: bbinstant v6.24.0 应用的 KapchatRegistrationActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: bbinstant v6.24.0 应用的 KapchatRegistrationActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.adjetter.kapchatsdk.activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.adjetter.kapchatsdk.KapchatConnection;
import com.adjetter.kapchatsdk.KapchatHelper;
import com.adjetter.kapchatsdk.KapchatLoginResponse;
import com.adjetter.kapchatsdk.KapchatService;
import com.adjetter.kapchatsdk.R;
import com.amazon.identity.auth.device.authorization.AuthorizationResponseParser;
import com.amazonaws.services.s3.Headers;
import com.bigbasket.bbinstant.core.payments.activity.ZetaSodexoActivity;
import com.google.gson.Gson;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
public class KapchatRegistrationActivity extends AppCompatActivity {
EditText contactNo;
EditText email;
EditText name;
EditText query;
TextView submitButton;
String supportKey;
private class KapchatRegister extends AsyncTask<Void, Void, String> {
String contactNo;
Context context;
String email;
ProgressDialog progressDialog;
String query;
String supportKey;
String userName;
public KapchatRegister(Context context, String str, String str2, String str3, String str4, String str5) {
this.progressDialog = null;
this.contactNo = str3;
this.userName = str;
this.context = context;
this.query = str4;
this.email = str2;
this.supportKey = str5;
ProgressDialog progressDialog = new ProgressDialog(KapchatRegistrationActivity.this);
this.progressDialog = progressDialog;
progressDialog.setMessage("Creating Session...");
this.progressDialog.setCancelable(false);
this.progressDialog.show();
}
private String makeRequest(String str) throws Exception {
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty(Headers.CONTENT_LANGUAGE, "en-US");
httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(true);
httpURLConnection.connect();
String readInputStreamToString = readInputStreamToString(httpURLConnection);
StringBuilder sb = new StringBuilder();
sb.append("login response ");
sb.append(readInputStreamToString);
KapchatLoginResponse kapchatLoginResponse = (KapchatLoginResponse) new Gson().fromJson(readInputStreamToString, KapchatLoginResponse.class);
if (kapchatLoginResponse == null || kapchatLoginResponse.getStatus() == null || !kapchatLoginResponse.getStatus().equalsIgnoreCase(ZetaSodexoActivity.ZETA_SDXO_TPIN_SUCCESS_TXT)) {
if (kapchatLoginResponse == null || kapchatLoginResponse.getStatus() == null || !kapchatLoginResponse.getStatus().equalsIgnoreCase(AuthorizationResponseParser.ERROR)) {
KapchatHelper.logoutKapchat(this.context);
return "KS203";
}
KapchatHelper.logoutKapchat(this.context);
return kapchatLoginResponse.getErrorCode();
}
Bundle bundle = new Bundle();
SharedPreferences.Editor edit = this.context.getSharedPreferences("kapchatpreference", 0).edit();
edit.putString("userName", "");
edit.putString("password", "");
edit.putString("resourcePrefix", "" + kapchatLoginResponse.getResourcePrefix());
edit.putString("leadId", "" + kapchatLoginResponse.getLeadId());
edit.putString("taskId", "" + kapchatLoginResponse.getTaskId());
edit.putString("ticketId", "" + kapchatLoginResponse.getTicketId());
edit.putString("guestsession", "true");
edit.apply();
System.out.println("#### Support id is : " + kapchatLoginResponse.getSupportId());
XMPPTCPConnection xMPPTCPConnection = KapchatConnection.mConnection;
if (xMPPTCPConnection != null && xMPPTCPConnection.isConnected()) {
KapchatConnection.mConnection.disconnect();
}
bundle.putString("userName", "" + kapchatLoginResponse.getChatUserName());
bundle.putString("password", "" + kapchatLoginResponse.getChatPassword());
bundle.putString("contactName", "" + kapchatLoginResponse.getCustomerName());
bundle.putString("supportId", "" + kapchatLoginResponse.getSupportId());
bundle.putString("bucketName", "" + kapchatLoginResponse.getBucketName());
bundle.putString("uploadSecretKey", "" + kapchatLoginResponse.getUploadSecretKey());
bundle.putString("uploadAccessKey", "" + kapchatLoginResponse.getUploadAccessKey());
KapchatConnection.mConnection = null;
Intent intent = new Intent(this.context, (Class<?>) KapchatService.class);
intent.putExtras(bundle);
if (Build.VERSION.SDK_INT >= 26) {
KapchatRegistrationActivity.this.getApplicationContext().startService(intent);
} else {
KapchatRegistrationActivity.this.getApplicationContext().startService(intent);
}
httpURLConnection.disconnect();
return ZetaSodexoActivity.ZETA_SDXO_TPIN_SUCCESS_TXT;
}
private java.lang.String readInputStreamToString(java.net.HttpURLConnection r5) {
throw new UnsupportedOperationException("Method not decompiled: com.adjetter.kapchatsdk.activity.KapchatRegistrationActivity.KapchatRegister.readInputStreamToString(java.net.HttpURLConnection):java.lang.String");
}
@Override
public String doInBackground(Void... voidArr) {
try {
String makeRequest = makeRequest(KapchatHelper.url + "/home/get-nonreg-supportchat-user.html?sk=" + URLEncoder.encode(this.supportKey) + "&name=" + URLEncoder.encode(this.userName) + "&email=" + this.email + "&contact=" + this.contactNo + "&message=" + this.query);
return !makeRequest.equalsIgnoreCase(ZetaSodexoActivity.ZETA_SDXO_TPIN_SUCCESS_TXT) ? makeRequest : ZetaSodexoActivity.ZETA_SDXO_TPIN_SUCCESS_TXT;
} catch (Exception e) {
e.printStackTrace();
return "KS0202";
}
}
@Override
public void onPostExecute(String str) {
super.onPostExecute((KapchatRegister) str);
ProgressDialog progressDialog = this.progressDialog;
if (progressDialog != null && progressDialog.isShowing()) {
this.progressDialog.dismiss();
}
if (!str.equalsIgnoreCase(ZetaSodexoActivity.ZETA_SDXO_TPIN_SUCCESS_TXT)) {
Toast.makeText(KapchatRegistrationActivity.this, "Registration Failed!1 Try Later !!", 0).show();
return;
}
Bundle bundle = new Bundle();
bundle.putString("templateMessage", this.query);
Intent intent = new Intent(this.context, (Class<?>) KapchatScreenActivity.class);
intent.putExtras(bundle);
this.context.startActivity(intent);
KapchatRegistrationActivity.this.finish();
}
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_kapchatregistration);
setupactionbar();
this.name = (EditText) findViewById(R.id.name);
this.email = (EditText) findViewById(R.id.email);
this.contactNo = (EditText) findViewById(R.id.contactno);
this.query = (EditText) findViewById(R.id.message);
this.submitButton = (TextView) findViewById(R.id.submitBtn);
if (getIntent() != null && getIntent().getExtras() != null && getIntent().getExtras().getString("supportKey") != null) {
this.supportKey = getIntent().getExtras().getString("supportKey");
}
this.submitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (KapchatRegistrationActivity.this.valid()) {
if (!KapchatHelper.isOnline(KapchatRegistrationActivity.this)) {
Toast.makeText(KapchatRegistrationActivity.this, "Please Check Your Internet Connection", 0).show();
} else {
KapchatRegistrationActivity kapchatRegistrationActivity = KapchatRegistrationActivity.this;
kapchatRegistrationActivity.new KapchatRegister(kapchatRegistrationActivity, kapchatRegistrationActivity.name.getText().toString(), KapchatRegistrationActivity.this.email.getText().toString(), KapchatRegistrationActivity.this.contactNo.getText().toString(), KapchatRegistrationActivity.this.query.getText().toString(), KapchatRegistrationActivity.this.supportKey).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
}
}
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == 16908332) {
finish();
}
return super.onOptionsItemSelected(menuItem);
}
public void setupactionbar() {
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
ActionBar supportActionBar = getSupportActionBar();
supportActionBar.setElevation(0.0f);
supportActionBar.setDisplayHomeAsUpEnabled(true);
supportActionBar.setDisplayShowHomeEnabled(true);
}
public boolean valid() {
if (this.name.getText().toString().equalsIgnoreCase("")) {
this.name.setError("Enter Name");
return false;
}
if (this.query.getText().toString().equalsIgnoreCase("")) {
this.query.setError("Enter your Query");
return false;
}
this.name.setError(null);
this.query.setError(null);
return true;
}
}