Search in sources :

Example 16 with SettingsData

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

the class DefaultSettingsJsonTransformTest method testEmptyIconJsonTransform.

public void testEmptyIconJsonTransform() throws Exception {
    final JSONObject testJson = getTestJSON("no_icon_settings.json");
    final SettingsData settingsData = transform.buildFromJson(mockCurrentTimeProvider, testJson);
    assertEquals(3600010, settingsData.expiresAtMillis);
    assertAppData(settingsData.appData);
    assertSettingsData(settingsData.sessionData);
    assertFeaturesData(settingsData.featuresData);
    verify(mockCurrentTimeProvider).getCurrentTimeMillis();
}
Also used : SessionSettingsData(com.google.firebase.crashlytics.internal.settings.model.SessionSettingsData) AppSettingsData(com.google.firebase.crashlytics.internal.settings.model.AppSettingsData) FeaturesSettingsData(com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData) SettingsData(com.google.firebase.crashlytics.internal.settings.model.SettingsData) JSONObject(org.json.JSONObject)

Example 17 with SettingsData

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

the class DefaultSettingsJsonTransformTest method testToJsonAndBackSurvival.

public void testToJsonAndBackSurvival() throws IOException, JSONException {
    final JSONObject testJson = getTestJSON("default_settings.json");
    final SettingsData settingsData = transform.buildFromJson(mockCurrentTimeProvider, testJson);
    final SettingsData roundtrippedSettingsData = transform.buildFromJson(mockCurrentTimeProvider, transform.toJson(settingsData));
    verifySettingsDataObject(mockCurrentTimeProvider, roundtrippedSettingsData);
}
Also used : SessionSettingsData(com.google.firebase.crashlytics.internal.settings.model.SessionSettingsData) AppSettingsData(com.google.firebase.crashlytics.internal.settings.model.AppSettingsData) FeaturesSettingsData(com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData) SettingsData(com.google.firebase.crashlytics.internal.settings.model.SettingsData) JSONObject(org.json.JSONObject)

Example 18 with SettingsData

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

the class DefaultSettingsJsonTransformTest method testSettingsJsonTransform_customEventTrackingDisabled.

public void testSettingsJsonTransform_customEventTrackingDisabled() throws Exception {
    final JSONObject testJson = getTestJSON("settings_without_custom_event_tracking.json");
    final SettingsData settingsData = transform.buildFromJson(mockCurrentTimeProvider, testJson);
    verifySettingsDataObject(mockCurrentTimeProvider, settingsData);
}
Also used : SessionSettingsData(com.google.firebase.crashlytics.internal.settings.model.SessionSettingsData) AppSettingsData(com.google.firebase.crashlytics.internal.settings.model.AppSettingsData) FeaturesSettingsData(com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData) SettingsData(com.google.firebase.crashlytics.internal.settings.model.SettingsData) JSONObject(org.json.JSONObject)

Example 19 with SettingsData

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

the class DefaultSettingsJsonTransform 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.APP_KEY));
    final SessionSettingsData settingsData = buildSessionDataFrom(json.getJSONObject(SettingsJsonConstants.SESSION_KEY));
    final FeaturesSettingsData featureData = buildFeaturesSessionDataFrom(json.getJSONObject(SettingsJsonConstants.FEATURES_KEY));
    final 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

SettingsData (com.google.firebase.crashlytics.internal.settings.model.SettingsData)19 AppSettingsData (com.google.firebase.crashlytics.internal.settings.model.AppSettingsData)18 FeaturesSettingsData (com.google.firebase.crashlytics.internal.settings.model.FeaturesSettingsData)15 SessionSettingsData (com.google.firebase.crashlytics.internal.settings.model.SessionSettingsData)15 JSONObject (org.json.JSONObject)15 JSONException (org.json.JSONException)3 Task (com.google.android.gms.tasks.Task)2 TaskCompletionSource (com.google.android.gms.tasks.TaskCompletionSource)2 NonNull (androidx.annotation.NonNull)1