正在查看: 星辰VPN v1.2.3 应用的 b.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 星辰VPN v1.2.3 应用的 b.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package im.crisp.client.internal.u;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.Editable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatEditText;
import androidx.appcompat.widget.AppCompatSpinner;
import androidx.fragment.app.DialogFragment;
import im.crisp.client.Crisp;
import im.crisp.client.R;
import im.crisp.client.data.Company;
import im.crisp.client.data.Employment;
import im.crisp.client.data.Geolocation;
import im.crisp.client.data.SessionEvent;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
public class b extends DialogFragment implements AdapterView.OnItemSelectedListener {
private static final List<Company> A;
private static final String u = "im.crisp.client.DEBUG_PREFERENCES";
private static final String v = "im.crisp.client.DEBUG_PREFERENCES.TOKEN_ID";
private static SharedPreferences w;
private static final List<SessionEvent.Color> x = Arrays.asList(SessionEvent.Color.BLACK, SessionEvent.Color.BLUE, SessionEvent.Color.BROWN, SessionEvent.Color.GREEN, SessionEvent.Color.GREY, SessionEvent.Color.ORANGE, SessionEvent.Color.PINK, SessionEvent.Color.PURPLE, SessionEvent.Color.RED, SessionEvent.Color.YELLOW);
private static Company y;
private static Company z;
private AppCompatEditText d;
private AppCompatEditText e;
private AppCompatEditText f;
private AppCompatEditText g;
private AppCompatSpinner h;
private SessionEvent.Color i;
private AppCompatEditText j;
private AppCompatEditText f43k;
private AppCompatEditText l;
private HashMap<String, Object> m;
private AppCompatEditText n;
private AppCompatEditText o;
private AppCompatSpinner p;
private Company q;
private AppCompatEditText r;
private AppCompatEditText s;
private AppCompatEditText t;
static {
try {
y = new Company(Crisp.a, new URL("https://crisp.chat/en/"), "Give your customer experience a human touch", new Employment("CTO", "Software Engineer"), new Geolocation("Nantes", "FR"));
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
z = new Company("Google", new URL("https://www.google.com/"), "I'm Feeling Lucky", new Employment("CEO", "Earth owner"), new Geolocation("Palo Alto", "US"));
} catch (MalformedURLException e2) {
e2.printStackTrace();
}
A = Arrays.asList(y, z);
}
private void a() {
HashMap<String, Object> hashMap;
Boolean bool;
Context context = getContext();
if (context != null) {
Editable text = this.f43k.getText();
String obj = (text == null || text.length() <= 0) ? null : text.toString();
Editable text2 = this.l.getText();
String obj2 = (text2 == null || text2.length() <= 0) ? null : text2.toString();
if (obj == null || obj2 == null) {
Toast.makeText(context, "Event data key and/or value empty", 0).show();
return;
}
if (this.m == null) {
this.m = new HashMap<>(1);
}
try {
this.m.put(obj, Integer.valueOf(Integer.parseInt(obj2)));
} catch (NumberFormatException unused) {
if ("true".equalsIgnoreCase(obj2)) {
hashMap = this.m;
bool = Boolean.TRUE;
} else if ("false".equalsIgnoreCase(obj2)) {
hashMap = this.m;
bool = Boolean.FALSE;
} else {
this.m.put(obj, obj2);
}
hashMap.put(obj, bool);
}
Toast.makeText(context, "Event data set(" + obj + ", " + obj2 + ')', 0).show();
this.f43k.setText(null);
this.l.setText(null);
}
}
public void a(View view) {
n();
}
public static b b() {
return new b();
}
public void b(View view) {
m();
}
private void c() {
Context context = getContext();
if (context != null) {
Toast.makeText(context, "Reset Chat Session", 0).show();
Crisp.resetChatSession(context.getApplicationContext());
}
}
public void c(View view) {
i();
}
private void d() {
this.e.setText(null);
w.edit().remove(v).apply();
Crisp.setTokenID(null);
Toast.makeText(getContext(), "Token reset", 0).show();
}
public void d(View view) {
h();
}
private void e() {
Context context = getContext();
if (context != null) {
Editable text = this.o.getText();
String obj = text != null ? text.toString() : null;
if (text == null || !Crisp.setUserAvatar(obj)) {
this.o.setError(getString(R.string.crisp_debug_avatar_error));
return;
}
Crisp.setUserAvatar(obj);
this.o.setError(null);
Toast.makeText(context, "Avatar set", 0).show();
}
}
public void e(View view) {
j();
}
public void f(View view) {
d();
}
private boolean f() {
Context context = getContext();
if (context == null) {
return false;
}
Company company = this.q;
if (company != null) {
Crisp.setUserCompany(company);
return true;
}
Toast.makeText(context, "No company selected, cancel", 0).show();
return false;
}
private void g() {
SessionEvent.Color color;
Context context = getContext();
if (context != null) {
Editable text = this.j.getText();
String obj = (text == null || text.length() <= 0) ? null : text.toString();
if (obj == null || (color = this.i) == null) {
Toast.makeText(context, "Empty event name and/or color", 0).show();
return;
}
SessionEvent sessionEvent = new SessionEvent(obj, color);
HashMap<String, Object> hashMap = this.m;
if (hashMap != null) {
for (Map.Entry<String, Object> entry : hashMap.entrySet()) {
Object value = entry.getValue();
if (value instanceof Integer) {
sessionEvent.setInt(entry.getKey(), ((Integer) value).intValue());
} else {
boolean z5 = value instanceof Boolean;
String key = entry.getKey();
if (z5) {
sessionEvent.setBool(key, ((Boolean) value).booleanValue());
} else {
sessionEvent.setString(key, (String) value);
}
}
}
}
Crisp.pushSessionEvent(sessionEvent);
Toast.makeText(context, "Event set", 0).show();
this.j.setText(null);
this.m = null;
}
}
public void g(View view) {
l();
}
private void h() {
Context context = getContext();
if (context != null) {
Editable text = this.r.getText();
String obj = text != null ? text.toString() : null;
if (text == null || !Crisp.setUserEmail(obj)) {
this.r.setError(getString(R.string.crisp_debug_mail_error));
} else {
this.r.setError(null);
Toast.makeText(context, "Mail set", 0).show();
}
}
}
public void h(View view) {
a();
}
private void i() {
Context context = getContext();
if (context != null) {
Editable text = this.s.getText();
String obj = text != null ? text.toString() : null;
if (text == null) {
this.s.setError(getString(R.string.crisp_debug_nickname_error));
return;
}
Crisp.setUserNickname(obj);
this.s.setError(null);
Toast.makeText(context, "Nickname set", 0).show();
}
}
public void i(View view) {
g();
}
private void j() {
Context context = getContext();
if (context != null) {
Editable text = this.t.getText();
String obj = text != null ? text.toString() : null;
if (text == null || !Crisp.setUserPhone(obj)) {
this.t.setError(getString(R.string.crisp_debug_phone_error));
} else {
this.t.setError(null);
Toast.makeText(context, "Phone set", 0).show();
}
}
}
public void j(View view) {
k();
}
private void k() {
Context context = getContext();
if (context != null) {
Editable text = this.n.getText();
String obj = text != null ? text.toString() : null;
if (text == null) {
this.n.setError(getString(R.string.crisp_debug_segment_error));
return;
}
Crisp.setSessionSegment(obj);
this.n.setError(null);
Toast.makeText(context, "Segment set", 0).show();
}
}
public void k(View view) {
c();
}
private void l() {
Context context = getContext();
if (context != null) {
Editable text = this.f.getText();
String obj = (text == null || text.length() <= 0) ? null : text.toString();
Editable text2 = this.g.getText();
String obj2 = (text2 == null || text2.length() <= 0) ? null : text2.toString();
if (obj == null || obj2 == null) {
Toast.makeText(context, "Empty session data key and/or value", 0).show();
return;
}
try {
Crisp.setSessionInt(obj, Integer.parseInt(obj2));
} catch (NumberFormatException unused) {
if ("true".equalsIgnoreCase(obj2)) {
Crisp.setSessionBool(obj, true);
} else if ("false".equalsIgnoreCase(obj2)) {
Crisp.setSessionBool(obj, false);
} else {
Crisp.setSessionString(obj, obj2);
}
}
Toast.makeText(context, "Session data set", 0).show();
this.f.setText(null);
this.g.setText(null);
}
}
public void l(View view) {
e();
}
private void m() {
Editable text = this.e.getText();
String obj = (text == null || text.length() <= 0) ? null : text.toString();
if (obj == null) {
obj = UUID.randomUUID().toString();
this.e.setText(obj);
w.edit().putString(v, obj).apply();
}
Crisp.setTokenID(obj);
Toast.makeText(getContext(), "Token set", 0).show();
}
public void m(View view) {
f();
}
private void n() {
Context context = getContext();
if (context != null) {
Editable text = this.d.getText();
String obj = text != null ? text.toString() : null;
if (obj == null) {
this.d.setError(getString(R.string.crisp_debug_website_error));
return;
}
Crisp.configure(context.getApplicationContext(), obj);
this.d.setError(null);
Toast.makeText(context, "Nickname set", 0).show();
}
}
public void onCreate(@Nullable Bundle bundle) {
super.onCreate(bundle);
Context applicationContext = requireContext().getApplicationContext();
setStyle(0, getResources().getIdentifier("CrispTheme.Dialog.Debug", "style", applicationContext.getPackageName()));
if (w == null) {
w = applicationContext.getSharedPreferences(u, 0);
}
}
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
Dialog dialog = getDialog();
Objects.requireNonNull(dialog);
Window window = dialog.getWindow();
Objects.requireNonNull(window);
final int i = 1;
window.requestFeature(1);
final int i2 = 0;
View inflate = layoutInflater.inflate(R.layout.crisp_fragment_dialog_debug, viewGroup, false);
Context requireContext = requireContext();
ArrayAdapter<CharSequence> createFromResource = ArrayAdapter.createFromResource(requireContext, R.array.crisp_debug_companies, android.R.layout.simple_spinner_item);
createFromResource.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
AppCompatSpinner findViewById = inflate.findViewById(R.id.crisp_spinner_company);
this.p = findViewById;
findViewById.setAdapter(createFromResource);
this.p.setOnItemSelectedListener(this);
ArrayAdapter<CharSequence> createFromResource2 = ArrayAdapter.createFromResource(requireContext, R.array.crisp_debug_event_colors, android.R.layout.simple_spinner_item);
createFromResource.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
AppCompatSpinner findViewById2 = inflate.findViewById(R.id.crisp_spinner_event_color);
this.h = findViewById2;
findViewById2.setAdapter(createFromResource2);
this.h.setOnItemSelectedListener(this);
this.d = inflate.findViewById(R.id.crisp_text_website);
this.e = inflate.findViewById(R.id.crisp_text_token_id);
this.e.setText(w.getString(v, null));
this.f = inflate.findViewById(R.id.crisp_text_session_data_key);
this.g = inflate.findViewById(R.id.crisp_text_session_data_value);
this.j = inflate.findViewById(R.id.crisp_text_event_name);
this.f43k = inflate.findViewById(R.id.crisp_text_event_key);
this.l = inflate.findViewById(R.id.crisp_text_event_value);
this.n = inflate.findViewById(R.id.crisp_text_segment);
this.o = inflate.findViewById(R.id.crisp_text_avatar);
this.r = inflate.findViewById(R.id.crisp_text_mail);
this.s = inflate.findViewById(R.id.crisp_text_nickname);
this.t = inflate.findViewById(R.id.crisp_text_phone);
inflate.findViewById(R.id.crisp_button_website_set).setOnClickListener(new f(this, i2));
inflate.findViewById(R.id.crisp_button_set_token_id).setOnClickListener(new View.OnClickListener(this) {
public final b e;
{
this.e = this;
}
@Override
public final void onClick(View view) {
switch (i) {
case 0:
this.e.c(view);
break;
case 1:
this.e.b(view);
break;
case 2:
this.e.h(view);
break;
default:
this.e.k(view);
break;
}
}
});
inflate.findViewById(R.id.crisp_button_reset_token_id).setOnClickListener(new View.OnClickListener(this) {
public final b e;
{
this.e = this;
}
@Override
public final void onClick(View view) {
switch (i) {
case 0:
this.e.d(view);
break;
case 1:
this.e.f(view);
break;
case 2:
this.e.i(view);
break;
default:
this.e.l(view);
break;
}
}
});
final int i5 = 2;
inflate.findViewById(R.id.crisp_button_set_session_data).setOnClickListener(new f(this, i5));
inflate.findViewById(R.id.crisp_button_add_event_data).setOnClickListener(new View.OnClickListener(this) {
public final b e;
{
this.e = this;
}
@Override
public final void onClick(View view) {
switch (i5) {
case 0:
this.e.c(view);
break;
case 1:
this.e.b(view);
break;
case 2:
this.e.h(view);
break;
default:
this.e.k(view);
break;
}
}
});
inflate.findViewById(R.id.crisp_button_set_event).setOnClickListener(new View.OnClickListener(this) {
public final b e;
{
this.e = this;
}
@Override
public final void onClick(View view) {
switch (i5) {
case 0:
this.e.d(view);
break;
case 1:
this.e.f(view);
break;
case 2:
this.e.i(view);
break;
default:
this.e.l(view);
break;
}
}
});
final int i6 = 3;
inflate.findViewById(R.id.crisp_button_set_segment).setOnClickListener(new f(this, i6));
inflate.findViewById(R.id.crisp_button_reset_session).setOnClickListener(new View.OnClickListener(this) {
public final b e;
{
this.e = this;
}
@Override
public final void onClick(View view) {
switch (i6) {
case 0:
this.e.c(view);
break;
case 1:
this.e.b(view);
break;
case 2:
this.e.h(view);
break;
default:
this.e.k(view);
break;
}
}
});
inflate.findViewById(R.id.crisp_button_avatar_set).setOnClickListener(new View.OnClickListener(this) {
public final b e;
{
this.e = this;
}
@Override
public final void onClick(View view) {
switch (i6) {
case 0:
this.e.d(view);
break;
case 1:
this.e.f(view);
break;
case 2:
this.e.i(view);
break;
default:
this.e.l(view);
break;
}
}
});
inflate.findViewById(R.id.crisp_button_set_company).setOnClickListener(new f(this, 4));
inflate.findViewById(R.id.crisp_button_nickname_set).setOnClickListener(new View.OnClickListener(this) {
public final b e;
{
this.e = this;
}
@Override
public final void onClick(View view) {
switch (i2) {
case 0:
this.e.c(view);
break;
case 1:
this.e.b(view);
break;
case 2:
this.e.h(view);
break;
default:
this.e.k(view);
break;
}
}
});
inflate.findViewById(R.id.crisp_button_mail_set).setOnClickListener(new View.OnClickListener(this) {
public final b e;
{
this.e = this;
}
@Override
public final void onClick(View view) {
switch (i2) {
case 0:
this.e.d(view);
break;
case 1:
this.e.f(view);
break;
case 2:
this.e.i(view);
break;
default:
this.e.l(view);
break;
}
}
});
inflate.findViewById(R.id.crisp_button_phone_set).setOnClickListener(new f(this, i));
return inflate;
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
if (adapterView.equals(this.p)) {
this.q = A.get(i);
}
if (adapterView.equals(this.h)) {
this.i = x.get(i);
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
}