导航菜单

页面标题

页面副标题

Mitra Bukalapak v2.55.0 - BrazeWebViewActivity.java 源代码

正在查看: Mitra Bukalapak v2.55.0 应用的 BrazeWebViewActivity.java JAVA 源代码文件

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


package com.braze.ui;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.webkit.ConsoleMessage;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.fragment.app.e;
import com.braze.BrazeInternal;
import com.braze.enums.Channel;
import com.braze.support.BrazeFileUtils;
import com.braze.support.BrazeLogger;
import com.braze.ui.actions.UriAction;
import com.braze.ui.support.ViewUtils;
import kotlin.Metadata;

@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0017\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\n\u0010\u000bJ\u0012\u0010\u0005\u001a\u00020\u00042\b\u0010\u0003\u001a\u0004\u0018\u00010\u0002H\u0016J\b\u0010\u0007\u001a\u00020\u0006H\u0016J\b\u0010\t\u001a\u00020\bH\u0016¨\u0006\f"}, d2 = {"Lcom/braze/ui/BrazeWebViewActivity;", "Landroidx/fragment/app/e;", "Landroid/os/Bundle;", "savedInstanceState", "Llm9;", "onCreate", "Landroid/webkit/WebChromeClient;", "createWebChromeClient", "Landroid/webkit/WebViewClient;", "createWebViewClient", "<init>", "()V", "android-sdk-ui_release"}, k = 1, mv = {1, 8, 0})
@SuppressLint({"SetJavaScriptEnabled"})
public class BrazeWebViewActivity extends e {
    public WebChromeClient createWebChromeClient() {
        return new WebChromeClient() {
            @Override
            public Bitmap getDefaultVideoPoster() {
                Bitmap createBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
                p64.g(createBitmap, "createBitmap(1, 1, Bitmap.Config.ARGB_8888)");
                return createBitmap;
            }

            @Override
            public boolean onConsoleMessage(ConsoleMessage cm) {
                p64.h(cm, "cm");
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, (BrazeLogger.Priority) null, (Throwable) null, new BrazeWebViewActivity$createWebChromeClient$1$onConsoleMessage$1(cm), 3, (Object) null);
                return true;
            }
        };
    }

    public WebViewClient createWebViewClient() {
        return new WebViewClient() {
            private final Boolean handleUrlOverride(Context context, String url) {
                try {
                    if (iu0.R(BrazeFileUtils.REMOTE_SCHEMES, Uri.parse(url).getScheme())) {
                        return null;
                    }
                    UriAction createUriActionFromUrlString = BrazeDeeplinkHandler.Companion.getInstance().createUriActionFromUrlString(url, BrazeWebViewActivity.this.getIntent().getExtras(), false, Channel.UNKNOWN);
                    if (createUriActionFromUrlString == null) {
                        return Boolean.FALSE;
                    }
                    createUriActionFromUrlString.execute(context);
                    BrazeWebViewActivity.this.finish();
                    return Boolean.TRUE;
                } catch (Exception e) {
                    BrazeLogger.INSTANCE.brazelog(this, BrazeLogger.Priority.E, e, new BrazeWebViewActivity$createWebViewClient$1$handleUrlOverride$1(url));
                    return null;
                }
            }

            @Override
            public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) {
                p64.h(view, "view");
                p64.h(detail, "detail");
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.I, (Throwable) null, BrazeWebViewActivity$createWebViewClient$1$onRenderProcessGone$1.INSTANCE, 2, (Object) null);
                return true;
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
                p64.h(view, "view");
                p64.h(request, "request");
                Context context = view.getContext();
                p64.g(context, "view.context");
                String uri = request.getUrl().toString();
                p64.g(uri, "request.url.toString()");
                Boolean handleUrlOverride = handleUrlOverride(context, uri);
                return handleUrlOverride != null ? handleUrlOverride.booleanValue() : super.shouldOverrideUrlLoading(view, request);
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                p64.h(view, "view");
                p64.h(url, "url");
                Context context = view.getContext();
                p64.g(context, "view.context");
                Boolean handleUrlOverride = handleUrlOverride(context, url);
                return handleUrlOverride != null ? handleUrlOverride.booleanValue() : super.shouldOverrideUrlLoading(view, url);
            }
        };
    }

    public void onCreate(Bundle bundle) {
        String string;
        super.onCreate(bundle);
        getWindow().setFlags(16777216, 16777216);
        if (BrazeInternal.INSTANCE.getConfigurationProvider(this).getShouldUseWindowFlagSecureInActivities()) {
            getWindow().setFlags(8192, 8192);
        }
        setContentView(R$layout.com_braze_webview_activity);
        WebView webView = (WebView) findViewById(R$id.com_braze_webview_activity_webview);
        webView.setLayerType(2, null);
        WebSettings settings = webView.getSettings();
        p64.g(settings, "webView.settings");
        settings.setAllowFileAccess(false);
        settings.setBuiltInZoomControls(true);
        settings.setJavaScriptEnabled(true);
        settings.setUseWideViewPort(true);
        settings.setLoadWithOverviewMode(true);
        settings.setDisplayZoomControls(false);
        settings.setDomStorageEnabled(true);
        Context applicationContext = getApplicationContext();
        p64.g(applicationContext, "this.applicationContext");
        if (ViewUtils.isDeviceInNightMode(applicationContext)) {
            int i = Build.VERSION.SDK_INT;
            if (i >= 33) {
                settings.setAlgorithmicDarkeningAllowed(true);
            } else if (i >= 29) {
                settings.setForceDark(2);
            }
        }
        webView.setWebChromeClient(createWebChromeClient());
        webView.setWebViewClient(createWebViewClient());
        Bundle extras = getIntent().getExtras();
        if (extras == null || (string = extras.getString("url")) == null) {
            return;
        }
        webView.loadUrl(string);
    }
}