Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Remove screenshot option `attachScreenshotOnlyWhenResumed` ([#2664](https://github.com/getsentry/sentry-dart/pull/2664))
- Remove deprecated `beforeScreenshot` ([#2662](https://github.com/getsentry/sentry-dart/pull/2662))
- Remove user segment ([#2687](https://github.com/getsentry/sentry-dart/pull/2687))
- Remove `options.autoAppStart` and `setAppStartEnd` ([#2680](https://github.com/getsentry/sentry-dart/pull/2680))

### Dependencies

Expand Down
46 changes: 8 additions & 38 deletions flutter/lib/src/integrations/native_app_start_integration.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import 'dart:async';
import 'dart:ui';

import 'package:meta/meta.dart';

import '../../sentry_flutter.dart';
import '../frame_callback_handler.dart';
import 'native_app_start_handler.dart';
Expand All @@ -15,21 +12,7 @@ class NativeAppStartIntegration extends Integration<SentryFlutterOptions> {

final FrameCallbackHandler _frameCallbackHandler;
final NativeAppStartHandler _nativeAppStartHandler;
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
set appStartEnd(DateTime appStartEnd) {
_appStartEnd = appStartEnd;
if (!_appStartEndCompleter.isCompleted) {
_appStartEndCompleter.complete();
}
}

final Completer<void> _appStartEndCompleter = Completer<void>();
bool _allowProcessing = true;

@override
Expand All @@ -43,27 +26,14 @@ class NativeAppStartIntegration extends Integration<SentryFlutterOptions> {
_allowProcessing = false;

try {
DateTime? appStartEnd;
// ignore: deprecated_member_use_from_same_package
if (options.autoAppStart) {
// ignore: invalid_use_of_internal_member
appStartEnd = DateTime.fromMicrosecondsSinceEpoch(timings.first
.timestampInMicroseconds(FramePhase.rasterFinishWallTime));
} else if (_appStartEnd == null) {
await _appStartEndCompleter.future.timeout(
const Duration(seconds: 10),
);
appStartEnd = _appStartEnd;
} else {
appStartEnd = null;
}
if (appStartEnd != null) {
await _nativeAppStartHandler.call(
hub,
options,
appStartEnd: appStartEnd,
);
}
// ignore: invalid_use_of_internal_member
final appStartEnd = DateTime.fromMicrosecondsSinceEpoch(timings.first
.timestampInMicroseconds(FramePhase.rasterFinishWallTime));
await _nativeAppStartHandler.call(
hub,
options,
appStartEnd: appStartEnd,
);
} catch (exception, stackTrace) {
options.logger(
SentryLevel.error,
Expand Down
14 changes: 0 additions & 14 deletions flutter/lib/src/sentry_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,6 @@ 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
.whereType<NativeAppStartIntegration>();
for (final integration in integrations) {
integration.appStartEnd = appStartEnd;
}
}

static void _setSdk(SentryFlutterOptions options) {
// overwrite sdk info with current flutter sdk
final sdk = SdkVersion(
Expand Down
9 changes: 0 additions & 9 deletions flutter/lib/src/sentry_flutter_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import 'event_processor/screenshot_event_processor.dart';
import 'navigation/time_to_display_tracker.dart';
import 'renderer/renderer.dart';
import 'screenshot/sentry_screenshot_quality.dart';
import 'sentry_flutter.dart';
import 'sentry_privacy_options.dart';
import 'sentry_replay_options.dart';
import 'user_interaction/sentry_user_interaction_widget.dart';
Expand Down Expand Up @@ -175,14 +174,6 @@ class SentryFlutterOptions extends SentryOptions {
/// Enable auto performance tracking by default.
bool enableAutoPerformanceTracing = true;

/// Automatically track app start measurement and send it with the
/// 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.
///
/// Requires adding the [SentryWidget] to the widget tree.
Expand Down
42 changes: 0 additions & 42 deletions flutter/test/integrations/native_app_start_integration_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@TestOn('vm')
library;

import 'dart:async';
import 'dart:core';
import 'dart:ui';

Expand Down Expand Up @@ -115,47 +114,6 @@ void main() {

expect(fixture.frameCallbackHandler.timingsCallback, isNull);
});

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();
final timingsCallback = fixture.frameCallbackHandler.timingsCallback!;
timingsCallback([_fakeFrameTiming]);

expect(fixture.nativeAppStartHandler.calls, 0);

final appStartEnd = DateTime.fromMicrosecondsSinceEpoch(50);
fixture.sut.appStartEnd = appStartEnd;

await Future<void>.delayed(Duration(milliseconds: 10));

expect(fixture.frameCallbackHandler.timingsCallback, isNull);
expect(fixture.nativeAppStartHandler.calls, 1);
expect(fixture.nativeAppStartHandler.appStartEnd, appStartEnd);
});

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

fixture.callIntegration();
final timingsCallback = fixture.frameCallbackHandler.timingsCallback!;
await expectLater(
() => timingsCallback([_fakeFrameTiming]),
throwsA(isA<TimeoutException>()),
);

expect(fixture.nativeAppStartHandler.calls, 0);

await Future<void>.delayed(Duration(seconds: 11));

expect(fixture.frameCallbackHandler.timingsCallback, isNull);
expect(fixture.nativeAppStartHandler.calls, 0);
expect(fixture.nativeAppStartHandler.appStartEnd, null);
});
});
}

Expand Down
Loading