导航菜单

页面标题

页面副标题

Baubap v3.9.7 - UriAction.java 源代码

正在查看: Baubap v3.9.7 应用的 UriAction.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.braze.ui.actions;

import android.annotation.SuppressLint;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.activity.p;
import com.braze.BrazeInternal;
import com.braze.Constants;
import com.braze.IBrazeDeeplinkHandler;
import com.braze.configuration.BrazeConfigurationProvider;
import com.braze.enums.Channel;
import com.braze.support.BrazeFileUtils;
import com.braze.support.BrazeLogger;
import com.braze.ui.BrazeDeeplinkHandler;
import com.braze.ui.BrazeWebViewActivity;
import com.braze.ui.actions.brazeactions.BrazeActionParser;
import com.braze.ui.support.UriUtils;
import h40.q;
import java.util.Iterator;
import java.util.List;
import n30.s;
import xu.b;

public class UriAction implements IAction {
    private final Channel channel;
    private final Bundle extras;
    private Uri uri;
    private boolean useWebView;

    public UriAction(Uri uri, Bundle bundle, boolean z, Channel channel) {
        b.y(uri, "uri");
        b.y(channel, "channel");
        this.uri = uri;
        this.extras = bundle;
        this.useWebView = z;
        this.channel = channel;
    }

    @Override
    public void execute(Context context) {
        b.y(context, "context");
        if (BrazeFileUtils.isLocalUri(this.uri)) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, (BrazeLogger.Priority) null, (Throwable) null, new UriAction$execute$1(this), 3, (Object) null);
            return;
        }
        BrazeActionParser brazeActionParser = BrazeActionParser.INSTANCE;
        if (brazeActionParser.isBrazeActionUri(this.uri)) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.V, (Throwable) null, new UriAction$execute$2(this), 2, (Object) null);
            brazeActionParser.execute(context, this.uri, getChannel());
            return;
        }
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, (BrazeLogger.Priority) null, (Throwable) null, new UriAction$execute$3(this), 3, (Object) null);
        if (this.useWebView && s.T0(BrazeFileUtils.REMOTE_SCHEMES, this.uri.getScheme())) {
            if (getChannel() == Channel.PUSH) {
                openUriWithWebViewActivityFromPush(context, this.uri, this.extras);
                return;
            } else {
                openUriWithWebViewActivity(context, this.uri, this.extras);
                return;
            }
        }
        if (getChannel() == Channel.PUSH) {
            openUriWithActionViewFromPush(context, this.uri, this.extras);
        } else {
            openUriWithActionView(context, this.uri, this.extras);
        }
    }

    @SuppressLint({"QueryPermissionsNeeded"})
    public final Intent getActionViewIntent(Context context, Uri uri, Bundle bundle) {
        b.y(context, "context");
        b.y(uri, "uri");
        Intent intent = new Intent("android.intent.action.VIEW");
        intent.setData(uri);
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        List<ResolveInfo> y = Build.VERSION.SDK_INT >= 33 ? p.y(context.getPackageManager(), intent, p.f()) : context.getPackageManager().queryIntentActivities(intent, 0);
        b.x(y, "if (Build.VERSION.SDK_IN…ties(intent, 0)\n        }");
        if (y.size() > 1) {
            Iterator<ResolveInfo> it = y.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                ResolveInfo next = it.next();
                if (b.n(next.activityInfo.packageName, context.getPackageName())) {
                    BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, (BrazeLogger.Priority) null, (Throwable) null, new UriAction$getActionViewIntent$1(next), 3, (Object) null);
                    intent.setPackage(next.activityInfo.packageName);
                    break;
                }
            }
        }
        return intent;
    }

    @Override
    public Channel getChannel() {
        return this.channel;
    }

    public final Bundle getExtras() {
        return this.extras;
    }

    public final Intent[] getIntentArrayWithConfiguredBackStack(Context context, Bundle bundle, Intent intent, BrazeConfigurationProvider brazeConfigurationProvider) {
        b.y(context, "context");
        b.y(intent, "targetIntent");
        b.y(brazeConfigurationProvider, "configurationProvider");
        Intent intent2 = null;
        if (brazeConfigurationProvider.isPushDeepLinkBackStackActivityEnabled()) {
            String pushDeepLinkBackStackActivityClassName = brazeConfigurationProvider.getPushDeepLinkBackStackActivityClassName();
            if (pushDeepLinkBackStackActivityClassName == null || q.R(pushDeepLinkBackStackActivityClassName)) {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.I, (Throwable) null, UriAction$getIntentArrayWithConfiguredBackStack$1.INSTANCE, 2, (Object) null);
                intent2 = UriUtils.getMainActivityIntent(context, bundle);
            } else if (UriUtils.isActivityRegisteredInManifest(context, pushDeepLinkBackStackActivityClassName)) {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.I, (Throwable) null, new UriAction$getIntentArrayWithConfiguredBackStack$2(pushDeepLinkBackStackActivityClassName), 2, (Object) null);
                if (bundle != null) {
                    intent2 = new Intent().setClassName(context, pushDeepLinkBackStackActivityClassName).setFlags(BrazeDeeplinkHandler.Companion.getInstance().getIntentFlags(IBrazeDeeplinkHandler.IntentFlagPurpose.URI_ACTION_BACK_STACK_GET_ROOT_INTENT)).putExtras(bundle);
                }
            } else {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.I, (Throwable) null, new UriAction$getIntentArrayWithConfiguredBackStack$4(pushDeepLinkBackStackActivityClassName), 2, (Object) null);
            }
        } else {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.I, (Throwable) null, UriAction$getIntentArrayWithConfiguredBackStack$5.INSTANCE, 2, (Object) null);
        }
        if (intent2 != null) {
            return new Intent[]{intent2, intent};
        }
        intent.setFlags(BrazeDeeplinkHandler.Companion.getInstance().getIntentFlags(IBrazeDeeplinkHandler.IntentFlagPurpose.URI_ACTION_BACK_STACK_ONLY_GET_TARGET_INTENT));
        return new Intent[]{intent};
    }

    public final Uri getUri() {
        return this.uri;
    }

    public final boolean getUseWebView() {
        return this.useWebView;
    }

    public final Intent getWebViewActivityIntent(Context context, Uri uri, Bundle bundle) {
        Intent intent;
        b.y(context, "context");
        b.y(uri, "uri");
        String customHtmlWebViewActivityClassName = BrazeInternal.INSTANCE.getConfigurationProvider(context).getCustomHtmlWebViewActivityClassName();
        if (customHtmlWebViewActivityClassName == null || q.R(customHtmlWebViewActivityClassName) || !UriUtils.isActivityRegisteredInManifest(context, customHtmlWebViewActivityClassName)) {
            intent = new Intent(context, (Class<?>) BrazeWebViewActivity.class);
        } else {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, (BrazeLogger.Priority) null, (Throwable) null, new UriAction$getWebViewActivityIntent$webViewActivityIntent$1(customHtmlWebViewActivityClassName), 3, (Object) null);
            intent = new Intent().setClassName(context, customHtmlWebViewActivityClassName);
            b.x(intent, "customWebViewActivityCla…ivityClassName)\n        }");
        }
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        intent.putExtra(Constants.BRAZE_WEBVIEW_URL_EXTRA, uri.toString());
        return intent;
    }

    public void openUriWithActionView(Context context, Uri uri, Bundle bundle) {
        b.y(context, "context");
        b.y(uri, "uri");
        Intent actionViewIntent = getActionViewIntent(context, uri, bundle);
        actionViewIntent.setFlags(BrazeDeeplinkHandler.Companion.getInstance().getIntentFlags(IBrazeDeeplinkHandler.IntentFlagPurpose.URI_ACTION_OPEN_WITH_ACTION_VIEW));
        try {
            context.startActivity(actionViewIntent);
        } catch (Exception e) {
            BrazeLogger.INSTANCE.brazelog(this, BrazeLogger.Priority.E, e, new UriAction$openUriWithActionView$1(uri, bundle));
        }
    }

    public final void openUriWithActionViewFromPush(Context context, Uri uri, Bundle bundle) {
        b.y(context, "context");
        b.y(uri, "uri");
        try {
            context.startActivities(getIntentArrayWithConfiguredBackStack(context, bundle, getActionViewIntent(context, uri, bundle), BrazeInternal.INSTANCE.getConfigurationProvider(context)));
        } catch (ActivityNotFoundException e) {
            BrazeLogger.INSTANCE.brazelog(this, BrazeLogger.Priority.W, e, new UriAction$openUriWithActionViewFromPush$1(uri));
        }
    }

    public final void openUriWithWebViewActivity(Context context, Uri uri, Bundle bundle) {
        b.y(context, "context");
        b.y(uri, "uri");
        Intent webViewActivityIntent = getWebViewActivityIntent(context, uri, bundle);
        webViewActivityIntent.setFlags(BrazeDeeplinkHandler.Companion.getInstance().getIntentFlags(IBrazeDeeplinkHandler.IntentFlagPurpose.URI_ACTION_OPEN_WITH_WEBVIEW_ACTIVITY));
        try {
            context.startActivity(webViewActivityIntent);
        } catch (Exception e) {
            BrazeLogger.INSTANCE.brazelog(this, BrazeLogger.Priority.E, e, UriAction$openUriWithWebViewActivity$1.INSTANCE);
        }
    }

    public final void openUriWithWebViewActivityFromPush(Context context, Uri uri, Bundle bundle) {
        b.y(context, "context");
        b.y(uri, "uri");
        try {
            context.startActivities(getIntentArrayWithConfiguredBackStack(context, bundle, getWebViewActivityIntent(context, uri, bundle), BrazeInternal.INSTANCE.getConfigurationProvider(context)));
        } catch (Exception e) {
            BrazeLogger.INSTANCE.brazelog(this, BrazeLogger.Priority.E, e, UriAction$openUriWithWebViewActivityFromPush$1.INSTANCE);
        }
    }

    public final void setUri(Uri uri) {
        b.y(uri, "<set-?>");
        this.uri = uri;
    }

    public final void setUseWebView(boolean z) {
        this.useWebView = z;
    }

    public UriAction(UriAction uriAction) {
        b.y(uriAction, "original");
        this.uri = uriAction.uri;
        this.extras = uriAction.extras;
        this.useWebView = uriAction.useWebView;
        this.channel = uriAction.getChannel();
    }
}