Search in sources :

Example 1 with CrashlyticsReport

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

the class DataTransportCrashlyticsReportSender method sendReport.

public Task<CrashlyticsReportWithSessionId> sendReport(CrashlyticsReportWithSessionId reportWithSessionId) {
    CrashlyticsReport report = reportWithSessionId.getReport();
    TaskCompletionSource<CrashlyticsReportWithSessionId> tcs = new TaskCompletionSource<>();
    this.transport.schedule(Event.ofUrgent(report), DataTransportCrashlyticsReportSender$$Lambda$1.lambdaFactory$(tcs, reportWithSessionId));
    return tcs.getTask();
}
Also used : TaskCompletionSource(com.google.android.gms.tasks.TaskCompletionSource) CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) CrashlyticsReportWithSessionId(com.google.firebase.crashlytics.internal.common.CrashlyticsReportWithSessionId)

Example 2 with CrashlyticsReport

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

the class CrashlyticsReportJsonTransform method reportFromJson.

public CrashlyticsReport reportFromJson(String json) throws IOException {
    try {
        JsonReader jsonReader = new JsonReader(new StringReader(json));
        CrashlyticsReport parseReport = parseReport(jsonReader);
        jsonReader.close();
        return parseReport;
    } catch (IllegalStateException e) {
        throw new IOException(e);
    }
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) StringReader(java.io.StringReader) JsonReader(android.util.JsonReader) IOException(java.io.IOException)

Example 3 with CrashlyticsReport

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

the class CrashlyticsReportPersistence method synthesizeReportFile.

private static void synthesizeReportFile(File reportFile, File outputDirectory, List<CrashlyticsReport.Session.Event> events, long sessionEndTime, boolean isCrashed, String userId) {
    try {
        CrashlyticsReport report = TRANSFORM.reportFromJson(readTextFile(reportFile)).withSessionEndFields(sessionEndTime, isCrashed, userId).withEvents(ImmutableList.from(events));
        CrashlyticsReport.Session session = report.getSession();
        if (session != null) {
            writeTextFile(new File(prepareDirectory(outputDirectory), session.getIdentifier()), TRANSFORM.reportToJson(report));
        }
    } catch (IOException e) {
        Logger logger = Logger.getLogger();
        logger.d("Could not synthesize final report file for " + reportFile, e);
    }
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) IOException(java.io.IOException) Logger(com.google.firebase.crashlytics.internal.Logger) File(java.io.File)

Example 4 with CrashlyticsReport

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

the class CrashlyticsReportPersistence method persistReport.

public void persistReport(CrashlyticsReport report) {
    CrashlyticsReport.Session session = report.getSession();
    if (session == null) {
        Logger.getLogger().d("Could not get session for report");
        return;
    }
    String sessionId = session.getIdentifier();
    try {
        File sessionDirectory = prepareDirectory(getSessionDirectoryById(sessionId));
        String json = TRANSFORM.reportToJson(report);
        writeTextFile(new File(sessionDirectory, REPORT_FILE_NAME), json);
    } catch (IOException e) {
        Logger logger = Logger.getLogger();
        logger.d("Could not persist report for session " + sessionId, e);
    }
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) IOException(java.io.IOException) Logger(com.google.firebase.crashlytics.internal.Logger) File(java.io.File)

Example 5 with CrashlyticsReport

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

the class CrashlyticsReportPersistence method synthesizeNativeReportFile.

private static void synthesizeNativeReportFile(File reportFile, File outputDirectory, CrashlyticsReport.FilesPayload ndkPayload, String previousSessionId) {
    try {
        CrashlyticsReport report = TRANSFORM.reportFromJson(readTextFile(reportFile)).withNdkPayload(ndkPayload);
        writeTextFile(new File(prepareDirectory(outputDirectory), previousSessionId), TRANSFORM.reportToJson(report));
    } catch (IOException e) {
        Logger logger = Logger.getLogger();
        logger.d("Could not synthesize final native report file for " + reportFile, e);
    }
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) IOException(java.io.IOException) Logger(com.google.firebase.crashlytics.internal.Logger) File(java.io.File)

Aggregations

CrashlyticsReport (com.google.firebase.crashlytics.internal.model.CrashlyticsReport)34 CrashlyticsReportWithSessionId (com.google.firebase.crashlytics.internal.common.CrashlyticsReportWithSessionId)13 Session (com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session)13 Event (com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event)13 IOException (java.io.IOException)8 File (java.io.File)6 Test (org.junit.Test)5 Logger (com.google.firebase.crashlytics.internal.Logger)4 NonNull (androidx.annotation.NonNull)2 TaskCompletionSource (com.google.android.gms.tasks.TaskCompletionSource)2 ArrayList (java.util.ArrayList)2 JsonReader (android.util.JsonReader)1 Settings (com.google.firebase.crashlytics.internal.settings.Settings)1 FeatureFlagData (com.google.firebase.crashlytics.internal.settings.Settings.FeatureFlagData)1 SettingsProvider (com.google.firebase.crashlytics.internal.settings.SettingsProvider)1 StringReader (java.io.StringReader)1