导航菜单

页面标题

页面副标题

Housing v14.7.8 - f0.java 源代码

正在查看: Housing v14.7.8 应用的 f0.java JAVA 源代码文件

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


package io.branch.referral;

import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.webkit.URLUtil;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.instrumentation.JSONObjectInstrumentation;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.json.JSONException;
import org.json.JSONObject;

@Instrumented
public class f0 {
    static final String BRANCH_BASE_URL_V1 = "https://api.branch.io/";
    static final String BRANCH_BASE_URL_V2 = "https://api2.branch.io/";
    static final String BRANCH_CDN_BASE_URL = "https://cdn.branch.io/";
    static final String BRANCH_EU_BASE_URL_V3 = "https://api3-eu.branch.io/";
    static final int CONNECT_TIMEOUT = 10000;
    static final int DEFAULT_NO_CONNECTION_RETRY_MAX = 3;
    static final long DEFAULT_VALID_WINDOW_FOR_REFERRER_GCLID = 2592000000L;
    private static final int INTERVAL_RETRY = 1000;
    private static final String KEY_ACTIONS = "bnc_actions";
    static final String KEY_AD_NETWORK_CALLOUTS_DISABLED = "bnc_ad_network_callouts_disabled";
    static final String KEY_ANON_ID = "bnc_anon_id";
    private static final String KEY_APP_LINK = "bnc_app_link";
    private static final String KEY_APP_STORE_SOURCE = "bnc_app_store_source";
    private static final String KEY_APP_VERSION = "bnc_app_version";
    private static final String KEY_BRANCH_KEY = "bnc_branch_key";
    private static final String KEY_BRANCH_VIEW_NUM_OF_USE = "bnc_branch_view_use";
    private static final String KEY_CONNECT_TIMEOUT = "bnc_connect_timeout";
    private static final String KEY_DEVICE_FINGERPRINT_ID = "bnc_device_fingerprint_id";
    private static final String KEY_DMA_AD_PERSONALIZATION = "bnc_dma_ad_personalization";
    private static final String KEY_DMA_AD_USER_DATA = "bnc_dma_ad_user_data";
    private static final String KEY_DMA_EEA = "bnc_dma_eea";
    private static final String KEY_EXTERNAL_INTENT_EXTRA = "bnc_external_intent_extra";
    private static final String KEY_EXTERNAL_INTENT_URI = "bnc_external_intent_uri";
    private static final String KEY_GCLID_EXPIRATION_DATE = "bnc_gclid_expiration_date";
    private static final String KEY_GCLID_JSON_OBJECT = "bnc_gclid_json_object";
    private static final String KEY_GCLID_VALID_FOR_WINDOW = "bnc_gclid_expiration_window";
    private static final String KEY_GCLID_VALUE = "bnc_gclid_value";
    private static final String KEY_GOOGLE_PLAY_INSTALL_REFERRER_EXTRA = "bnc_google_play_install_referrer_extras";
    private static final String KEY_GOOGLE_SEARCH_INSTALL_IDENTIFIER = "bnc_google_search_install_identifier";
    private static final String KEY_IDENTITY = "bnc_identity";
    private static final String KEY_IDENTITY_ID = "bnc_identity_id";
    private static final String KEY_INITIAL_REFERRER = "bnc_initial_referrer";
    static final String KEY_INSTALL_BEGIN_TS = "bnc_install_begin_ts";
    private static final String KEY_INSTALL_PARAMS = "bnc_install_params";
    private static final String KEY_INSTALL_REFERRER = "bnc_install_referrer";
    private static final String KEY_IS_FULL_APP_CONVERSION = "bnc_is_full_app_conversion";
    static final String KEY_IS_META_CLICKTHROUGH = "bnc_is_meta_clickthrough";
    static final String KEY_LAST_KNOWN_UPDATE_TIME = "bnc_last_known_update_time";
    private static final String KEY_LAST_READ_SYSTEM = "bnc_system_read_date";
    private static final String KEY_LATD_ATTRIBUTION_WINDOW = "bnc_latd_attributon_window";
    private static final String KEY_LIMIT_FACEBOOK_TRACKING = "bnc_limit_facebook_tracking";
    private static final String KEY_LINK_CLICK_ID = "bnc_link_click_id";
    private static final String KEY_LINK_CLICK_IDENTIFIER = "bnc_link_click_identifier";
    private static final String KEY_LOG_IAP_AS_EVENTS = "bnc_log_iap_as_events";
    private static final String KEY_NO_CONNECTION_RETRY_MAX = "bnc_no_connection_retry_max";
    static final String KEY_ORIGINAL_INSTALL_TIME = "bnc_original_install_time";
    static final String KEY_PREVIOUS_UPDATE_TIME = "bnc_previous_update_time";
    private static final String KEY_PUSH_IDENTIFIER = "bnc_push_identifier";
    private static final String KEY_RANDOMIZED_BUNDLE_TOKEN = "bnc_randomized_bundle_token";
    private static final String KEY_RANDOMIZED_DEVICE_TOKEN = "bnc_randomized_device_token";
    static final String KEY_RANDOMLY_GENERATED_UUID = "bnc_randomly_generated_uuid";
    static final String KEY_REFERRER_CLICK_TS = "bnc_referrer_click_ts";
    static final String KEY_REFERRING_URL_QUERY_PARAMETERS = "bnc_referringUrlQueryParameters";
    private static final String KEY_RETRY_COUNT = "bnc_retry_count";
    private static final String KEY_RETRY_INTERVAL = "bnc_retry_interval";
    private static final String KEY_SESSION_ID = "bnc_session_id";
    private static final String KEY_SESSION_PARAMS = "bnc_session_params";
    private static final String KEY_TASK_TIMEOUT = "bnc_task_timeout";
    private static final String KEY_TIMEOUT = "bnc_timeout";
    private static final String KEY_TOTAL_BASE = "bnc_total_base_";
    static final String KEY_TRACKING_STATE = "bnc_tracking_state";
    private static final String KEY_UNIQUE_BASE = "bnc_balance_base_";
    private static final String KEY_USER_URL = "bnc_user_url";
    private static final int MAX_RETRIES = 3;
    static final long MAX_VALID_WINDOW_FOR_REFERRER_GCLID = 100000000000L;
    static final long MIN_VALID_WINDOW_FOR_REFERRER_GCLID = 0;
    public static final String NO_STRING_VALUE = "bnc_no_value";
    private static final String SHARED_PREF_FILE = "branch_referral_shared_pref";
    private static final String TAG = "BranchSDK";
    static final int TASK_TIMEOUT = 15500;
    static final int TIMEOUT = 5500;
    private static String customCDNBaseURL_ = null;
    private static String customServerURL_ = null;
    private static boolean enableLogging_ = false;
    public static String fbAppId_ = null;
    private static f0 prefHelper_ = null;
    private static boolean useEUEndpoint_ = false;
    private final SharedPreferences appSharedPrefs_;
    private SharedPreferences.Editor prefsEditor_;
    private final JSONObject requestMetadata = new JSONObject();
    private final JSONObject installMetadata = new JSONObject();
    private final JSONObject secondaryRequestMetadata = new JSONObject();
    final m partnerParams_ = new m();

    public f0(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences(SHARED_PREF_FILE, 0);
        this.appSharedPrefs_ = sharedPreferences;
        this.prefsEditor_ = sharedPreferences.edit();
    }

    public static String b() {
        return URLUtil.isHttpsUrl(customServerURL_) ? customServerURL_ : useEUEndpoint_ ? BRANCH_EU_BASE_URL_V3 : BRANCH_BASE_URL_V2;
    }

    public static String d() {
        return !TextUtils.isEmpty(customCDNBaseURL_) ? customCDNBaseURL_ : BRANCH_CDN_BASE_URL;
    }

    public static f0 h(Context context) {
        if (prefHelper_ == null) {
            prefHelper_ = new f0(context);
        }
        return prefHelper_;
    }

    public static void w(String str) {
        customServerURL_ = str;
    }

    public final void A(long j, String str) {
        this.prefsEditor_.putLong(str, j).apply();
    }

    public final void B(JSONObject jSONObject) {
        if (jSONObject.length() == 0) {
            E(KEY_REFERRING_URL_QUERY_PARAMETERS, NO_STRING_VALUE);
        } else {
            E(KEY_REFERRING_URL_QUERY_PARAMETERS, JSONObjectInstrumentation.toString(jSONObject));
        }
    }

    public final void C(String str, String str2) {
        if (this.requestMetadata.has(str) && str2 == null) {
            this.requestMetadata.remove(str);
        }
        try {
            this.requestMetadata.put(str, str2);
        } catch (JSONException unused) {
        }
    }

    public final void D(String str) {
        E(KEY_SESSION_PARAMS, str);
    }

    public final void E(String str, String str2) {
        this.prefsEditor_.putString(str, str2).apply();
    }

    public final void a(String str, String str2) {
        if (str == null) {
            return;
        }
        try {
            this.installMetadata.putOpt(str, str2);
        } catch (JSONException e) {
            l.a(e.getMessage());
        }
    }

    public final boolean c(String str) {
        return this.appSharedPrefs_.getBoolean(str, false);
    }

    public final int e() {
        return this.appSharedPrefs_.getInt(KEY_CONNECT_TIMEOUT, CONNECT_TIMEOUT);
    }

    public final String f(String str) {
        if (str == null) {
            return null;
        }
        try {
            return this.installMetadata.get(str).toString();
        } catch (JSONException e) {
            l.a(e.getMessage());
            return null;
        }
    }

    public final JSONObject g() {
        return this.installMetadata;
    }

    public final long i(String str) {
        return this.appSharedPrefs_.getLong(str, 0L);
    }

    public final String j() {
        String q = q(KEY_RANDOMIZED_BUNDLE_TOKEN);
        return (TextUtils.isEmpty(q) || q.equals(NO_STRING_VALUE)) ? q(KEY_IDENTITY_ID) : q;
    }

    public final String k() {
        String q = q(KEY_RANDOMIZED_DEVICE_TOKEN);
        return (TextUtils.isEmpty(q) || q.equals(NO_STRING_VALUE)) ? q(KEY_DEVICE_FINGERPRINT_ID) : q;
    }

    public final long l() {
        return this.appSharedPrefs_.getLong(KEY_GCLID_VALID_FOR_WINDOW, DEFAULT_VALID_WINDOW_FOR_REFERRER_GCLID);
    }

    public final JSONObject m() {
        String q = q(KEY_REFERRING_URL_QUERY_PARAMETERS);
        JSONObject jSONObject = new JSONObject();
        if (!TextUtils.isEmpty(q) && !NO_STRING_VALUE.equals(q)) {
            try {
                return new JSONObject(q);
            } catch (JSONException e) {
                l.j("Unable to get URL query parameters as string: " + e);
            }
        }
        return jSONObject;
    }

    public final JSONObject n() {
        return this.requestMetadata;
    }

    public final int o() {
        return this.appSharedPrefs_.getInt(KEY_RETRY_COUNT, 3);
    }

    public final int p() {
        return this.appSharedPrefs_.getInt(KEY_RETRY_INTERVAL, INTERVAL_RETRY);
    }

    public final String q(String str) {
        return this.appSharedPrefs_.getString(str, NO_STRING_VALUE);
    }

    public final int r() {
        return this.appSharedPrefs_.getInt(KEY_CONNECT_TIMEOUT, CONNECT_TIMEOUT) + this.appSharedPrefs_.getInt(KEY_TIMEOUT, TIMEOUT);
    }

    public final int s() {
        return this.appSharedPrefs_.getInt(KEY_TIMEOUT, TIMEOUT);
    }

    public final boolean t() {
        return this.appSharedPrefs_.contains(KEY_DMA_EEA);
    }

    public final void u(JSONObject jSONObject) {
        m mVar = this.partnerParams_;
        JSONObject jSONObject2 = new JSONObject();
        for (Map.Entry entry : mVar.a().entrySet()) {
            JSONObject jSONObject3 = new JSONObject();
            for (Map.Entry entry2 : ((ConcurrentHashMap) entry.getValue()).entrySet()) {
                jSONObject3.put((String) entry2.getKey(), entry2.getValue());
            }
            jSONObject2.put((String) entry.getKey(), jSONObject3);
        }
        jSONObject.put(y.PartnerData.getKey(), jSONObject2);
    }

    public final void v() {
        this.prefsEditor_.remove(KEY_GCLID_JSON_OBJECT).apply();
    }

    public final void x(String str) {
        if (q(KEY_BRANCH_KEY).equals(str)) {
            return;
        }
        String q = q(KEY_LINK_CLICK_ID);
        String q2 = q(KEY_LINK_CLICK_IDENTIFIER);
        String q3 = q(KEY_APP_LINK);
        String q4 = q(KEY_PUSH_IDENTIFIER);
        this.prefsEditor_.clear();
        E(KEY_LINK_CLICK_ID, q);
        E(KEY_LINK_CLICK_IDENTIFIER, q2);
        E(KEY_APP_LINK, q3);
        E(KEY_PUSH_IDENTIFIER, q4);
        this.prefsEditor_.apply();
        E(KEY_BRANCH_KEY, str);
        if (f.u() != null) {
            f.u().linkCache_.clear();
            f.u().requestQueue_.c();
        }
    }

    public final void y(boolean z) {
        this.prefsEditor_.putBoolean(KEY_IS_FULL_APP_CONVERSION, z).apply();
    }

    public final void z(boolean z) {
        this.prefsEditor_.putBoolean(KEY_IS_META_CLICKTHROUGH, z).apply();
    }
}