Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor committed Oct 25, 2024
1 parent ef339ab commit 2c6c1c2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
15 changes: 11 additions & 4 deletions flutter/lib/src/integrations/frames_tracking_integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,32 @@ class FramesTrackingIntegration implements Integration<SentryFlutterOptions> {
Future<void> call(Hub hub, SentryFlutterOptions options) async {
_options = options;

void abortInitWith({required String reason}) {
options.logger(SentryLevel.debug, 'Frames tracking disabled: $reason.');
}

if (!options.enableFramesTracking) {
return;
return abortInitWith(reason: 'option enablesFrameTracking is false');
}

if (options.tracesSampleRate == null && options.tracesSampler == null) {
return;
return abortInitWith(reason: 'tracing is disabled');
}

if (!_isCompatibleBinding(WidgetsBinding.instance)) {
return;
return abortInitWith(
reason: 'SentryFlutterWidgetsBinding has not been instantiated');
}

final expectedFrameDuration = await _initializeExpectedFrameDuration();
if (expectedFrameDuration == null) {
return;
return abortInitWith(reason: 'could not fetch display refresh rate');
}

_initializeFrameTracking(options, expectedFrameDuration);
options.sdk.addIntegration('framesTrackingIntegration');
options.logger(SentryLevel.debug,
'Frames tracking successfully initialized with an expected frame duration of ${expectedFrameDuration.inMilliseconds}ms');
}

void _initializeFrameTracking(
Expand Down
1 change: 0 additions & 1 deletion flutter/lib/src/navigation/sentry_navigator_observer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ class SentryNavigatorObserver extends RouteObserver<PageRoute<dynamic>> {
if (enableAutoTransactions) {
_hub.options.sdk.addIntegration('UINavigationTracing');
}

_timeToDisplayTracker = _initializeTimeToDisplayTracker();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ void main() {
}

group('when enableFramesTracking is true', () {
final expectedFrameDuration = Duration(milliseconds: 16);

setUp(() {
sut = fixture.getSut();
sut.resume();
Expand Down

0 comments on commit 2c6c1c2

Please sign in to comment.