Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft of possible api change #6137

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions firebase-crashlytics/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ package com.google.firebase.crashlytics {
public class FirebaseCrashlytics {
method @NonNull public com.google.android.gms.tasks.Task<java.lang.Boolean> checkForUnsentReports();
method public void deleteUnsentReports();
method public boolean didCrashOnPreviousExecution();
method @Deprecated @Discouraged(message="May not be current. Use didCrashOnPreviousRun instead.") public boolean didCrashOnPreviousExecution();
method public com.google.android.gms.tasks.Task<java.lang.Boolean> didCrashOnPreviousRun();
method @NonNull public static com.google.firebase.crashlytics.FirebaseCrashlytics getInstance();
method public com.google.android.gms.tasks.Task<java.lang.Boolean> isCrashlyticsCollectionEnabled();
method public void log(@NonNull String);
method public void recordException(@NonNull Throwable);
method public void sendUnsentReports();
method public boolean isCrashlyticsCollectionEnabled();
method public void setCrashlyticsCollectionEnabled(boolean);
method public void setCrashlyticsCollectionEnabled(@Nullable Boolean);
method public void setCustomKey(@NonNull String, boolean);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import android.content.Context;
import android.content.pm.PackageManager;
import androidx.annotation.Discouraged;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
Expand Down Expand Up @@ -430,23 +431,35 @@ public void deleteUnsentReports() {
/**
* Checks whether the app crashed on its previous run.
*
* @return true if a crash was recorded during the previous run of the app.
* @return true if a crash was recorded during the previous run of the app. May not be current.
* @deprecated May not be current. Use didCrashOnPreviousRun instead. Will be removed in Q2 2025.
*/
@Discouraged(message = "May not be current. Use didCrashOnPreviousRun instead.")
@Deprecated
public boolean didCrashOnPreviousExecution() {
return core.didCrashOnPreviousExecution();
}

/**
* Checks whether the app crashed on its previous run.
*
* @return A Task that resolves to true if a crash was recorded during the previous run of the app
*/
public Task<Boolean> didCrashOnPreviousRun() {
return core.didCrashOnPreviousRun();
}

/**
* Indicates whether or not automatic data collection is enabled
*
* @return In order of priority:
* @return A Task that resolved in order of priority:
* <p>If {@link #setCrashlyticsCollectionEnabled(boolean)} is called with a value, use it
* <p>If the <b>firebase_crashlytics_collection_enabled</b> key is in your app’s
* AndroidManifest.xml, use it
* <p>Otherwise, use the default {@link FirebaseApp#isDataCollectionDefaultEnabled()} in
* FirebaseApp
*/
public boolean isCrashlyticsCollectionEnabled() {
public Task<Boolean> isCrashlyticsCollectionEnabled() {
return core.isCrashlyticsCollectionEnabled();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,9 @@ private Task<Void> doBackgroundInitialization(SettingsProvider settingsProvider)

// endregion

public boolean isCrashlyticsCollectionEnabled() {
return dataCollectionArbiter.isAutomaticDataCollectionEnabled();
public Task<Boolean> isCrashlyticsCollectionEnabled() {
// TODO(mrober): Does Unity or Flutter call this method?
return Tasks.forResult(dataCollectionArbiter.isAutomaticDataCollectionEnabled());
}

public void setCrashlyticsCollectionEnabled(@Nullable Boolean enabled) {
Expand Down Expand Up @@ -514,10 +515,16 @@ private void checkForPreviousCrash() {
didCrashOnPreviousExecution = Boolean.TRUE.equals(result);
}

@Deprecated
public boolean didCrashOnPreviousExecution() {
// TODO(mrober): Is this boolean always accurate?
return didCrashOnPreviousExecution;
}

public Task<Boolean> didCrashOnPreviousRun() {
return Tasks.forResult(didCrashOnPreviousExecution);
}

// endregion

// region Static utilities
Expand Down
Loading