Skip to content

Commit

Permalink
Deprecate autoAppStart and setAppStartEnd (#2681)
Browse files Browse the repository at this point in the history
* deprecate

* update CHANGELOG
  • Loading branch information
buenaflor authored Feb 11, 2025
1 parent 515c540 commit d7dc4e5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Deprecations

- Deprecate `autoAppStart` and `setAppStartEnd` ([#2681](https://github.com/getsentry/sentry-dart/pull/2681))

### Other

- Remove macOS display refresh rate support ([#2628](https://github.com/getsentry/sentry-dart/pull/2628))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class NativeAppStartIntegration extends Integration<SentryFlutterOptions> {
DateTime? _appStartEnd;

/// This timestamp marks the end of app startup. Either set by calling
// ignore: deprecated_member_use_from_same_package
/// [SentryFlutter.setAppStartEnd]. The [SentryFlutterOptions.autoAppStart]
/// option needs to be false.
@internal
Expand All @@ -43,6 +44,7 @@ class NativeAppStartIntegration extends Integration<SentryFlutterOptions> {

try {
DateTime? appStartEnd;
// ignore: deprecated_member_use_from_same_package
if (options.autoAppStart) {
// ignore: invalid_use_of_internal_member
appStartEnd = DateTime.fromMicrosecondsSinceEpoch(timings.first
Expand Down
2 changes: 2 additions & 0 deletions flutter/lib/src/sentry_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ mixin SentryFlutter {
/// Manually set when your app finished startup. Make sure to set
/// [SentryFlutterOptions.autoAppStart] to false on init. The timeout duration
/// for this to work is 10 seconds.
@Deprecated(
'Will be removed in v9. This functionality will not be supported anymore.')
static void setAppStartEnd(DateTime appStartEnd) {
// ignore: invalid_use_of_internal_member
final integrations = Sentry.currentHub.options.integrations
Expand Down
2 changes: 2 additions & 0 deletions flutter/lib/src/sentry_flutter_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ class SentryFlutterOptions extends SentryOptions {
/// first transaction. Set to false when configuring option to disable or if
/// you want to set the end time of app startup manually using
/// [SentryFlutter.setAppStartEnd].
@Deprecated(
'Will be removed in v9. In order to disable app starts disable it via option.removeIntegration(...) instead')
bool autoAppStart = true;

/// Automatically attaches a screenshot when capturing an error or exception.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ void main() {

test('with disabled auto app start waits until appStartEnd is set',
() async {
// ignore: deprecated_member_use_from_same_package
fixture.options.autoAppStart = false;

fixture.callIntegration();
Expand All @@ -137,6 +138,7 @@ void main() {
});

test('with disabled auto app start waits until timeout', () async {
// ignore: deprecated_member_use_from_same_package
fixture.options.autoAppStart = false;

fixture.callIntegration();
Expand Down

0 comments on commit d7dc4e5

Please sign in to comment.