Skip to content
Open
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ jobs:
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Cache gradle
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache konan
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:
uses: gradle/wrapper-validation-action@v1

- name: Cache gradle
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Cache konan
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ jobs:
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Cache gradle
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Cache konan
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ actual class CrashlyticsCallsActual : CrashlyticsCalls {
override fun setUserId(identifier: String) {
FirebaseCrashlytics.getInstance().setUserId(identifier)
}

override fun setCollectionEnabled(enabled: Boolean) {
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(enabled)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ actual class CrashlyticsCallsActual : CrashlyticsCalls {
override fun setUserId(identifier: String) {
FIRCrashlyticsSetUserID(identifier)
}

override fun setCollectionEnabled(enabled: Boolean) {
FIRCrashlyticsSetCollectionEnabled(enabled)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface CrashlyticsCalls {
fun sendFatalException(throwable: Throwable)
fun setCustomValue(key: String, value: Any)
fun setUserId(identifier: String)
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Public API addition lacks KDoc. Please document behavior (default state, when it must be called relative to initialization, effect on pending crash reports) and link to Firebase docs to guide consumers.

Suggested change
fun setUserId(identifier: String)
fun setUserId(identifier: String)
/**
* Enables or disables automatic collection of crash reports.
*
* By default, crash report collection is enabled. Call this method to disable or enable
* collection at runtime. This method should be called as early as possible, before any
* crash events occur, ideally during app initialization.
*
* Disabling collection will prevent new crash reports from being sent to Firebase.
* Pending crash reports that have not yet been sent will remain on the device until
* collection is re-enabled.
*
* For more information, see the Firebase documentation:
* https://firebase.google.com/docs/crashlytics/disable-crash-reporting
*
* @param enabled true to enable crash report collection, false to disable.
*/

Copilot uses AI. Check for mistakes.
fun setCollectionEnabled(enabled: Boolean)
}

expect class CrashlyticsCallsActual() : CrashlyticsCalls
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ object CrashlyticsKotlin {
fun setUserId(identifier: String) {
implementation.setUserId(identifier)
}

fun setCollectionEnabled(enabled: Boolean) {
implementation.setCollectionEnabled(enabled)
}
}

/**
Expand Down Expand Up @@ -54,4 +58,8 @@ internal object EmptyCalls : CrashlyticsCalls {
override fun setUserId(identifier: String) {

}

override fun setCollectionEnabled(enabled: Boolean) {

}
}
7 changes: 7 additions & 0 deletions crashlytics/src/nativeInterop/cinterop/crashlytics.def
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ void FIRCrashlyticsSetUserID(NSString* _Nonnull identifier) {
setUserID(crashlytics, selector, identifier);
}

void FIRCrashlyticsSetCollectionEnabled(BOOL enabled) {
id crashlytics = FIRCrashlyticsInstance();
SEL selector = NSSelectorFromString(@"setCrashlyticsCollectionEnabled:");
void (*setCrashlyticsCollectionEnabled)(id, SEL, BOOL) = FIRMethodForSelector(crashlytics, selector);
setCrashlyticsCollectionEnabled(crashlytics, selector, enabled);
}

void FIRCrashlyticsSetCustomValue(NSString* _Nonnull key, id __nullable value) {
id crashlytics = FIRCrashlyticsInstance();
SEL selector = NSSelectorFromString(@"setCustomValue:forKey:");
Expand Down
Loading