package com.ss.android.ugc.aweme.sticker.presenter.handler;

import X.0CB;
import X.0CH;
import X.1oX;
import X.5fX;
import X.6Is;
import X.C2464NFb;
import X.C2594NKb;
import X.C2595NKc;
import X.C2596NKd;
import X.IFh;
import X.M12;
import X.NBS;
import X.NFG;
import X.NFV;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.shortvideo.SafeHandler;
import com.ss.android.ugc.effectmanager.effect.model.Effect;
import org.json.JSONObject;

public final class SavePhotoStickerHandler extends NFV implements 6Is, C2464NFb {
    public static final C2596NKd LIZLLL = new C2596NKd((byte) 0);
    public Effect LIZ;
    public final C2595NKc LIZIZ;
    public final 5fX LIZJ;
    public SafeHandler LJ;
    public final 1oX LJFF;

    static {
        Covode.recordClassIndex(116124);
    }

    public final void LIZ() {
        this.LIZ = null;
    }

    public final void onStateChanged(0CH r1, 0CB r2) {
    }

    public final boolean LIZ(NBS nbs) {
        M12.LIZ(nbs);
        return NFG.LJJIIJZLJL(nbs.LIZ);
    }

    public final void LIZ(IFh iFh, NBS nbs) {
        String extra;
        M12.LIZ(iFh, nbs);
        Effect effect = nbs.LIZ;
        this.LIZ = effect;
        if (effect != null && (extra = effect.getExtra()) != null) {
            try {
                if (!TextUtils.isEmpty(new JSONObject(extra).optString("hint_for_saving_captured_image"))) {
                    this.LIZIZ.LIZ(this.LIZ, this.LJFF);
                }
            } catch (Exception e) {
                this.LIZJ.LIZ(e);
            }
        }
    }

    public SavePhotoStickerHandler(1oX r2, C2595NKc nKc, 5fX r4) {
        M12.LIZ(r2, nKc, r4);
        this.LJFF = r2;
        this.LIZIZ = nKc;
        this.LIZJ = r4;
        this.LJ = new SafeHandler(r2);
    }

    public final void LIZ(int i, int i2, int i3, String str) {
        if (NFG.LJJIIJZLJL(this.LIZ)) {
            this.LJ.post(new C2594NKb(this, i, str));
        }
    }
}
