Skip to content

Commit 0dbb666

Browse files
authored
[v9]: remove options.autoAppStart and setAppStartEnd (#2680)
* remove * remove unused code * update CHANGELOG
1 parent 3e1c2c9 commit 0dbb666

File tree

5 files changed

+9
-103
lines changed

5 files changed

+9
-103
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Remove screenshot option `attachScreenshotOnlyWhenResumed` ([#2664](https://github.com/getsentry/sentry-dart/pull/2664))
88
- Remove deprecated `beforeScreenshot` ([#2662](https://github.com/getsentry/sentry-dart/pull/2662))
99
- Remove user segment ([#2687](https://github.com/getsentry/sentry-dart/pull/2687))
10+
- Remove `options.autoAppStart` and `setAppStartEnd` ([#2680](https://github.com/getsentry/sentry-dart/pull/2680))
1011

1112
### Dependencies
1213

flutter/lib/src/integrations/native_app_start_integration.dart

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import 'dart:async';
21
import 'dart:ui';
32

4-
import 'package:meta/meta.dart';
5-
63
import '../../sentry_flutter.dart';
74
import '../frame_callback_handler.dart';
85
import 'native_app_start_handler.dart';
@@ -15,21 +12,7 @@ class NativeAppStartIntegration extends Integration<SentryFlutterOptions> {
1512

1613
final FrameCallbackHandler _frameCallbackHandler;
1714
final NativeAppStartHandler _nativeAppStartHandler;
18-
DateTime? _appStartEnd;
19-
20-
/// This timestamp marks the end of app startup. Either set by calling
21-
// ignore: deprecated_member_use_from_same_package
22-
/// [SentryFlutter.setAppStartEnd]. The [SentryFlutterOptions.autoAppStart]
23-
/// option needs to be false.
24-
@internal
25-
set appStartEnd(DateTime appStartEnd) {
26-
_appStartEnd = appStartEnd;
27-
if (!_appStartEndCompleter.isCompleted) {
28-
_appStartEndCompleter.complete();
29-
}
30-
}
3115

32-
final Completer<void> _appStartEndCompleter = Completer<void>();
3316
bool _allowProcessing = true;
3417

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

4528
try {
46-
DateTime? appStartEnd;
47-
// ignore: deprecated_member_use_from_same_package
48-
if (options.autoAppStart) {
49-
// ignore: invalid_use_of_internal_member
50-
appStartEnd = DateTime.fromMicrosecondsSinceEpoch(timings.first
51-
.timestampInMicroseconds(FramePhase.rasterFinishWallTime));
52-
} else if (_appStartEnd == null) {
53-
await _appStartEndCompleter.future.timeout(
54-
const Duration(seconds: 10),
55-
);
56-
appStartEnd = _appStartEnd;
57-
} else {
58-
appStartEnd = null;
59-
}
60-
if (appStartEnd != null) {
61-
await _nativeAppStartHandler.call(
62-
hub,
63-
options,
64-
appStartEnd: appStartEnd,
65-
);
66-
}
29+
// ignore: invalid_use_of_internal_member
30+
final appStartEnd = DateTime.fromMicrosecondsSinceEpoch(timings.first
31+
.timestampInMicroseconds(FramePhase.rasterFinishWallTime));
32+
await _nativeAppStartHandler.call(
33+
hub,
34+
options,
35+
appStartEnd: appStartEnd,
36+
);
6737
} catch (exception, stackTrace) {
6838
options.logger(
6939
SentryLevel.error,

flutter/lib/src/sentry_flutter.dart

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -222,20 +222,6 @@ mixin SentryFlutter {
222222
};
223223
}
224224

225-
/// Manually set when your app finished startup. Make sure to set
226-
/// [SentryFlutterOptions.autoAppStart] to false on init. The timeout duration
227-
/// for this to work is 10 seconds.
228-
@Deprecated(
229-
'Will be removed in v9. This functionality will not be supported anymore.')
230-
static void setAppStartEnd(DateTime appStartEnd) {
231-
// ignore: invalid_use_of_internal_member
232-
final integrations = Sentry.currentHub.options.integrations
233-
.whereType<NativeAppStartIntegration>();
234-
for (final integration in integrations) {
235-
integration.appStartEnd = appStartEnd;
236-
}
237-
}
238-
239225
static void _setSdk(SentryFlutterOptions options) {
240226
// overwrite sdk info with current flutter sdk
241227
final sdk = SdkVersion(

flutter/lib/src/sentry_flutter_options.dart

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import 'event_processor/screenshot_event_processor.dart';
1212
import 'navigation/time_to_display_tracker.dart';
1313
import 'renderer/renderer.dart';
1414
import 'screenshot/sentry_screenshot_quality.dart';
15-
import 'sentry_flutter.dart';
1615
import 'sentry_privacy_options.dart';
1716
import 'sentry_replay_options.dart';
1817
import 'user_interaction/sentry_user_interaction_widget.dart';
@@ -175,14 +174,6 @@ class SentryFlutterOptions extends SentryOptions {
175174
/// Enable auto performance tracking by default.
176175
bool enableAutoPerformanceTracing = true;
177176

178-
/// Automatically track app start measurement and send it with the
179-
/// first transaction. Set to false when configuring option to disable or if
180-
/// you want to set the end time of app startup manually using
181-
/// [SentryFlutter.setAppStartEnd].
182-
@Deprecated(
183-
'Will be removed in v9. In order to disable app starts disable it via option.removeIntegration(...) instead')
184-
bool autoAppStart = true;
185-
186177
/// Automatically attaches a screenshot when capturing an error or exception.
187178
///
188179
/// Requires adding the [SentryWidget] to the widget tree.

flutter/test/integrations/native_app_start_integration_test.dart

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@TestOn('vm')
22
library;
33

4-
import 'dart:async';
54
import 'dart:core';
65
import 'dart:ui';
76

@@ -115,47 +114,6 @@ void main() {
115114

116115
expect(fixture.frameCallbackHandler.timingsCallback, isNull);
117116
});
118-
119-
test('with disabled auto app start waits until appStartEnd is set',
120-
() async {
121-
// ignore: deprecated_member_use_from_same_package
122-
fixture.options.autoAppStart = false;
123-
124-
fixture.callIntegration();
125-
final timingsCallback = fixture.frameCallbackHandler.timingsCallback!;
126-
timingsCallback([_fakeFrameTiming]);
127-
128-
expect(fixture.nativeAppStartHandler.calls, 0);
129-
130-
final appStartEnd = DateTime.fromMicrosecondsSinceEpoch(50);
131-
fixture.sut.appStartEnd = appStartEnd;
132-
133-
await Future<void>.delayed(Duration(milliseconds: 10));
134-
135-
expect(fixture.frameCallbackHandler.timingsCallback, isNull);
136-
expect(fixture.nativeAppStartHandler.calls, 1);
137-
expect(fixture.nativeAppStartHandler.appStartEnd, appStartEnd);
138-
});
139-
140-
test('with disabled auto app start waits until timeout', () async {
141-
// ignore: deprecated_member_use_from_same_package
142-
fixture.options.autoAppStart = false;
143-
144-
fixture.callIntegration();
145-
final timingsCallback = fixture.frameCallbackHandler.timingsCallback!;
146-
await expectLater(
147-
() => timingsCallback([_fakeFrameTiming]),
148-
throwsA(isA<TimeoutException>()),
149-
);
150-
151-
expect(fixture.nativeAppStartHandler.calls, 0);
152-
153-
await Future<void>.delayed(Duration(seconds: 11));
154-
155-
expect(fixture.frameCallbackHandler.timingsCallback, isNull);
156-
expect(fixture.nativeAppStartHandler.calls, 0);
157-
expect(fixture.nativeAppStartHandler.appStartEnd, null);
158-
});
159117
});
160118
}
161119

0 commit comments

Comments
 (0)