导航菜单

页面标题

页面副标题

自健身 v3.3.4 - a.java 源代码

正在查看: 自健身 v3.3.4 应用的 a.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.pgyersdk.update;

import android.os.AsyncTask;
import com.pgyersdk.f.m;
import com.pgyersdk.update.javabean.AppBean;
import java.util.HashMap;
import org.json.JSONException;
import org.json.JSONObject;

public class a extends AsyncTask<Void, String, HashMap<String, String>> {
    protected UpdateManagerListener a;
    private boolean b;

    a(UpdateManagerListener updateManagerListener) {
        this.a = updateManagerListener;
    }

    @Override
    public HashMap<String, String> doInBackground(Void... voidArr) {
        if (!m.b()) {
            this.a.checkUpdateFailed(new Exception(com.pgyersdk.c.b.a(518)));
            com.pgyersdk.f.f.a("PgyerSDK", "Check update failed");
        }
        return a();
    }

    private java.util.HashMap<java.lang.String, java.lang.String> a() {
        throw new UnsupportedOperationException("Method not decompiled: com.pgyersdk.update.a.a():java.util.HashMap");
    }

    @Override
    public void onPostExecute(HashMap<String, String> hashMap) {
        if (!this.b) {
            UpdateManagerListener updateManagerListener = this.a;
            if (updateManagerListener != null) {
                updateManagerListener.checkUpdateFailed(new RuntimeException(com.pgyersdk.c.b.a(517)));
                com.pgyersdk.f.f.a("PgyerSDK", "Check update failed");
                return;
            }
            return;
        }
        try {
            JSONObject jSONObject = new JSONObject(hashMap.get("response")).getJSONObject("data");
            if (jSONObject.getBoolean("updateDeny")) {
                this.a.checkUpdateFailed(new RuntimeException(com.pgyersdk.c.b.a(517)));
                com.pgyersdk.f.f.a("PgyerSDK", "Check update failed. Please go to wwww.pgyer.com to get more detail");
                return;
            }
            if (jSONObject.getBoolean("haveNewVersion")) {
                AppBean a = a(jSONObject);
                UpdateManagerListener updateManagerListener2 = this.a;
                if (updateManagerListener2 != null) {
                    updateManagerListener2.onUpdateAvailable(a);
                }
                com.pgyersdk.f.f.a("PgyerSDK", "There is a new version");
                return;
            }
            UpdateManagerListener updateManagerListener3 = this.a;
            if (updateManagerListener3 != null) {
                updateManagerListener3.onNoUpdateAvailable();
            }
            com.pgyersdk.f.f.a("PgyerSDK", "It's the latest version");
        } catch (JSONException e) {
            e.printStackTrace();
            UpdateManagerListener updateManagerListener4 = this.a;
            if (updateManagerListener4 != null) {
                updateManagerListener4.checkUpdateFailed(e);
            }
            com.pgyersdk.f.f.a("PgyerSDK", "JSONException", e);
        } catch (Exception e2) {
            UpdateManagerListener updateManagerListener5 = this.a;
            if (updateManagerListener5 != null) {
                updateManagerListener5.checkUpdateFailed(e2);
            }
            com.pgyersdk.f.f.a("PgyerSDK", "Please check you config of PGY SDK. ", e2);
        }
    }

    private AppBean a(JSONObject jSONObject) throws JSONException {
        AppBean appBean = new AppBean();
        appBean.setDownloadURL(jSONObject.getString("downloadURL"));
        appBean.setVersionName(jSONObject.getString("version"));
        appBean.setReleaseNote(jSONObject.getString("releaseNote"));
        appBean.setVersionCode(jSONObject.getString("build"));
        appBean.setShouldForceToUpdate(Boolean.parseBoolean(jSONObject.getString("needForceUpdate")));
        return appBean;
    }
}