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

import X.4Fe;
import X.C4363BiJ;
import X.LsD;
import android.content.Context;
import android.net.Uri;
import com.byted.mgl.exp.h5game.service.platform.IMglPlatformService;
import com.bytedance.covode.number.Covode;
import com.bytedance.router.RouteIntent;
import com.bytedance.router.interceptor.IInterceptor;
import kotlin.h.b.n;

public final class MiniGameAnchorTask implements IInterceptor {
    static {
        Covode.recordClassIndex(92240);
    }

    public final boolean matchInterceptRules(RouteIntent routeIntent) {
        Uri uri;
        String queryParameter;
        if (!(routeIntent == null || (uri = routeIntent.getUri()) == null || (!n.LIZ("microgame", uri.getHost())) || (queryParameter = uri.getQueryParameter("app_id")) == null || queryParameter.length() != 20)) {
            String substring = queryParameter.substring(18);
            n.LIZIZ(substring, "");
            4Fe.LIZ(16);
            if (Integer.parseInt(substring, 16) == 4) {
                return true;
            }
        }
        return false;
    }

    public final boolean onInterceptRoute(Context context, RouteIntent routeIntent) {
        Uri uri;
        String uri2;
        if (routeIntent == null || (uri = routeIntent.getUri()) == null || (uri2 = uri.toString()) == null) {
            return false;
        }
        n.LIZIZ(uri2, "");
        if (!C4363BiJ.LIZ.LIZIZ()) {
            return false;
        }
        IMglPlatformService.DefaultImpls.open$default(C4363BiJ.LIZ, uri2, (LsD) null, 2, (Object) null);
        return true;
    }
}
