package com.tencent.mm.plugin.appbrand.jsapi;

import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ai.b;
import com.tencent.mm.ai.b.a;
import com.tencent.mm.ai.m;
import com.tencent.mm.ai.w;
import com.tencent.mm.model.cb;
import com.tencent.mm.plugin.appbrand.ipc.MainProcessTask;
import com.tencent.mm.protocal.protobuf.cli;
import com.tencent.mm.protocal.protobuf.clj;
import com.tencent.mm.sdk.platformtools.ab;

class JsApiUploadWeRunData$UploadMiniAppStepTask extends MainProcessTask {
    public static final Creator<JsApiUploadWeRunData$UploadMiniAppStepTask> CREATOR = new 2();
    private String appId;
    private boolean cwB;
    private int hwi;
    private m hwz;
    private c hxS;
    private int hzv;
    private boolean hzw;

    static /* synthetic */ boolean a(JsApiUploadWeRunData$UploadMiniAppStepTask jsApiUploadWeRunData$UploadMiniAppStepTask) {
        AppMethodBeat.i(130629);
        boolean aCb = jsApiUploadWeRunData$UploadMiniAppStepTask.aCb();
        AppMethodBeat.o(130629);
        return aCb;
    }

    public JsApiUploadWeRunData$UploadMiniAppStepTask(m mVar, c cVar, int i, int i2, boolean z) {
        AppMethodBeat.i(130623);
        ab.d("MicroMsg.JsApiUploadWeRunData", "UploadMiniAppStepTask");
        this.hwz = mVar;
        this.hxS = cVar;
        this.hwi = i;
        this.hzv = i2;
        this.hzw = z;
        this.appId = cVar.getAppId();
        AppMethodBeat.o(130623);
    }

    public JsApiUploadWeRunData$UploadMiniAppStepTask(Parcel parcel) {
        AppMethodBeat.i(130624);
        g(parcel);
        AppMethodBeat.o(130624);
    }

    public final void asP() {
        AppMethodBeat.i(130625);
        long aaD = cb.aaD();
        ab.d("MicroMsg.JsApiUploadWeRunData", "UploadMiniAppStepTask currentTime %d", new Object[]{Long.valueOf(aaD / 1000)});
        if (aaD == 0) {
            aaD = System.currentTimeMillis();
        }
        a aVar = new a();
        cli cli = new cli();
        aVar.fsJ = cli;
        aVar.fsK = new clj();
        aVar.uri = "/cgi-bin/mmoc-bin/hardware/uploadminiappstep";
        aVar.fsI = 1949;
        aVar.fsL = 0;
        aVar.fsM = 0;
        cli.fKh = this.appId;
        cli.jCs = this.hzv;
        cli.xiZ = this.hzw;
        cli.nbj = (int) (aaD / 1000);
        w.a(aVar.acD(), new w.a() {
            public final int a(int i, int i2, String str, b bVar, m mVar) {
                AppMethodBeat.i(130621);
                if (mVar.getType() != 1949) {
                    AppMethodBeat.o(130621);
                } else {
                    if (i == 0 && i2 == 0) {
                        JsApiUploadWeRunData$UploadMiniAppStepTask.this.cwB = true;
                        ab.d("MicroMsg.JsApiUploadWeRunData", "UploadMiniAppStepTask ok.");
                    } else {
                        JsApiUploadWeRunData$UploadMiniAppStepTask.this.cwB = false;
                        ab.i("MicroMsg.JsApiUploadWeRunData", "UploadMiniAppStepTask fail: errType %d,errCode %d,errMsg %s", new Object[]{Integer.valueOf(i), Integer.valueOf(i2), str});
                    }
                    JsApiUploadWeRunData$UploadMiniAppStepTask.a(JsApiUploadWeRunData$UploadMiniAppStepTask.this);
                    AppMethodBeat.o(130621);
                }
                return 0;
            }
        }, true);
        AppMethodBeat.o(130625);
    }

    public final void asQ() {
        AppMethodBeat.i(130626);
        if (this.cwB) {
            this.hxS.M(this.hwi, this.hwz.j("ok", null));
        } else {
            this.hxS.M(this.hwi, this.hwz.j("fail", null));
        }
        aBW();
        AppMethodBeat.o(130626);
    }

    public final void g(Parcel parcel) {
        boolean z;
        boolean z2 = true;
        AppMethodBeat.i(130627);
        this.hzv = parcel.readInt();
        if (parcel.readByte() != (byte) 0) {
            z = true;
        } else {
            z = false;
        }
        this.hzw = z;
        if (parcel.readByte() == (byte) 0) {
            z2 = false;
        }
        this.cwB = z2;
        this.appId = parcel.readString();
        AppMethodBeat.o(130627);
    }

    public void writeToParcel(Parcel parcel, int i) {
        byte b;
        byte b2 = (byte) 1;
        AppMethodBeat.i(130628);
        parcel.writeInt(this.hzv);
        if (this.hzw) {
            b = (byte) 1;
        } else {
            b = (byte) 0;
        }
        parcel.writeByte(b);
        if (!this.cwB) {
            b2 = (byte) 0;
        }
        parcel.writeByte(b2);
        parcel.writeString(this.appId);
        AppMethodBeat.o(130628);
    }

    static {
        AppMethodBeat.i(130630);
        AppMethodBeat.o(130630);
    }
}
