导航菜单

页面标题

页面副标题

Mint v5.7.3 - StudentOfferWebView.java 源代码

正在查看: Mint v5.7.3 应用的 StudentOfferWebView.java JAVA 源代码文件

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


package com.htmedia.mint.studentoffer;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.activity.OnBackPressedCallback;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AppCompatActivity;
import com.htmedia.mint.AppController;
import com.htmedia.mint.htsubscription.GetSubscriptionIntent;
import com.htmedia.mint.htsubscription.SubscriptionTrigger;
import com.htmedia.mint.pojo.config.Config;
import com.htmedia.mint.pojo.subscription.userdetail.MintSubscriptionDetail;
import com.htmedia.mint.studentoffer.StudentOfferWebView;
import com.htmedia.mint.utils.f0;
import com.snowplowanalytics.snowplow.tracker.constants.Parameters;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import kotlin.Metadata;
import kotlin.jvm.internal.m;
import l7.j;
import ug.a0;

@Metadata(d1 = {"\u0000F\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0005\u001a\u00020\u0014H\u0002J\u0010\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u000e\u001a\u00020\u000fH\u0002J\"\u0010\u0016\u001a\u00020\u00142\u0006\u0010\u0017\u001a\u00020\u00042\u0006\u0010\u0018\u001a\u00020\u00042\b\u0010\u0019\u001a\u0004\u0018\u00010\u0007H\u0014J\b\u0010\u001a\u001a\u00020\u0014H\u0002J\u0012\u0010\u001b\u001a\u00020\u00142\b\u0010\u001c\u001a\u0004\u0018\u00010\u001dH\u0014R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082D¢\u0006\u0002\n\u0000R\u0014\u0010\u0005\u001a\b\u0012\u0004\u0012\u00020\u00070\u0006X\u0082.¢\u0006\u0002\n\u0000R\u001c\u0010\b\u001a\u0010\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u000b0\n\u0018\u00010\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\rX\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\u000e\u001a\u00020\u000fX\u0086.¢\u0006\u000e\n\u0000\u001a\u0004\b\u0010\u0010\u0011\"\u0004\b\u0012\u0010\u0013¨\u0006\u001e"}, d2 = {"Lcom/htmedia/mint/studentoffer/StudentOfferWebView;", "Landroidx/appcompat/app/AppCompatActivity;", "()V", "FILE_CHOOSER_REQUEST_CODE", BuildConfig.FLAVOR, "getActivityResultLauncher", "Landroidx/activity/result/ActivityResultLauncher;", "Landroid/content/Intent;", "uploadMessage", "Landroid/webkit/ValueCallback;", BuildConfig.FLAVOR, "Landroid/net/Uri;", "url", BuildConfig.FLAVOR, "webView", "Landroid/webkit/WebView;", "getWebView", "()Landroid/webkit/WebView;", "setWebView", "(Landroid/webkit/WebView;)V", BuildConfig.FLAVOR, "initWebView", "onActivityResult", "requestCode", "resultCode", Parameters.DATA, "onBackPress", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "app_productionRelease"}, k = 1, mv = {1, 9, 0}, xi = 48)
public final class StudentOfferWebView extends AppCompatActivity {
    private ValueCallback<Uri[]> b;
    public WebView c;
    private ActivityResultLauncher<Intent> d;
    private final int a = 100;
    private String e = BuildConfig.FLAVOR;

    @Metadata(d1 = {"\u0000\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000*\u0001\u0000\b\n\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"com/htmedia/mint/studentoffer/StudentOfferWebView$initWebView$3", "Landroid/webkit/WebViewClient;", "app_productionRelease"}, k = 1, mv = {1, 9, 0}, xi = 48)
    public static final class a extends WebViewClient {
        a() {
        }
    }

    @Metadata(d1 = {"\u0000+\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J0\u0010\u0002\u001a\u00020\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u00052\u0012\u0010\u0006\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\t0\b0\u00072\b\u0010\n\u001a\u0004\u0018\u00010\u000bH\u0016¨\u0006\f"}, d2 = {"com/htmedia/mint/studentoffer/StudentOfferWebView$initWebView$4", "Landroid/webkit/WebChromeClient;", "onShowFileChooser", BuildConfig.FLAVOR, "webView", "Landroid/webkit/WebView;", "filePathCallback", "Landroid/webkit/ValueCallback;", BuildConfig.FLAVOR, "Landroid/net/Uri;", "fileChooserParams", "Landroid/webkit/WebChromeClient$FileChooserParams;", "app_productionRelease"}, k = 1, mv = {1, 9, 0}, xi = 48)
    public static final class b extends WebChromeClient {
        b() {
        }

        @Override
        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {
            m.g(filePathCallback, "filePathCallback");
            StudentOfferWebView.this.b = filePathCallback;
            Intent intent = new Intent("android.intent.action.GET_CONTENT");
            intent.addCategory("android.intent.category.OPENABLE");
            intent.setType("image/*");
            ActivityResultLauncher activityResultLauncher = StudentOfferWebView.this.d;
            if (activityResultLauncher == null) {
                m.w("getActivityResultLauncher");
                activityResultLauncher = null;
            }
            activityResultLauncher.launch(Intent.createChooser(intent, "Select ID Card"));
            return true;
        }
    }

    @Metadata(d1 = {"\u0000\u0011\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0002\u001a\u00020\u0003H\u0016¨\u0006\u0004"}, d2 = {"com/htmedia/mint/studentoffer/StudentOfferWebView$onBackPress$1", "Landroidx/activity/OnBackPressedCallback;", "handleOnBackPressed", BuildConfig.FLAVOR, "app_productionRelease"}, k = 1, mv = {1, 9, 0}, xi = 48)
    public static final class c extends OnBackPressedCallback {
        c() {
            super(true);
        }

        public void handleOnBackPressed() {
            if (StudentOfferWebView.this.N().canGoBack()) {
                StudentOfferWebView.this.N().goBack();
            } else {
                StudentOfferWebView.this.finish();
            }
        }
    }

    private final void L() {
        ActivityResultLauncher<Intent> registerForActivityResult = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                StudentOfferWebView.M(StudentOfferWebView.this, (ActivityResult) obj);
            }
        });
        m.f(registerForActivityResult, "registerForActivityResult(...)");
        this.d = registerForActivityResult;
    }

    public static final void M(StudentOfferWebView studentOfferWebView, ActivityResult activityResult) {
        a0 a0Var;
        m.g(studentOfferWebView, "this$0");
        if (activityResult.getResultCode() == -1) {
            Intent data = activityResult.getData();
            Uri data2 = data != null ? data.getData() : null;
            if (data2 != null) {
                ValueCallback<Uri[]> valueCallback = studentOfferWebView.b;
                if (valueCallback != null) {
                    valueCallback.onReceiveValue(new Uri[]{data2});
                }
                studentOfferWebView.b = null;
                a0Var = a0.a;
            } else {
                a0Var = null;
            }
            if (a0Var == null) {
                studentOfferWebView.b = null;
            }
        }
    }

    private final void O(WebView webView) {
        webView.clearCache(true);
        webView.clearHistory();
        WebSettings settings = webView.getSettings();
        if (settings != null) {
            settings.setJavaScriptEnabled(true);
            settings.setAllowFileAccess(true);
            settings.setAllowContentAccess(true);
            settings.setAllowFileAccessFromFileURLs(true);
            settings.setAllowUniversalAccessFromFileURLs(true);
            settings.setDomStorageEnabled(true);
            settings.setDatabaseEnabled(true);
            settings.setSupportMultipleWindows(true);
        }
        webView.setWebViewClient(new a());
        webView.setWebChromeClient(new b());
        webView.addJavascriptInterface(new j(this), "Android");
        webView.loadUrl(f0.v(this.e, this));
    }

    private final void onBackPress() {
        getOnBackPressedDispatcher().addCallback(this, new c());
    }

    public final WebView N() {
        WebView webView = this.c;
        if (webView != null) {
            return webView;
        }
        m.w("webView");
        return null;
    }

    public final void P(WebView webView) {
        m.g(webView, "<set-?>");
        this.c = webView;
    }

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == this.a) {
            ValueCallback<Uri[]> valueCallback = this.b;
            if (valueCallback != null) {
                valueCallback.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, data));
                this.b = null;
                return;
            }
            return;
        }
        if (requestCode == 1003) {
            if (resultCode == -1) {
                SubscriptionTrigger.openOnBoardJourneyVideo(this);
            }
        } else {
            if (requestCode != 1004 || resultCode != -1) {
                super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(requestCode, resultCode, data);
                return;
            }
            MintSubscriptionDetail l = AppController.j().l();
            if (l != null && l.isSubscriptionActive()) {
                f0.K("l1_menu_order", this);
            }
            if (GetSubscriptionIntent.getSubscriptionIntent() != null) {
                setResult(-1, GetSubscriptionIntent.getSubscriptionIntent());
            } else {
                setResult(-1);
            }
            finish();
        }
    }

    protected void onCreate(Bundle savedInstanceState) {
        String str;
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(savedInstanceState);
        setContentView(2131623965);
        View findViewById = findViewById(2131432098);
        m.f(findViewById, "findViewById(...)");
        P((WebView) findViewById);
        Config g = AppController.j().g();
        if (g == null || g.getPlanPageV2() == null || g.getPlanPageV2().getStudent_offer_url() == null) {
            str = "https://www.livemint.com/student/lm/plan";
        } else {
            str = g.getPlanPageV2().getStudent_offer_url();
            m.d(str);
        }
        this.e = str;
        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.removeAllCookies(null);
        cookieManager.flush();
        onBackPress();
        L();
        O(N());
    }
}