package com.ss.android.ugc.effectmanager.knadapt;

import X.M12;
import X.Q60;
import X.Q6i;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.effectmanager.effect.listener.IEffectDownloadProgressListener;
import com.ss.android.ugc.effectmanager.effect.listener.IFetchEffectListener;
import com.ss.android.ugc.effectmanager.effect.model.Effect;

public final class ListenerAdaptExtKt$toKNListener$1 implements Q6i {
    public final /* synthetic */ IFetchEffectListener $oldListener;
    public Effect oldEffect;

    static {
        Covode.recordClassIndex(125546);
    }

    public ListenerAdaptExtKt$toKNListener$1(IFetchEffectListener iFetchEffectListener) {
        this.$oldListener = iFetchEffectListener;
    }

    public final void onStart(com.ss.ugc.effectplatform.model.Effect effect) {
        if (this.oldEffect == null) {
            this.oldEffect = new Effect(effect);
        }
        this.$oldListener.onStart(this.oldEffect);
    }

    public final void onSuccess(com.ss.ugc.effectplatform.model.Effect effect) {
        if (this.oldEffect == null) {
            this.oldEffect = new Effect(effect);
        }
        this.$oldListener.onSuccess(this.oldEffect);
    }

    public final void onFail(com.ss.ugc.effectplatform.model.Effect effect, Q60 q60) {
        M12.LIZ(q60);
        if (this.oldEffect == null) {
            this.oldEffect = new Effect(effect);
        }
        this.$oldListener.onFail(this.oldEffect, ListenerAdaptExtKt.toOldExceptionResult(q60));
    }

    public final void onProgress(com.ss.ugc.effectplatform.model.Effect effect, int i, long j) {
        if (this.oldEffect == null) {
            this.oldEffect = new Effect(effect);
        }
        IFetchEffectListener iFetchEffectListener = this.$oldListener;
        if (iFetchEffectListener instanceof IEffectDownloadProgressListener) {
            ((IEffectDownloadProgressListener) iFetchEffectListener).onProgress(this.oldEffect, i, j);
        }
    }
}
