Search in sources :

Example 1 with FeaturesSettingsData

use of com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData in project firebase-android-sdk by firebase.

the class DefaultSettingsJsonTransform method defaultSettings.

/**
 * Creates a new Settings with reasonable default values.
 */
static Settings defaultSettings(CurrentTimeProvider currentTimeProvider) {
    final int settingsVersion = SettingsJsonConstants.SETTINGS_VERSION_DEFAULT;
    final int cacheDuration = SettingsJsonConstants.SETTINGS_CACHE_DURATION_DEFAULT;
    JSONObject empty = new JSONObject();
    final AppSettingsData appData = null;
    final SessionSettingsData settingsData = buildSessionDataFrom(empty);
    final FeaturesSettingsData featureData = buildFeaturesSessionDataFrom(empty);
    final long expiresAtMillis = getExpiresAtFrom(currentTimeProvider, cacheDuration, empty);
    return new SettingsData(expiresAtMillis, appData, settingsData, featureData, settingsVersion, cacheDuration);
}
Also used : AppSettingsData(com.google.firebase.crashlytics.internal.settings.model.AppSettingsData) AppSettingsData(com.google.firebase.crashlytics.internal.settings.model.AppSettingsData) SessionSettingsData(com.google.firebase.crashlytics.internal.settings.model.SessionSettingsData) FeaturesSettingsData(com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData) SettingsData(com.google.firebase.crashlytics.internal.settings.model.SettingsData) JSONObject(org.json.JSONObject) SessionSettingsData(com.google.firebase.crashlytics.internal.settings.model.SessionSettingsData) FeaturesSettingsData(com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData)

Example 2 with FeaturesSettingsData

use of com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData in project firebase-android-sdk by firebase.

the class CrashlyticsControllerRobolectricTest method mockSettingsData.

private void mockSettingsData(boolean collectAnrs) {
    Settings mockSettings = mock(Settings.class);
    when(mockSettingsDataProvider.getSettings()).thenReturn(mockSettings);
    when(mockSettings.getFeaturesData()).thenReturn(new FeaturesSettingsData(true, collectAnrs));
}
Also used : FeaturesSettingsData(com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData) Settings(com.google.firebase.crashlytics.internal.settings.model.Settings)

Example 3 with FeaturesSettingsData

use of com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData in project firebase-android-sdk by firebase.

the class SettingsV3JsonTransform method buildFromJson.

@Override
public SettingsData buildFromJson(CurrentTimeProvider currentTimeProvider, JSONObject json) throws JSONException {
    final int settingsVersion = json.optInt(SettingsJsonConstants.SETTINGS_VERSION, SettingsJsonConstants.SETTINGS_VERSION_DEFAULT);
    final int cacheDuration = json.optInt(SettingsJsonConstants.CACHE_DURATION_KEY, SettingsJsonConstants.SETTINGS_CACHE_DURATION_DEFAULT);
    final AppSettingsData appData = buildAppDataFrom(json.getJSONObject(SettingsJsonConstants.FABRIC_KEY), json.getJSONObject(SettingsJsonConstants.APP_KEY));
    final SessionSettingsData sessionData = defaultSessionData();
    final FeaturesSettingsData featureData = buildFeaturesSessionDataFrom(json.getJSONObject(SettingsJsonConstants.FEATURES_KEY));
    final long expiresAtMillis = getExpiresAtFrom(currentTimeProvider, cacheDuration, json);
    return new SettingsData(expiresAtMillis, appData, sessionData, featureData, settingsVersion, cacheDuration);
}
Also used : AppSettingsData(com.google.firebase.crashlytics.internal.settings.model.AppSettingsData) AppSettingsData(com.google.firebase.crashlytics.internal.settings.model.AppSettingsData) SessionSettingsData(com.google.firebase.crashlytics.internal.settings.model.SessionSettingsData) FeaturesSettingsData(com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData) SettingsData(com.google.firebase.crashlytics.internal.settings.model.SettingsData) SessionSettingsData(com.google.firebase.crashlytics.internal.settings.model.SessionSettingsData) FeaturesSettingsData(com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData)

Example 4 with FeaturesSettingsData

use of com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData in project GreenHouse by utsanjan.

the class DefaultSettingsJsonTransform method defaultSettings.

/* JADX INFO: Access modifiers changed from: package-private */
public static Settings defaultSettings(CurrentTimeProvider currentTimeProvider) {
    JSONObject empty = new JSONObject();
    SessionSettingsData settingsData = buildSessionDataFrom(empty);
    FeaturesSettingsData featureData = buildFeaturesSessionDataFrom(empty);
    long expiresAtMillis = getExpiresAtFrom(currentTimeProvider, 3600L, empty);
    return new SettingsData(expiresAtMillis, null, settingsData, featureData, 0, 3600);
}
Also used : AppSettingsData(com.google.firebase.crashlytics.internal.settings.model.AppSettingsData) SessionSettingsData(com.google.firebase.crashlytics.internal.settings.model.SessionSettingsData) FeaturesSettingsData(com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData) SettingsData(com.google.firebase.crashlytics.internal.settings.model.SettingsData) JSONObject(org.json.JSONObject) SessionSettingsData(com.google.firebase.crashlytics.internal.settings.model.SessionSettingsData) FeaturesSettingsData(com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData)

Example 5 with FeaturesSettingsData

use of com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData in project GreenHouse by utsanjan.

the class DefaultSettingsJsonTransform method buildFromJson.

// com.google.firebase.crashlytics.internal.settings.SettingsJsonTransform
@Override
public SettingsData buildFromJson(CurrentTimeProvider currentTimeProvider, JSONObject json) throws JSONException {
    int settingsVersion = json.optInt("settings_version", 0);
    int cacheDuration = json.optInt("cache_duration", 3600);
    AppSettingsData appData = buildAppDataFrom(json.getJSONObject("app"));
    SessionSettingsData settingsData = buildSessionDataFrom(json.getJSONObject("session"));
    FeaturesSettingsData featureData = buildFeaturesSessionDataFrom(json.getJSONObject("features"));
    long expiresAtMillis = getExpiresAtFrom(currentTimeProvider, cacheDuration, json);
    return new SettingsData(expiresAtMillis, appData, settingsData, featureData, settingsVersion, cacheDuration);
}
Also used : AppSettingsData(com.google.firebase.crashlytics.internal.settings.model.AppSettingsData) AppSettingsData(com.google.firebase.crashlytics.internal.settings.model.AppSettingsData) SessionSettingsData(com.google.firebase.crashlytics.internal.settings.model.SessionSettingsData) FeaturesSettingsData(com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData) SettingsData(com.google.firebase.crashlytics.internal.settings.model.SettingsData) SessionSettingsData(com.google.firebase.crashlytics.internal.settings.model.SessionSettingsData) FeaturesSettingsData(com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData)

Aggregations

FeaturesSettingsData (com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData)7 AppSettingsData (com.google.firebase.crashlytics.internal.settings.model.AppSettingsData)6 SessionSettingsData (com.google.firebase.crashlytics.internal.settings.model.SessionSettingsData)6 SettingsData (com.google.firebase.crashlytics.internal.settings.model.SettingsData)6 JSONObject (org.json.JSONObject)2 Settings (com.google.firebase.crashlytics.internal.settings.model.Settings)1