package com.ss.android.ugc.aweme.scheduler;

import X.06Q;
import X.AnonymousClass5E9;
import X.AnonymousClass7CJ;
import X.AnonymousClass7CO;
import X.AnonymousClass7EI;
import X.FUR;
import X.M12;
import X.Oie;
import X.Sy7;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.services.external.IGetPublishDraftCallback;
import kotlin.h.b.n;

public final class PublishBroadcastReceiver extends BroadcastReceiver {
    public static boolean LIZ;
    public static final AnonymousClass7EI LIZIZ = new AnonymousClass7EI((byte) 0);

    static {
        Covode.recordClassIndex(103903);
    }

    public static String LIZ(Intent intent, String str) {
        try {
            return intent.getStringExtra(str);
        } catch (Exception unused) {
            return null;
        }
    }

    public final void onReceive(Context context, Intent intent) {
        M12.LIZ(context, intent);
        if (n.LIZ(LIZ(intent, "DEBUG_MSG"), "MSG_SUCCESS")) {
            Oie.LJI.LJFF("PublishBroadcastReceiver onReceive success");
            LIZ = true;
            return;
        }
        String LIZ2 = LIZ(intent, "creation_id");
        if (!FUR.LIZ()) {
            PublishService.LIZIZ.LIZ();
        } else if (LIZ2 != null) {
            Sy7 sy7 = PublishService.LIZIZ;
            M12.LIZ(LIZ2);
            sy7.LIZ("clear");
            Context LIZ3 = AnonymousClass5E9.LIZ.LIZ();
            sy7.LIZ(LIZ3);
            06Q.LIZ(LIZ3).LIZ((String) null, LIZ2.hashCode());
        }
        Oie.LJI.LJFF("PublishBroadcastReceiver onReceive intentCreationId:".concat(String.valueOf(LIZ2)));
        if (FUR.LIZ() || !Oie.LIZIZ()) {
            AnonymousClass7CJ.LIZ.LIZ((IGetPublishDraftCallback) new AnonymousClass7CO(LIZ2, context));
        } else {
            Oie.LJ("PublishBroadcastReceiver start publish when publishing");
        }
    }
}
