导航菜单

页面标题

页面副标题

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

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

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


package com.viapps.viappwebview;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.ProgressBar;
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 kotlin.text.StringsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONObject;

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

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

    @Nullable
    private View errorView;
    private boolean isWebViewDestroyed;

    @Nullable
    private NetworkUtil networkUtil;

    @Nullable
    private ProgressBar progressBar;

    @Nullable
    private ValueCallback<Uri[]> uploadMessage;

    @Nullable
    private String url;

    @Nullable
    private WebView webViewGames;

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

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

    public final void handleBackPressed() {
        StringBuilder sb = new StringBuilder();
        sb.append("handleBackPressed: ");
        WebView webView = this.webViewGames;
        sb.append(webView != null ? webView.getUrl() : null);
        WebView webView2 = this.webViewGames;
        String url = webView2 != null ? webView2.getUrl() : null;
        Intrinsics.checkNotNull(url);
        boolean z = false;
        if (StringsKt.contains$default(url, "story.html", false, 2, (Object) null)) {
            finish();
            return;
        }
        WebView webView3 = this.webViewGames;
        if (webView3 != null && webView3.isFocused()) {
            WebView webView4 = this.webViewGames;
            if (webView4 != null && webView4.canGoBack()) {
                z = true;
            }
            if (z) {
                WebView webView5 = this.webViewGames;
                if (webView5 != null) {
                    webView5.goBack();
                    return;
                }
                return;
            }
        }
        super/*androidx.activity.ComponentActivity*/.onBackPressed();
        finish();
    }

    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() {
                GamesLoftWebActivity.safelyDestroyWebView$lambda$3(webView, this);
            }
        }, 300L);
    }

    public static final void safelyDestroyWebView$lambda$3(WebView webView, GamesLoftWebActivity gamesLoftWebActivity) {
        Intrinsics.checkNotNullParameter(gamesLoftWebActivity, "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();
        }
        gamesLoftWebActivity.isWebViewDestroyed = true;
    }

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

    @Nullable
    public final ValueCallback<Uri[]> getUploadMessage() {
        return this.uploadMessage;
    }

    @Nullable
    public final WebView getWebViewGames() {
        return this.webViewGames;
    }

    @Deprecated(message = "Deprecated in Java")
    public void onActivityResult(int i2, int i3, @Nullable Intent intent) {
        ValueCallback<Uri[]> valueCallback;
        super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i2, i3, intent);
        if (i2 != 101 || (valueCallback = this.uploadMessage) == null) {
            return;
        }
        Intrinsics.checkNotNull(valueCallback);
        valueCallback.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(i3, intent));
        this.uploadMessage = null;
    }

    @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.GamesLoftWebActivity.onCreate(android.os.Bundle):void");
    }

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

    public boolean onOptionsItemSelected(@NotNull MenuItem menuItem) {
        Intrinsics.checkNotNullParameter(menuItem, "item");
        if (menuItem.getItemId() != 16908332) {
            return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
        }
        onBackPressed();
        return true;
    }

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

    public void onResume() {
        super/*androidx.fragment.app.FragmentActivity*/.onResume();
        WebView webView = this.webViewGames;
        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 setUploadMessage(@Nullable ValueCallback<Uri[]> valueCallback) {
        this.uploadMessage = valueCallback;
    }

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