导航菜单

页面标题

页面副标题

OLX India v19.42.007 - InAppWebView.java 源代码

正在查看: OLX India v19.42.007 应用的 InAppWebView.java JAVA 源代码文件

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


package com.jio.jioads.webviewhandler;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.ProgressBar;
import com.google.firebase.crashlytics.internal.metadata.UserMetadata;
import com.jio.jioads.adinterfaces.JioAdView;
import com.jio.jioads.adinterfaces.JioAds;
import com.jio.jioads.adinterfaces.h0;
import com.jio.jioads.util.Utility;
import com.jio.jioads.util.l;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import org.json.JSONObject;

@Metadata
public final class InAppWebView extends Activity implements View.OnClickListener {
    public static final int k = 0;
    public ImageView a;
    public ImageView b;
    public ProgressBar c;
    public WebView d;
    public InAppWebView e;
    public String f;
    public String g;
    public String h;
    public boolean i;
    public final JSONObject j = new JSONObject();

    public static final void b(final InAppWebView inAppWebView, View view, boolean z) {
        if (z) {
            ImageView imageView = inAppWebView.a;
            if (imageView != null) {
                imageView.setVisibility(8);
            }
            ImageView imageView2 = inAppWebView.b;
            if (imageView2 != null) {
                imageView2.setVisibility(0);
            }
            ImageView imageView3 = inAppWebView.b;
            if (imageView3 != null) {
                imageView3.setOnFocusChangeListener(new View.OnFocusChangeListener() {
                    @Override
                    public final void onFocusChange(View view2, boolean z2) {
                        InAppWebView.e(InAppWebView.this, view2, z2);
                    }
                });
            }
            ImageView imageView4 = inAppWebView.b;
            if (imageView4 != null) {
                imageView4.setOnClickListener(inAppWebView);
            }
            ImageView imageView5 = inAppWebView.b;
            if (imageView5 != null) {
                imageView5.requestFocus();
            }
            ImageView imageView6 = inAppWebView.b;
            if (imageView6 != null) {
                imageView6.bringToFront();
            }
        }
    }

    public static final void e(InAppWebView inAppWebView, View view, boolean z) {
        if (z) {
            return;
        }
        ImageView imageView = inAppWebView.b;
        if (imageView != null) {
            imageView.setVisibility(8);
        }
        ImageView imageView2 = inAppWebView.a;
        if (imageView2 == null) {
            return;
        }
        imageView2.setVisibility(0);
    }

    public final void a() {
        Utility utility = Utility.INSTANCE;
        InAppWebView inAppWebView = this.e;
        if (inAppWebView == null) {
            inAppWebView = null;
        }
        int currentUIModeType = utility.getCurrentUIModeType(inAppWebView);
        if (currentUIModeType != 1) {
            if (currentUIModeType != 4) {
                this.j.put("dt", String.valueOf(currentUIModeType));
                return;
            } else {
                this.j.put("dt", "4");
                return;
            }
        }
        InAppWebView inAppWebView2 = this.e;
        if (utility.isDeviceTypeTablet(inAppWebView2 != null ? inAppWebView2 : null)) {
            this.j.put("dt", "2");
        } else {
            this.j.put("dt", "1");
        }
    }

    public final void c(String str) {
        String str2;
        String str3;
        if (str != null) {
            try {
                if (TextUtils.isEmpty(str)) {
                    return;
                }
                String obj = StringsKt.e1(str).toString();
                l.a(this.g + ": Brand page click URL: " + obj);
                Uri parse = Uri.parse(obj);
                InAppWebView inAppWebView = null;
                if (Intrinsics.d("intent", parse.getScheme())) {
                    Intent parseUri = Intent.parseUri(parse.toString(), 1);
                    parseUri.setFlags(268435456);
                    Utility utility = Utility.INSTANCE;
                    InAppWebView inAppWebView2 = this.e;
                    if (inAppWebView2 == null) {
                        inAppWebView2 = null;
                    }
                    boolean canHandleIntent = utility.canHandleIntent(inAppWebView2, parseUri);
                    l.c("Is brand page contains deeplink Url: " + canHandleIntent);
                    if (!canHandleIntent) {
                        l.a("Attempting InAppWebview fallback url");
                        c(parseUri.getStringExtra("browser_fallback_url"));
                        return;
                    } else {
                        InAppWebView inAppWebView3 = this.e;
                        if (inAppWebView3 != null) {
                            inAppWebView = inAppWebView3;
                        }
                        inAppWebView.startActivity(parseUri);
                        return;
                    }
                }
                if (StringsKt.T(obj, "S.browser_fallback_url", false, 2, (Object) null)) {
                    str2 = obj.substring(StringsKt.f0(obj, "S.browser_fallback_url=", 0, false, 6, (Object) null) + 23, StringsKt.n0(obj, ";end", 0, false, 6, (Object) null));
                    str3 = obj.substring(0, StringsKt.f0(obj, ";S.browser_fallback_url", 0, false, 6, (Object) null));
                    l.a(this.g + ": fallbackUrl" + StringsKt.e1(str2).toString() + " deepLinkUrl:" + StringsKt.e1(str3).toString());
                } else {
                    str2 = "";
                    str3 = str2;
                }
                if (!Intrinsics.d(str3, "")) {
                    obj = str3;
                }
                Utility utility2 = Utility.INSTANCE;
                InAppWebView inAppWebView4 = this.e;
                if (inAppWebView4 == null) {
                    inAppWebView4 = null;
                }
                if (!utility2.isIntentActivityPresent(inAppWebView4, parse.toString())) {
                    if (this.i) {
                        return;
                    }
                    l.a("inside isFallbackUrlAttempted case");
                    c(str2);
                    this.i = true;
                    return;
                }
                l.a("Inside isIntentAvailable true and uri is: " + parse);
                setIntent(new Intent("android.intent.action.VIEW"));
                getIntent().setData(Uri.parse(obj));
                getIntent().setFlags(268435456);
                InAppWebView inAppWebView5 = this.e;
                if (inAppWebView5 != null) {
                    inAppWebView = inAppWebView5;
                }
                inAppWebView.startActivity(getIntent());
            } catch (Exception e) {
                String str4 = "Exception while brand page click so trying fallback Url.Ex: " + e;
                if (JioAds.Companion.getInstance().getLogLevel$jio_ads_sdk_exo_2_18Location_21SsaiCommonVideoModuleCompanionNativeDynamicDisplayInstreamAudioInstreamVideoInterstitialMediationRetargetingCarouselRelease() != JioAds.LogLevel.NONE) {
                    Log.e("merc", str4);
                }
            }
        }
    }

    public final void d() {
        DisplayMetrics displayMetrics = Resources.getSystem().getDisplayMetrics();
        int i = displayMetrics.widthPixels;
        int i2 = displayMetrics.heightPixels;
        InAppWebView inAppWebView = this.e;
        if (inAppWebView == null) {
            inAppWebView = null;
        }
        int i3 = inAppWebView.getResources().getConfiguration().orientation;
        if (i3 == 1) {
            this.j.put("sw", String.valueOf(i));
            this.j.put("sh", String.valueOf(i2));
        } else if (i3 != 2) {
            this.j.put("sw", String.valueOf(i));
            this.j.put("sh", String.valueOf(i2));
        } else {
            this.j.put("sw", String.valueOf(i2));
            this.j.put("sh", String.valueOf(i));
        }
    }

    public final void f() {
        ImageView imageView = this.a;
        if (imageView != null) {
            imageView.setVisibility(0);
        }
        ImageView imageView2 = this.a;
        if (imageView2 != null) {
            imageView2.setFocusable(true);
        }
        ImageView imageView3 = this.a;
        if (imageView3 != null) {
            imageView3.setOnFocusChangeListener(new View.OnFocusChangeListener() {
                @Override
                public final void onFocusChange(View view, boolean z) {
                    InAppWebView.b(InAppWebView.this, view, z);
                }
            });
        }
        ImageView imageView4 = this.a;
        if (imageView4 != null) {
            imageView4.setOnClickListener(this);
        }
        ImageView imageView5 = this.a;
        if (imageView5 != null) {
            imageView5.bringToFront();
        }
    }

    @Override
    public final void onBackPressed() {
        super.onBackPressed();
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == getResources().getIdentifier("close_button", "id", getPackageName())) {
            finish();
        }
    }

    @Override
    public final void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
    }

    @Override
    public final void onCreate(Bundle bundle) {
        WebView webView;
        requestWindowFeature(1);
        super.onCreate(bundle);
        this.e = this;
        getWindow().setFlags(UserMetadata.MAX_ATTRIBUTE_SIZE, UserMetadata.MAX_ATTRIBUTE_SIZE);
        Utility utility = Utility.INSTANCE;
        InAppWebView inAppWebView = this.e;
        if (inAppWebView == null) {
            inAppWebView = null;
        }
        if (utility.getCurrentUIModeType(inAppWebView) == 4) {
            setContentView(com.jio.jioads.c.jio_inapp_stb_webview);
        } else {
            setContentView(com.jio.jioads.c.jio_inapp_webview);
        }
        WebView webView2 = (WebView) findViewById(getResources().getIdentifier("webview", "id", getPackageName()));
        this.d = webView2;
        if (webView2 != null) {
            webView2.getSettings().setJavaScriptEnabled(true);
            this.d.getSettings().setUseWideViewPort(true);
            this.d.getSettings().setLoadWithOverviewMode(true);
            this.d.getSettings().setBuiltInZoomControls(false);
            this.d.getSettings().setGeolocationEnabled(true);
            this.d.getSettings().setDomStorageEnabled(true);
            this.d.getSettings().setAllowFileAccess(true);
            this.d.getSettings().setAllowContentAccess(true);
            this.d.getSettings().setPluginState(WebSettings.PluginState.ON);
            this.d.getSettings().setPluginState(WebSettings.PluginState.ON_DEMAND);
            this.d.getSettings().setCacheMode(2);
            this.d.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
            this.d.addJavascriptInterface(new c(this), "JSInterface");
            this.a = (ImageView) findViewById(getResources().getIdentifier("close_button", "id", getPackageName()));
            InAppWebView inAppWebView2 = this.e;
            if (utility.getCurrentUIModeType(inAppWebView2 != null ? inAppWebView2 : null) == 4) {
                this.b = (ImageView) findViewById(getResources().getIdentifier("close_button_focused", "id", getPackageName()));
            }
            this.c = (ProgressBar) findViewById(getResources().getIdentifier("progressbar", "id", getPackageName()));
            this.d.setWebChromeClient(new d(this));
            this.d.setWebViewClient(new e(this));
            Bundle extras = getIntent().getExtras();
            if (extras != null) {
                String string = extras.getString("screen_orientation");
                String a = h0.a("InAppWebView orientation: ", string, "message");
                if (JioAds.Companion.getInstance().getLogLevel$jio_ads_sdk_exo_2_18Location_21SsaiCommonVideoModuleCompanionNativeDynamicDisplayInstreamAudioInstreamVideoInterstitialMediationRetargetingCarouselRelease() != JioAds.LogLevel.NONE) {
                    Log.d("merc", a);
                }
                setRequestedOrientation((string == null || !string.equals(JioAdView.ORIENTATION_TYPE.LANDSCAPE)) ? (string == null || !string.equals(JioAdView.ORIENTATION_TYPE.PORTRAIT)) ? -1 : 7 : 6);
                this.g = extras.getString("asi");
                extras.getString("Package_Name");
                this.h = extras.getString("ccb");
                this.f = extras.getString("ifa");
                extras.getString("uid");
                extras.getString("cid");
                if (extras.get("adType") != null) {
                }
                extras.getBoolean("isInterstitialVideo");
                String string2 = extras.getString("url");
                if (string2 != null && (webView = this.d) != null) {
                    webView.loadUrl(string2);
                }
            }
            f();
        }
    }

    @Override
    public final void onDestroy() {
        WebView webView = this.d;
        if (webView != null) {
            webView.removeJavascriptInterface("JSInterface");
        }
        super.onDestroy();
    }
}