导航菜单

页面标题

页面副标题

CallApp v2.226 - POBDeepLinkUtil.java 源代码

正在查看: CallApp v2.226 应用的 POBDeepLinkUtil.java JAVA 源代码文件

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


package com.pubmatic.sdk.common.utility;

import a1.d0;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.webkit.URLUtil;
import androidx.annotation.NonNull;
import com.pubmatic.sdk.common.log.POBLog;

public class POBDeepLinkUtil {
    private static boolean a(Context context, Uri uri) {
        boolean z;
        if (triggerDeepLink(context, uri.toString(), false)) {
            POBLog.debug("POBDeepLinkUtil", "uri based deep link success!", d0.m(uri, "URL - "));
            return true;
        }
        String[] split = uri.toString().split(";");
        int length = split.length;
        int i = 0;
        while (true) {
            if (i >= length) {
                z = false;
                break;
            }
            String a = a(split[i]);
            if (a != null && triggerDeepLink(context, a, false)) {
                POBLog.debug("POBDeepLinkUtil", "fallback based deep link success!", "Fallback URL - ".concat(a));
                z = true;
                break;
            }
            i++;
        }
        if (!z) {
            for (String str : split) {
                String b = b(str);
                if (b != null && triggerDeepLink(context, b, false)) {
                    POBLog.debug("POBDeepLinkUtil", "package based deep link success!", "Package URL - ".concat(b));
                    return true;
                }
            }
        }
        return z;
    }

    private static String b(String str) {
        try {
            if (!str.contains("package")) {
                return null;
            }
            return "https://play.google.com/store/apps/details?id=" + str.split("=")[1];
        } catch (Exception e) {
            POBLog.error("POBDeepLinkUtil", e.getLocalizedMessage(), new Object[0]);
            return null;
        }
    }

    public static boolean triggerDeepLink(@NonNull Context context, @NonNull String str, boolean z) {
        try {
            Intent intent = new Intent("android.intent.action.VIEW");
            intent.addFlags(268435456);
            if (z) {
                intent.setPackage("com.android.vending");
            }
            intent.setData(Uri.parse(str));
            POBUtils.startActivity(context, intent);
            return true;
        } catch (ActivityNotFoundException unused) {
            POBLog.warn("POBDeepLinkUtil", d0.C("Activity not found for the uri: ", str), new Object[0]);
            return false;
        } catch (Exception e) {
            POBLog.warn("POBDeepLinkUtil", "Error while starting the activity for the uri: %s. Error: %s", str, e.getMessage());
            return false;
        }
    }

    public static boolean validateAndRedirect(Context context, String str) {
        if (str == null || context == null) {
            return false;
        }
        if (POBUtils.isValidPlayStoreUrl(str) || !URLUtil.isValidUrl(str)) {
            return a(context, Uri.parse(str));
        }
        return false;
    }

    private static String a(String str) {
        String str2 = null;
        try {
            if (!str.contains("browser_fallback_url")) {
                return null;
            }
            str2 = str.split("=")[1];
            POBLog.debug("POBDeepLinkUtil", "Fall back url :" + str2, new Object[0]);
            return str2;
        } catch (Exception e) {
            POBLog.error("POBDeepLinkUtil", e.getLocalizedMessage(), new Object[0]);
            return str2;
        }
    }
}