Shinigami ID v1.1.3版本的 MD5 值为:c381e85feac697f048c400ae89b7b92d

以下内容为反编译后的 z.java 源代码,内容仅作参考


package va;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Process;
import android.util.Log;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.shinigami.id.R;
import com.wonderpush.sdk.inappmessaging.display.InAppMessagingDisplay;
import com.wonderpush.sdk.inappmessaging.display.internal.InAppWebView;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Random;
import org.json.JSONException;
import org.json.JSONObject;
import va.u;

public final class z implements u.a {

    public final fb.o f13487a;

    public final WeakReference<WebView> f13488b;
    public final WeakReference<Activity> c;

    public Runnable f13489d;

    public va.c<String> f13490e;

    public final sa.y f13491f;

    public final InAppMessagingDisplay.k f13492g;

    public final u f13493h = new u(this);

    public class a extends WebViewClient {

        public final Runnable f13494a;

        public final va.c<Exception> f13495b;
        public final Resources c;

        public boolean f13496d = false;

        public a(Runnable runnable, va.c<Exception> cVar, Resources resources) {
            this.f13495b = cVar;
            this.f13494a = runnable;
            this.c = resources;
        }

        public final void a(Exception exc) {
            if (this.f13496d) {
                return;
            }
            this.f13496d = true;
            va.c<Exception> cVar = this.f13495b;
            if (cVar != null) {
                cVar.accept(new c(exc));
            }
        }

        @Override
        public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            try {
                super.onPageStarted(webView, str, bitmap);
                sa.y yVar = z.this.f13491f;
                y yVar2 = new y(this, 0);
                int i10 = ((o7.g) yVar).f9168o;
                com.wonderpush.sdk.x.C(yVar2, 10000L);
            } catch (Exception e10) {
                s3.a.z(e10.getLocalizedMessage());
            }
        }

        @Override
        public final boolean shouldOverrideUrlLoading(WebView webView, String str) {
            String str2;
            WebView webView2 = z.this.f13488b.get();
            if (webView2 != null) {
                fb.o oVar = z.this.f13487a;
                if (oVar == null || (str2 = oVar.f5883f) == null || str == null) {
                    webView2.removeJavascriptInterface("_wpiam");
                } else {
                    Uri parse = Uri.parse(str2);
                    Uri parse2 = Uri.parse(str);
                    if (parse.getScheme().equals(parse2.getScheme()) && parse.getPort() == parse2.getPort() && parse.getHost().equals(parse2.getHost())) {
                        webView2.addJavascriptInterface(z.this.f13493h, "_wpiam");
                    } else {
                        webView2.removeJavascriptInterface("_wpiam");
                    }
                }
            }
            if (str.startsWith("http:") || str.startsWith("https:")) {
                return super.shouldOverrideUrlLoading(webView, str);
            }
            z.this.j(str);
            return true;
        }
    }

    public class b extends a {

        public final long f13498f;

        public class a extends WebView.VisualStateCallback {
            public a() {
            }

            @Override
            public final void onComplete(long j10) {
                b bVar = b.this;
                if (j10 != bVar.f13498f || bVar.f13496d) {
                    return;
                }
                bVar.f13496d = true;
                Runnable runnable = bVar.f13494a;
                if (runnable != null) {
                    runnable.run();
                }
            }
        }

        public b(z zVar, Runnable runnable, va.c<Exception> cVar, Resources resources) {
            super(runnable, cVar, resources);
            this.f13498f = new Random().nextLong();
        }

        @Override
        public final void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            super.onPageStarted(webView, str, bitmap);
            webView.postVisualStateCallback(this.f13498f, new a());
        }

        @Override
        public final void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
            try {
                super.onReceivedError(webView, webResourceRequest, webResourceError);
                if (webResourceRequest.isForMainFrame()) {
                    a(new Exception(String.format(Locale.ENGLISH, "Error loading webView with code: %d description: %s", Integer.valueOf(webResourceError.getErrorCode()), webResourceError.getDescription())));
                }
            } catch (Exception e10) {
                s3.a.A("Unexpected webView error", e10);
            }
        }

        @Override
        public final void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
            try {
                super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
                if (webResourceRequest.isForMainFrame()) {
                    a(new Exception("HTTP error loading webView with status " + webResourceResponse.getStatusCode() + " for url: " + webResourceRequest.getUrl().toString()));
                }
            } catch (Exception e10) {
                s3.a.z(e10.getLocalizedMessage());
            }
        }

        @Override
        public final WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
            return (webResourceRequest == null || webResourceRequest.getUrl() == null || !webResourceRequest.getUrl().toString().startsWith("https://cdn.by.wonderpush.com/inapp-sdk/1/wonderpush-loader.min.js")) ? super.shouldInterceptRequest(webView, webResourceRequest) : new WebResourceResponse("text/javascript", "utf-8", this.c.openRawResource(R.raw.wonderpush_inapp_sdk));
        }
    }

    public static class c extends Exception {
        public c(Exception exc) {
            super(exc.getMessage());
        }
    }

    public z(fb.k kVar, WebView webView, Activity activity, sa.y yVar, InAppMessagingDisplay.k kVar2) {
        this.f13487a = kVar instanceof fb.o ? (fb.o) kVar : null;
        this.f13488b = new WeakReference<>(webView);
        this.c = new WeakReference<>(activity);
        this.f13491f = yVar;
        this.f13492g = kVar2;
    }

    @Override
    public final JSONObject a() {
        return this.f13487a.f5872e;
    }

    @Override
    public final void b(Rect rect) {
        WebView webView = this.f13488b.get();
        if (webView != null && (webView instanceof InAppWebView)) {
            ((InAppWebView) webView).setClipPath(rect);
        }
    }

    @Override
    public final void c(String str) {
        f(str, null);
    }

    @Override
    public final void d(String str) {
        va.c<String> cVar = this.f13490e;
        if (cVar != null) {
            cVar.accept(str);
        }
    }

    @Override
    public final void dismiss() {
        Runnable runnable = this.f13489d;
        if (runnable != null) {
            runnable.run();
        }
    }

    @Override
    public final void e(String str, String str2) {
        WebView webView = this.f13488b.get();
        if (webView == null) {
            return;
        }
        Context applicationContext = webView.getContext().getApplicationContext();
        Intent intent = new Intent();
        intent.setPackage(applicationContext.getPackageName());
        intent.setAction("com.wonderpush.action.method");
        intent.setData(new Uri.Builder().scheme("wonderpush").authority("action.method").appendPath(str).build());
        intent.putExtra("com.wonderpush.action.method.extra_method", str);
        intent.putExtra("com.wonderpush.action.method.extra_arg", str2);
        a1.a.a(applicationContext).c(intent);
    }

    @Override
    public final void f(String str, JSONObject jSONObject) {
        JSONObject jSONObject2 = new JSONObject();
        sa.u uVar = this.f13487a.f5870b;
        if (uVar != null) {
            try {
                uVar.a(jSONObject2, "inAppViewed");
            } catch (JSONException e10) {
                s3.a.A("Could not serialize notification metadata", e10);
            }
        }
        Objects.requireNonNull((o7.g) this.f13492g);
        com.wonderpush.sdk.x.a(str, jSONObject2, jSONObject, false, null);
    }

    @Override
    public final void g() {
        n4.i iVar;
        Activity activity = this.c.get();
        if (activity == null) {
            return;
        }
        Context applicationContext = activity.getApplicationContext();
        if (applicationContext != null) {
            activity = applicationContext;
        }
        androidx.appcompat.widget.m mVar = new androidx.appcompat.widget.m(new z5.g(activity));
        z5.g gVar = (z5.g) mVar.f834p;
        a6.g gVar2 = z5.g.c;
        int i10 = 0;
        gVar2.b("requestInAppReview (%s)", gVar.f14841b);
        if (gVar.f14840a == null) {
            Object[] objArr = new Object[0];
            if (Log.isLoggable("PlayCore", 6)) {
                Log.e("PlayCore", a6.g.c(gVar2.f73a, "Play Store app is either not installed or not the official version", objArr));
            }
            iVar = n4.l.d(new z5.a());
        } else {
            final n4.j jVar = new n4.j();
            final a6.o oVar = gVar.f14840a;
            a6.k kVar = new a6.k(gVar, jVar, jVar, 2);
            synchronized (oVar.f89f) {
                oVar.f88e.add(jVar);
                jVar.f8726a.c(new n4.d() {
                    @Override
                    public final void e(n4.i iVar2) {
                        o oVar2 = o.this;
                        n4.j jVar2 = jVar;
                        synchronized (oVar2.f89f) {
                            oVar2.f88e.remove(jVar2);
                        }
                    }
                });
            }
            synchronized (oVar.f89f) {
                if (oVar.f94k.getAndIncrement() > 0) {
                    a6.g gVar3 = oVar.f86b;
                    Object[] objArr2 = new Object[0];
                    Objects.requireNonNull(gVar3);
                    if (Log.isLoggable("PlayCore", 3)) {
                        Log.d("PlayCore", a6.g.c(gVar3.f73a, "Already connected to the service.", objArr2));
                    }
                }
            }
            oVar.a().post(new a6.k(oVar, jVar, kVar, i10));
            iVar = jVar.f8726a;
        }
        iVar.c(new y2.i(this, mVar, 11));
    }

    @Override
    public final void h(String str) {
        WebView webView = this.f13488b.get();
        if (webView == null || str == null) {
            return;
        }
        webView.post(new v(this, Uri.parse(str), webView, 0));
    }

    @Override
    public final void i() {
        int i10;
        Activity activity = this.c.get();
        if (activity == null) {
            throw new Exception("Activity not available");
        }
        int i11 = -1;
        try {
            i10 = activity.checkPermission("android.permission.ACCESS_COARSE_LOCATION", Process.myPid(), Process.myUid());
        } catch (Throwable unused) {
            s3.a.z("checkSelfPermission failed, returning PERMISSION_DENIED");
            i10 = -1;
        }
        try {
            i11 = activity.checkPermission("android.permission.ACCESS_FINE_LOCATION", Process.myPid(), Process.myUid());
        } catch (Throwable unused2) {
            s3.a.z("checkSelfPermission failed, returning PERMISSION_DENIED");
        }
        if (i10 == 0 || i11 == 0) {
            return;
        }
        ArrayList arrayList = new ArrayList();
        try {
            List asList = Arrays.asList(activity.getPackageManager().getPackageInfo(activity.getPackageName(), 4096).requestedPermissions);
            if (asList.contains("android.permission.ACCESS_FINE_LOCATION")) {
                arrayList.add("android.permission.ACCESS_FINE_LOCATION");
            } else if (asList.contains("android.permission.ACCESS_COARSE_LOCATION")) {
                arrayList.add("android.permission.ACCESS_COARSE_LOCATION");
            }
            if (arrayList.size() > 0) {
                activity.requestPermissions((String[]) arrayList.toArray(new String[0]), 123);
            }
        } catch (PackageManager.NameNotFoundException e10) {
            StringBuilder w10 = aa.p.w("Error: ");
            w10.append(e10.getMessage());
            throw new Exception(w10.toString());
        }
    }

    @Override
    public final void j(String str) {
        Uri parse;
        WebView webView = this.f13488b.get();
        if (webView == null || str == null || (parse = Uri.parse(str)) == null) {
            return;
        }
        webView.post(new v(this, parse, webView, 1));
    }
}