package com.ss.android.ugc.aweme.fe.method;

import X.0CB;
import X.0CH;
import X.2O8;
import X.2nK;
import X.2sG;
import X.4FQ;
import X.4aM;
import X.4vl;
import X.6Is;
import X.C6097FIn;
import X.C6098FIo;
import X.C6099FIp;
import X.C6104FIu;
import X.KKi;
import X.M12;
import android.app.Activity;
import android.content.Context;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.fe.base.BaseCommonJavaMethod;
import java.util.HashMap;
import kotlin.h.b.n;
import org.json.JSONObject;

public final class PushOperationMethod extends BaseCommonJavaMethod implements 6Is {
    public static final C6099FIp LIZIZ = new C6099FIp((byte) 0);
    public String LIZ = "";

    static {
        Covode.recordClassIndex(76141);
    }

    public final void onStateChanged(0CH r1, 0CB r2) {
        PushOperationMethod.super.onStateChanged(r1, r2);
    }

    public PushOperationMethod(KKi kKi) {
        super(kKi);
    }

    public final void handle(JSONObject jSONObject, C6104FIu fIu) {
        Context context;
        Activity activity;
        M12.LIZ(jSONObject, fIu);
        if (this.mContextRef != null) {
            context = (Context) this.mContextRef.get();
        } else {
            context = null;
        }
        String optString = jSONObject.optString("track_info", "");
        n.LIZIZ(optString, "");
        this.LIZ = optString;
        if (!(context instanceof Activity) || (activity = (Activity) context) == null || activity.isFinishing()) {
            fIu.LIZ(0, (String) null);
        } else if (!4aM.LIZ(activity)) {
            4vl r3 = new 4vl(activity);
            2sG r2 = new 2sG();
            r2.element = new JSONObject();
            ((JSONObject) r2.element).put("code", 1);
            r3.LIZJ(2131832357);
            r3.LIZLLL(2131832360);
            r3.LIZIZ(2131832359, new C6097FIn(this, r2, fIu, activity));
            r3.LIZJ(2131832358, new C6098FIo(this, r2, fIu));
            4FQ.LIZ(r3.LIZ().LIZJ());
            String str = this.LIZ;
            HashMap hashMap = new HashMap();
            2O8.LIZ.LIZ(str, hashMap);
            2nK.LIZ("push_pre_permission_show", hashMap);
        } else {
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("code", 1);
            jSONObject2.put("auth_result", 1);
            fIu.LIZ(jSONObject2);
        }
    }
}
