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

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


package com.excelliance.kxqp.gs.ui.account;

import android.accounts.Account;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import com.android.spush.PushItem;
import com.android.spush.SPushDBHelper;
import com.excean.bytedancebi.manager.BiManager;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.PlatSdk;
import com.excelliance.kxqp.bitmap.bean.RankingItem;
import com.excelliance.kxqp.gs.bean.ProxyConfigHelper;
import com.excelliance.kxqp.gs.bean.ShareGameBean;
import com.excelliance.kxqp.gs.main.MainActivity;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.ui.account.b;
import com.excelliance.kxqp.gs.ui.share.core.config.SocializeMedia;
import com.excelliance.kxqp.gs.ui.share.core.helper.ShareHelper;
import com.excelliance.kxqp.gs.util.Upl;
import com.excelliance.kxqp.gs.util.as;
import com.excelliance.kxqp.gs.util.aw;
import com.excelliance.kxqp.gs.util.ay;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.bd;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.gs.util.cd;
import com.excelliance.kxqp.gs.util.cn;
import com.excelliance.kxqp.gs.util.g;
import com.excelliance.kxqp.gs.util.h;
import com.excelliance.kxqp.gs.util.s;
import com.excelliance.kxqp.gs.util.w;
import io.reactivex.annotations.SchedulerSupport;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;

public class a implements b.a, ShareHelper.Callback {

    private b.InterfaceC0339b f8481a;

    private Context f8482b;
    private Context c;
    private ShareHelper d;
    private Handler e;

    @Override
    public void onDismiss(SocializeMedia socializeMedia) {
    }

    @Override
    public void onShareStart(SocializeMedia socializeMedia) {
    }

    public a(b.InterfaceC0339b interfaceC0339b, Context context) {
        this.f8481a = interfaceC0339b;
        this.c = context.getApplicationContext();
        this.f8482b = context;
        HandlerThread handlerThread = new HandlerThread("AccountPresenter", 10);
        handlerThread.start();
        this.e = new Handler(handlerThread.getLooper());
    }

    @Override
    public void initData() {
        a();
        if (com.excelliance.kxqp.gs.util.b.ap(this.f8482b)) {
            d();
        }
        tp.f(new Runnable() {
            @Override
            public void run() {
                final List<PushItem> queryNotDeletedItems = SPushDBHelper.getInstance(a.this.f8482b).queryNotDeletedItems();
                tp.i(new Runnable() {
                    @Override
                    public void run() {
                        if (queryNotDeletedItems != null) {
                            int i = 0;
                            for (int i2 = 0; i2 < queryNotDeletedItems.size(); i2++) {
                                if (((PushItem) queryNotDeletedItems.get(i2)).read == 0) {
                                    i++;
                                }
                            }
                            if (a.this.f8481a != null) {
                                a.this.f8481a.a(i > 0);
                            }
                        }
                    }
                });
            }
        });
    }

    public void a() {
        Log.d("Account", " init accounts");
        tp.d(new Runnable() {
            @Override
            public void run() {
                if (!GameUtil.b()) {
                    PlatSdk.getInstance().initVM((Application) a.this.f8482b.getApplicationContext());
                }
                if (GameUtil.b()) {
                    a.this.e();
                }
            }
        });
    }

    public List<c> e() {
        final List<c> f = as.f();
        as.e(this.f8482b, s.a(f) ? 0 : f.size());
        as.b(this.f8482b, f);
        com.excelliance.kxqp.gs.g.c.a().a(BiManager.IS_LOGIN_GOOGLE_ACCOUNT, f.size() > 0);
        tp.i(new Runnable() {
            @Override
            public void run() {
                if (a.this.f8481a != null) {
                    a.this.f8481a.a(f);
                }
            }
        });
        return f;
    }

    public void a(final int i, final String str, final String str2) {
        tp.d(new Runnable() {
            @Override
            public void run() {
                if (a.this.f8482b == null) {
                    return;
                }
                aw.a(a.this.f8482b, i, str, str2, "AccountPresenter", new aw.a() {
                    @Override
                    public void a(Intent intent) {
                        com.excelliance.kxqp.gs.g.c.a().a((String) null, (String) null, (String) null, "调用登录google帐号api", (String) null);
                        if (a.this.f8482b instanceof AccountSettingsActivity) {
                            ((AccountSettingsActivity) a.this.f8482b).startActivityForResult(intent, 1);
                        } else if (a.this.f8482b instanceof MainActivity) {
                            ((AccountFragment) a.this.f8481a).startActivityForResult(intent, 1);
                        }
                    }
                });
            }
        });
    }

    public void a(int i, Account account, String str) {
        com.excelliance.kxqp.wr.a.a().a(i, account, str);
        as.Y(this.f8482b);
        List<c> e = e();
        int size = e.size();
        Log.d("AccountPresenter", "removeAccount size: " + size);
        if (size == 0) {
            a(SchedulerSupport.NONE);
            return;
        }
        boolean z = false;
        for (int i2 = 0; i2 < size; i2++) {
            if (TextUtils.equals(e.get(i2).f8498a, str)) {
                z = true;
            }
        }
        if (z) {
            a();
        } else {
            a(e.get(0).f8498a);
        }
    }

    public void a(final String str) {
        tp.d(new Runnable() {
            @Override
            public void run() {
                int i;
                if (!GameUtil.b()) {
                    PlatSdk.getInstance().initVM((Application) a.this.f8482b.getApplicationContext());
                }
                if (!GameUtil.b() || a.this.c == null) {
                    return;
                }
                String h = as.h();
                if (TextUtils.isEmpty(str) || !TextUtils.equals(str, h)) {
                    az.d("AccountPresenter", "switchConfig----config: " + str + "----currentConfig: " + h);
                    as.a(a.this.c, 0, str);
                    String n = as.n(a.this.c, str);
                    az.d("AccountPresenter", "run: currentCityRegin : " + n);
                    if (by.a(a.this.c, "sp_total_info").b("sp_disconnectioin", false).booleanValue()) {
                        i = 1;
                    } else {
                        com.excelliance.kxqp.gs.g.c.a().b(a.this.c, "是");
                        i = ProxyConfigHelper.switchProxy(a.this.c, n, true);
                    }
                    if (i == 1) {
                        as.a(a.this.c, as.m(a.this.c, n));
                        Intent intent = new Intent();
                        intent.putExtra("state", i);
                        intent.setAction(a.this.c.getPackageName() + "regresh.current.connect.area");
                        a.this.c.sendBroadcast(intent);
                    }
                    as.j();
                    if (a.this.f8481a != null) {
                        a.this.f8481a.d();
                    }
                }
            }
        });
    }

    @Override
    public void b() {
        this.f8482b = null;
        this.f8481a = null;
        this.e.getLooper().quit();
    }

    @Override
    public void a(SocializeMedia socializeMedia, ShareGameBean shareGameBean) {
        this.d = ShareHelper.instance((Activity) this.f8482b);
        this.d.setCallBack(this);
        this.d.shareTo(socializeMedia, shareGameBean);
    }

    @Override
    public boolean b(String str) {
        return as.i(this.f8482b, str);
    }

    @Override
    public void a(final String str, final Context context, final SocializeMedia socializeMedia) {
        this.e.post(new Runnable() {
            @Override
            public void run() {
                ShareGameBean shareGameBean;
                String a2 = as.a(str, context);
                if (TextUtils.isEmpty(a2)) {
                    shareGameBean = null;
                } else {
                    shareGameBean = ay.e(a2);
                    if (shareGameBean != null && !shareGameBean.beanIsNull()) {
                        by.a(context, "sp_share_info").a(str, true);
                    }
                }
                a.this.f8481a.a(shareGameBean, socializeMedia);
            }
        });
    }

    @Override
    public void c() {
        this.e.post(new Runnable() {
            @Override
            public void run() {
                HttpURLConnection httpURLConnection;
                Upl a2;
                String i = g.a(a.this.f8482b).i();
                ?? r3 = " ----- path: " + i;
                az.i("AccountPresenter", r3);
                try {
                    try {
                        httpURLConnection = (HttpURLConnection) new URL(i).openConnection();
                        try {
                            httpURLConnection.setConnectTimeout(5000);
                            httpURLConnection.setReadTimeout(5000);
                            httpURLConnection.setRequestMethod("GET");
                            httpURLConnection.connect();
                            a2 = h.a().a(httpURLConnection.getInputStream());
                        } catch (Exception e) {
                            e = e;
                            e.printStackTrace();
                            ((AccountFragment) a.this.f8481a).a((Bundle) null);
                            if (httpURLConnection == null) {
                                return;
                            }
                            httpURLConnection.disconnect();
                        }
                    } catch (Throwable th) {
                        th = th;
                        if (r3 != 0) {
                            r3.disconnect();
                        }
                        throw th;
                    }
                } catch (Exception e2) {
                    e = e2;
                    httpURLConnection = null;
                } catch (Throwable th2) {
                    th = th2;
                    r3 = 0;
                    if (r3 != 0) {
                    }
                    throw th;
                }
                if (a2 == null) {
                    if (httpURLConnection != null) {
                        httpURLConnection.disconnect();
                        return;
                    }
                    return;
                }
                String vc = a2.getVc();
                String url = a2.getUrl();
                String vn = a2.getVn();
                String md5 = a2.getMd5();
                by.a(a.this.f8482b, "download_sp").a("MD5", md5);
                Bundle bundle = new Bundle();
                bundle.putString("serverVersionCode", vc);
                bundle.putString("apkUrl", url);
                bundle.putString("verName", vn);
                String size = a2.getSize();
                az.i("AccountPresenter", " -----vc:" + vc + "-----apkUrl:" + url + "-----verName:" + vn + "-----md5:" + md5);
                if (size != null && size.length() > 0) {
                    try {
                        bundle.putFloat(RankingItem.KEY_SIZE, Integer.parseInt(size));
                    } catch (Exception e3) {
                        e3.printStackTrace();
                    }
                }
                by.a(a.this.f8482b, "download_sp").a("mVerName", vn);
                by.a(a.this.f8482b, "download_sp").a("mVerCose", vc);
                by.a(a.this.f8482b, "sp_new_version_info_assistant").a("has_saved_before", true).a(a2.getVn(), a2.getVc(), url, a2.getShowDialog(), bundle.getString("content"), a2.getSize(), a2.getType(), md5, false);
                ((AccountFragment) a.this.f8481a).a(bundle);
                if (httpURLConnection == null) {
                    return;
                }
                httpURLConnection.disconnect();
            }
        });
    }

    @Override
    public void onShareComplete(SocializeMedia socializeMedia, int i, Bundle bundle) {
        if (i == 200) {
            Toast.makeText(this.f8482b, w.e(this.f8482b, "share_sdk_share_success"), 0).show();
        } else if (i == 202) {
            Toast.makeText(this.f8482b, w.e(this.f8482b, "share_sdk_share_failed"), 0).show();
        }
    }

    public void d() {
        this.e.post(new Runnable() {
            @Override
            public void run() {
                JSONObject i = cn.i(a.this.f8482b);
                az.d("AccountPresenter", "getOffAndOn requestParams:" + i);
                az.d("AccountPresenter", "getOffAndOn encrypt requestParams:" + cn.b(i.toString()));
                String a2 = bd.a("http://api.ourplay.com.cn/user/sign-module", i.toString());
                az.d("AccountPresenter", "getOffAndOn encrypt response:" + a2);
                String a3 = cn.a(a2);
                az.d("AccountPresenter", "getOffAndOn response :" + a3);
                if (cd.a(a3)) {
                    return;
                }
                try {
                    if (new JSONObject(a3).optInt("code") != 0) {
                        if (a.this.f8481a != null) {
                            by.a(a.this.c, "sp_five_day_sign_info").a("sp_key_five_day_sign_switch", false);
                            ((AccountFragment) a.this.f8481a).b(false);
                        }
                    } else if (a.this.f8481a != null) {
                        by.a(a.this.c, "sp_five_day_sign_info").a("sp_pre_account_config", true);
                        ((AccountFragment) a.this.f8481a).b(true);
                    }
                } catch (JSONException e) {
                    az.d("AccountPresenter", "getOffAndOn json Fail");
                    e.printStackTrace();
                }
            }
        });
    }
}