OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

以下内容为反编译后的 ExchangeViewModel.java 源代码,内容仅作参考


package com.excelliance.kxqp.gs.out.ExchangeGoogleAccount;

import android.content.Context;
import android.os.Handler;
import android.os.HandlerThread;
import android.text.TextUtils;
import android.util.Log;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.gs.util.as;
import com.excelliance.kxqp.gs.util.bd;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.task.store.c;
import org.json.JSONObject;

public class ExchangeViewModel extends ViewModel {

    private final Handler f7899a;

    private final MutableLiveData<a> f7900b = new MutableLiveData<>();
    private final MutableLiveData<b> c = new MutableLiveData<>();

    public static class a {

        public String f7903a;

        public String f7904b;
        public String c;
    }

    public static class b {

        public String f7905a;

        public int f7906b;
    }

    public ExchangeViewModel() {
        HandlerThread handlerThread = new HandlerThread("ExchangeViewModel", 10);
        handlerThread.start();
        this.f7899a = new Handler(handlerThread.getLooper());
    }

    public void a(final String str, final Context context) {
        this.f7899a.post(new Runnable() {
            @Override
            public void run() {
                try {
                    GameUtil intance = GameUtil.getIntance();
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("problem_acc", str);
                    jSONObject.put("aid", intance.r(context));
                    jSONObject.put("rid", bx.a().a(context));
                    Log.d("ExchangeViewModel", "run: params::" + jSONObject);
                    String a2 = bd.a("https://api.ourplay.com.cn/api/acc-replace", jSONObject.toString());
                    if (TextUtils.isEmpty(a2)) {
                        ExchangeViewModel.this.f7900b.postValue(null);
                        return;
                    }
                    String b2 = c.b(a2);
                    Log.d("ExchangeViewModel", "run: " + b2);
                    if (TextUtils.isEmpty(b2)) {
                        ExchangeViewModel.this.f7900b.postValue(null);
                        return;
                    }
                    JSONObject jSONObject2 = new JSONObject(b2);
                    if (jSONObject2.optInt("code") == 0) {
                        JSONObject optJSONObject = jSONObject2.optJSONObject("data");
                        if (optJSONObject != null) {
                            a aVar = new a();
                            aVar.f7903a = optJSONObject.optString("acc");
                            aVar.f7904b = optJSONObject.optString("pwd");
                            aVar.c = optJSONObject.optString("email");
                            ExchangeViewModel.this.f7900b.postValue(aVar);
                            as.h(context);
                        }
                    } else {
                        b bVar = new b();
                        bVar.f7905a = jSONObject2.optString("msg");
                        bVar.f7906b = jSONObject2.optInt("code");
                        ExchangeViewModel.this.c.postValue(bVar);
                    }
                    by.a(context, "sp_config").a("sp_key_is_apply_for_account_change", true);
                } catch (Exception e) {
                    e.printStackTrace();
                    ExchangeViewModel.this.f7900b.postValue(null);
                }
            }
        });
    }

    public MutableLiveData<a> a() {
        return this.f7900b;
    }

    public MutableLiveData<b> b() {
        return this.c;
    }
}