导航菜单

页面标题

页面副标题

FanCode v7.24.0 - ClientSettings.java 源代码

正在查看: FanCode v7.24.0 应用的 ClientSettings.java JAVA 源代码文件

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


package com.conviva.api;

import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.instrumentation.LogInstrumentation;
import java.net.MalformedURLException;
import java.net.URL;
import z7.h;

@Instrumented
public class ClientSettings {
    public static final String defaultIPv4ProductionGatewayUrl = "https://%s.ipv4.cws.conviva.com";
    public static final String defaultIPv4TestGatewayUrl = "https://%s.ipv4.testonly.conviva.com";
    public static final String defaultIPv6ProductionGatewayUrl = "https://%s.ipv6.cws.conviva.com";
    public static final String defaultIPv6TestGatewayUrl = "https://%s.ipv6.testonly.conviva.com";
    private static final String defaultProductionC3Domain = "cws.conviva.com";
    public static final String defaultProductionGatewayUrl = "https://cws.conviva.com";
    public static final int defaultProductionHeartbeatInterval = 20;
    private static final String defaultTestOnlyC3Domain = "testonly.conviva.com";
    public String customerKey;
    public String gatewayUrl;
    public String gatewayUrlIPv4;
    public String gatewayUrlIPv6;
    public int heartbeatInterval;
    public String version;

    public ClientSettings(String str) {
        this.customerKey = null;
        this.heartbeatInterval = 20;
        this.gatewayUrl = defaultProductionGatewayUrl;
        this.gatewayUrlIPv4 = defaultIPv4ProductionGatewayUrl;
        this.gatewayUrlIPv6 = defaultIPv6ProductionGatewayUrl;
        if (str == null || str.isEmpty()) {
            LogInstrumentation.e("CONVIVA : ", "SDK NOT ready due to lack of customerKey");
        } else {
            this.customerKey = str;
        }
    }

    private void sanitize() {
        int i9 = this.heartbeatInterval;
        this.heartbeatInterval = 20;
        int a9 = h.a(i9);
        if (a9 == i9) {
            this.heartbeatInterval = a9;
        }
        String str = this.gatewayUrl;
        this.gatewayUrl = "https://" + this.customerKey + "." + defaultProductionC3Domain;
        this.gatewayUrlIPv4 = String.format(defaultIPv4ProductionGatewayUrl, this.customerKey);
        this.gatewayUrlIPv6 = String.format(defaultIPv6ProductionGatewayUrl, this.customerKey);
        if (h.b(str)) {
            try {
                if (!new URL(defaultProductionGatewayUrl).getHost().equals(new URL(str).getHost())) {
                    this.gatewayUrl = str;
                }
                if (new URL(str).getHost().endsWith(defaultTestOnlyC3Domain)) {
                    this.gatewayUrlIPv4 = String.format(defaultIPv4TestGatewayUrl, this.customerKey);
                    this.gatewayUrlIPv6 = String.format(defaultIPv6TestGatewayUrl, this.customerKey);
                }
            } catch (MalformedURLException e9) {
                LogInstrumentation.d("CONVIVA", "sanitize: " + e9.getLocalizedMessage());
            }
        }
    }

    public boolean isInitialized() {
        return this.customerKey != null;
    }

    public ClientSettings(ClientSettings clientSettings) {
        this(clientSettings.customerKey);
        this.gatewayUrl = clientSettings.gatewayUrl;
        this.heartbeatInterval = clientSettings.heartbeatInterval;
        sanitize();
    }
}