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
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

## [15.0.2](https://github.com/Instabug/Instabug-Flutter/compare/v14.3.0...15.0.2) (Jul 7, 2025)
## [Unreleased](https://github.com/Instabug/Instabug-Flutter/compare/v15.0.2...dev)

### Added

- Add new APIs to support NDK Crashes. ([#607](https://github.com/Instabug/Instabug-Flutter/pull/607))

## [15.0.2](https://github.com/Instabug/Instabug-Flutter/compare/v14.3.0...15.0.2) (Jul 7, 2025)

### Added

Expand All @@ -20,7 +26,6 @@

- Bump Instabug Android SDK to v14.3.1 ([#577](https://github.com/Instabug/Instabug-Flutter/pull/577)). [See release notes](https://github.com/Instabug/Instabug-Android/releases/tag/v14.3.1).


## [14.3.0](https://github.com/Instabug/Instabug-Flutter/compare/v14.1.0...14.3.0) (April 21, 2025)

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,12 @@ public void sendNonFatalError(@NonNull String jsonCrash, @Nullable Map<String, S
}
}

@Override
public void setNDKEnabled(@NonNull Boolean isEnabled) {
if (isEnabled) {
CrashReporting.setNDKCrashesState(Feature.State.ENABLED);
} else {
CrashReporting.setNDKCrashesState(Feature.State.DISABLED);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,22 @@ public void testSendNonFatalError() {

reflected.verify(() -> MockReflected.crashReportException(any(JSONObject.class), eq(isHandled), eq(expectedUserAttributes), eq(expectedFingerprint), eq(expectedLevel)));
}

@Test
public void testSetNDKEnabledGivenTrue() {
boolean isEnabled = true;

api.setNDKEnabled(isEnabled);

mCrashReporting.verify(() -> CrashReporting.setNDKCrashesState(Feature.State.ENABLED));
}

@Test
public void testSetNDKEnabledGivenFalse() {
boolean isEnabled = false;

api.setNDKEnabled(isEnabled);

mCrashReporting.verify(() -> CrashReporting.setNDKCrashesState(Feature.State.DISABLED));
}
}
5 changes: 5 additions & 0 deletions ios/Classes/Modules/CrashReportingApi.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ - (void)sendNonFatalErrorJsonCrash:(nonnull NSString *)jsonCrash userAttributes:
userAttributes:userAttributes];

}

- (void)setNDKEnabledIsEnabled:(nonnull NSNumber *)isEnabled error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error {
// This is auto-generated with pigeon, there is no NDK crashes for iOS.
}

@end
10 changes: 10 additions & 0 deletions lib/src/modules/crash_reporting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,14 @@ class CrashReporting {
);
return crashData;
}

/// Enables and disables NDK crash reporting.
/// [boolean] isEnabled
///
/// Requires the [Instabug NDK package](https://pub.dev/packages/instabug_flutter_ndk) to be added to the project for this to work.
///
/// This method is Android-only and has no effect on iOS.
static Future<void> setNDKEnabled(bool isEnabled) async {
return _host.setNDKEnabled(isEnabled);
}
}
2 changes: 2 additions & 0 deletions pigeons/crash_reporting.api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ abstract class CrashReportingHostApi {
String? fingerprint,
String nonFatalExceptionLevel,
);

void setNDKEnabled(bool isEnabled);
}
10 changes: 10 additions & 0 deletions test/crash_reporting_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,14 @@ void main() {
).called(1);
}
});

test('[setNDKEnabled] should call host method', () async {
const enabled = true;

await CrashReporting.setNDKEnabled(enabled);

verify(
mHost.setNDKEnabled(enabled),
).called(1);
});
}