import { ENABLE_CRASHLYTICS_HINT } from "./crashlytics-common";
import { Application } from '@nativescript/core';
export function sendCrashLog(exception) {
    if (isCrashlyticsAvailable()) {
        com.crashlytics.android.Crashlytics.logException(exception);
    }
}
export function log(msg, tag, priority) {
    if (isCrashlyticsAvailable()) {
        if (tag && priority) {
            com.crashlytics.android.Crashlytics.log(priority, tag, msg);
        }
        else {
            com.crashlytics.android.Crashlytics.log(msg);
        }
    }
}
export function setString(key, value) {
    if (isCrashlyticsAvailable()) {
        com.crashlytics.android.Crashlytics.setString(key, value);
    }
}
export function setBool(key, value) {
    if (isCrashlyticsAvailable()) {
        com.crashlytics.android.Crashlytics.setBool(key, value);
    }
}
export function setFloat(key, value) {
    if (isCrashlyticsAvailable()) {
        com.crashlytics.android.Crashlytics.setFloat(key, value);
    }
}
export function setInt(key, value) {
    if (isCrashlyticsAvailable()) {
        com.crashlytics.android.Crashlytics.setInt(key, value);
    }
}
export function setDouble(key, value) {
    if (isCrashlyticsAvailable()) {
        com.crashlytics.android.Crashlytics.setDouble(key, value);
    }
}
export function setUserId(id) {
    if (isCrashlyticsAvailable()) {
        com.crashlytics.android.Crashlytics.setUserIdentifier(id);
    }
}
export function crash() {
    if (isCrashlyticsAvailable()) {
        com.crashlytics.android.Crashlytics.getInstance().crash();
    }
}
export function setCrashlyticsCollectionEnabled(enabled) {
    if (isCrashlyticsAvailable()) {
        io.fabric.sdk.android.Fabric.with(Application.getNativeApplication(), [new com.crashlytics.android.Crashlytics()]);
    }
}
function isCrashlyticsAvailable() {
    if (typeof (com.crashlytics) === "undefined" || typeof (com.crashlytics.android.Crashlytics) === "undefined") {
        console.log(ENABLE_CRASHLYTICS_HINT);
        return false;
    }
    return true;
}
//# sourceMappingURL=crashlytics.android.js.map