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

import X.3i8;
import X.9EH;
import X.FL0;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import com.bytedance.covode.number.Covode;
import com.bytedance.router.RouteIntent;
import com.bytedance.router.interceptor.IInterceptor;
import com.ss.android.ugc.aweme.out.AVExternalServiceImpl;
import kotlin.h.b.n;

public final class DraftRouterInterceptor implements IInterceptor {
    public static final FL0 LIZ = new FL0((byte) 0);

    static {
        Covode.recordClassIndex(103817);
    }

    public final boolean matchInterceptRules(RouteIntent routeIntent) {
        String str;
        Uri uri;
        if (routeIntent == null || (uri = routeIntent.getUri()) == null) {
            str = null;
        } else {
            str = uri.getHost();
        }
        return n.LIZ(str, "draft_box");
    }

    public static void LIZ(Context context, Intent intent) {
        3i8.LIZ(intent, context);
        context.startActivity(intent);
    }

    public final boolean onInterceptRoute(Context context, RouteIntent routeIntent) {
        Context context2;
        Class<? extends Activity> draftBoxActivity = AVExternalServiceImpl.LIZ().classnameService().getDraftBoxActivity();
        if (context instanceof Activity) {
            LIZ(context, new Intent(context, draftBoxActivity));
            return true;
        }
        if (context == null) {
            context2 = 9EH.LJJIFFI.LIZ();
        } else {
            context2 = context;
        }
        Intent intent = new Intent(context, draftBoxActivity);
        intent.addFlags(268435456);
        LIZ(context2, intent);
        return true;
    }
}
