package com.ss.android.ugc.aweme.story.base.distribution.dispatcher;

import X.0CB;
import X.0CH;
import X.0CN;
import X.2cN;
import X.6Is;
import X.C0114Ckk;
import X.Cm6;
import X.Cm8;
import X.Leb;
import X.M12;
import com.bytedance.covode.number.Covode;
import java.util.Set;

public final class StoryReceiver implements 6Is {
    public 2cN LIZ;
    public final Object LIZIZ;
    public final C0114Ckk LIZJ;
    public final Cm6<?, ?> LIZLLL;

    static {
        Covode.recordClassIndex(117022);
    }

    public final void onStateChanged(0CH r2, 0CB r3) {
        if (r3 == 0CB.ON_DESTROY) {
            onDestroy();
        }
    }

    @0CN(LIZ = 0CB.ON_DESTROY)
    public final void onDestroy() {
        Cm6<?, ?> cm6 = this.LIZLLL;
        C0114Ckk ckk = this.LIZJ;
        M12.LIZ(ckk, this);
        Set set = cm6.LIZ.get(ckk);
        if (set != null) {
            Leb.LIZ(set, new Cm8(this));
        }
        cm6.LIZ.remove(ckk);
        2cN r0 = this.LIZ;
        if (r0 != null) {
            r0.dispose();
        }
    }

    public StoryReceiver(Object obj, C0114Ckk ckk, Cm6<?, ?> cm6) {
        M12.LIZ(obj, ckk, cm6);
        this.LIZIZ = obj;
        this.LIZJ = ckk;
        this.LIZLLL = cm6;
        ckk.getLifecycle().LIZ(this);
    }
}
