导航菜单

页面标题

页面副标题

Vi App v10.18.0 - NDTVWebActivity.java 源代码

正在查看: Vi App v10.18.0 应用的 NDTVWebActivity.java JAVA 源代码文件

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


package com.viapps.viappwebview;

import android.annotation.SuppressLint;
import android.app.DownloadManager;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.webkit.CookieManager;
import android.webkit.URLUtil;
import android.webkit.WebView;
import android.widget.ProgressBar;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.viapps.elk.KibanaUtility;
import in.juspay.hyper.constants.LogSubCategory;
import in.juspay.hypersdk.core.PaymentConstants;
import kotlin.Deprecated;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONObject;

@SourceDebugExtension({"SMAP\nNDTVWebActivity.kt\nKotlin\n*S Kotlin\n*F\n+ 1 NDTVWebActivity.kt\ncom/viapps/viappwebview/NDTVWebActivity\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,337:1\n1#2:338\n*E\n"})
public final class NDTVWebActivity extends AppCompatActivity {

    @NotNull
    public static final Companion Companion = new Companion(null);

    @Nullable
    private View errorView;
    private boolean isWebViewDestroyed;

    @Nullable
    private NetworkUtil networkUtil;

    @Nullable
    private JSONObject obj;

    @Nullable
    private ProgressBar progressBar;

    @Nullable
    private String tag;

    @Nullable
    private String url;

    @Nullable
    private WebView webViewNDTV;

    public static final class Companion {
        private Companion() {
        }

        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

    public final void handleBackPressed() {
        WebView webView = this.webViewNDTV;
        if (webView != null && webView.isFocused()) {
            WebView webView2 = this.webViewNDTV;
            if (webView2 != null && webView2.canGoBack()) {
                WebView webView3 = this.webViewNDTV;
                if (webView3 != null) {
                    webView3.goBack();
                    return;
                }
                return;
            }
        }
        super/*androidx.activity.ComponentActivity*/.onBackPressed();
        finish();
    }

    public static final void onCreate$lambda$0(NDTVWebActivity nDTVWebActivity, String str, String str2, String str3, String str4, long j) {
        Intrinsics.checkNotNullParameter(nDTVWebActivity, "this$0");
        DownloadManager.Request request = new DownloadManager.Request(Uri.parse(str));
        request.setMimeType(str4);
        request.addRequestHeader("cookie", CookieManager.getInstance().getCookie(str));
        request.addRequestHeader("User-Agent", str2);
        request.setDescription("Downloading File...");
        request.setTitle(URLUtil.guessFileName(str, str3, str4));
        request.allowScanningByMediaScanner();
        request.setNotificationVisibility(1);
        request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, URLUtil.guessFileName(str, str3, str4));
        Object systemService = nDTVWebActivity.getApplicationContext().getSystemService("download");
        Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.app.DownloadManager");
        ((DownloadManager) systemService).enqueue(request);
        Toast.makeText(nDTVWebActivity.getApplicationContext(), "Downloading File", 1).show();
    }

    private final void safelyDestroyWebView(final WebView webView) {
        if (this.isWebViewDestroyed) {
            return;
        }
        if (webView != null) {
            webView.loadUrl("about:blank");
        }
        ViewParent parent = webView != null ? webView.getParent() : null;
        ViewGroup viewGroup = parent instanceof ViewGroup ? (ViewGroup) parent : null;
        if (viewGroup != null) {
            viewGroup.removeView(webView);
        }
        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
            @Override
            public final void run() {
                NDTVWebActivity.safelyDestroyWebView$lambda$4(webView, this);
            }
        }, 300L);
    }

    public static final void safelyDestroyWebView$lambda$4(WebView webView, NDTVWebActivity nDTVWebActivity) {
        Intrinsics.checkNotNullParameter(nDTVWebActivity, "this$0");
        if (webView != null) {
            try {
                webView.removeAllViews();
            } catch (Exception unused) {
                return;
            }
        }
        if (webView != null) {
            webView.clearHistory();
        }
        if (webView != null) {
            webView.clearCache(true);
        }
        if (webView != null) {
            webView.destroy();
        }
        nDTVWebActivity.isWebViewDestroyed = true;
    }

    @Nullable
    public final JSONObject getObj() {
        return this.obj;
    }

    @Nullable
    public final ProgressBar getProgressBar() {
        return this.progressBar;
    }

    @Nullable
    public final String getTag() {
        return this.tag;
    }

    @Nullable
    public final WebView getWebViewNDTV() {
        return this.webViewNDTV;
    }

    @Deprecated(message = "Deprecated in Java")
    @SuppressLint({"MissingSuperCall"})
    public void onBackPressed() {
        handleBackPressed();
    }

    @android.annotation.SuppressLint({"SetJavaScriptEnabled"})
    public void onCreate(@org.jetbrains.annotations.Nullable android.os.Bundle r4) {
        throw new UnsupportedOperationException("Method not decompiled: com.viapps.viappwebview.NDTVWebActivity.onCreate(android.os.Bundle):void");
    }

    public void onDestroy() {
        super.onDestroy();
        safelyDestroyWebView(this.webViewNDTV);
    }

    public void onPause() {
        super/*androidx.fragment.app.FragmentActivity*/.onPause();
        WebView webView = this.webViewNDTV;
        if (webView == null || webView == null) {
            return;
        }
        webView.onPause();
    }

    public void onResume() {
        super/*androidx.fragment.app.FragmentActivity*/.onResume();
        WebView webView = this.webViewNDTV;
        if (webView == null || webView == null) {
            return;
        }
        webView.onResume();
    }

    public final void sendDataKibana(int i2, @Nullable String str) {
        try {
            Object obj = getApplication().getPackageManager().getPackageInfo(getApplication().getPackageName(), 0).versionName;
            try {
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("module", getIntent().getStringExtra("title"));
                String stringExtra = getIntent().getStringExtra("userObj");
                jSONObject.put(PaymentConstants.PAYLOAD, stringExtra != null ? new JSONObject(stringExtra) : null);
                jSONObject.put("APIName", this.url);
                jSONObject.put("deviceModel", Build.MODEL);
                jSONObject.put("deviceOSVersion", LogSubCategory.LifeCycle.ANDROID);
                jSONObject.put("deviceManufacturer", Build.MANUFACTURER);
                jSONObject.put("appVersion", obj);
                jSONObject.put("MSISDN", getIntent().getStringExtra("msisdn"));
                JSONObject jSONObject2 = new JSONObject();
                JSONObject jSONObject3 = new JSONObject();
                jSONObject3.put("errorCode", i2);
                jSONObject3.put("errorMessage", str);
                jSONObject2.put("data", jSONObject3);
                jSONObject.put("APIResponse", jSONObject2);
                KibanaUtility kibanaUtility = KibanaUtility.INSTANCE;
                new KibanaUtility.CallBack() {
                    @Override
                    public void onFailure(@Nullable String str2) {
                    }

                    @Override
                    public void onSuccess(@Nullable String str2) {
                    }
                };
                c.a();
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        } catch (PackageManager.NameNotFoundException e3) {
            throw new RuntimeException(e3);
        }
    }

    public final void setObj(@Nullable JSONObject jSONObject) {
        this.obj = jSONObject;
    }

    public final void setTag(@Nullable String str) {
        this.tag = str;
    }

    public final void setUrl(@Nullable String str) {
        this.url = str;
    }
}