Skip to content

Commit

Permalink
add tests and move to flutter options
Browse files Browse the repository at this point in the history
  • Loading branch information
denrase committed Jul 24, 2023
1 parent c62e2a3 commit 3c34d27
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
6 changes: 0 additions & 6 deletions dart/lib/src/sentry_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,6 @@ class SentryOptions {

List<ScopeObserver> get scopeObservers => _scopeObservers;

/// The minimum amount of time an app should be unresponsive to be classified
/// as an App Hanging. The actual amount may be a little longer. Avoid using
/// values lower than 100ms, which may cause a lot of app hangs events being
/// transmitted.
Duration appHangTimeoutInterval = Duration(seconds: 2);

void addScopeObserver(ScopeObserver scopeObserver) {
_scopeObservers.add(scopeObserver);
}
Expand Down
1 change: 0 additions & 1 deletion flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import 'dart:async';
import 'dart:convert';
import 'dart:io' show Platform;

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down
3 changes: 2 additions & 1 deletion flutter/lib/src/integrations/native_sdk_integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class NativeSdkIntegration implements Integration<SentryFlutterOptions> {
'enableAppHangTracking': options.enableAppHangTracking,
'connectionTimeoutMillis': options.connectionTimeout.inMilliseconds,
'readTimeoutMillis': options.readTimeout.inMilliseconds,
'appHangTimeoutIntervalMillis': options.appHangTimeoutInterval.inMilliseconds
'appHangTimeoutIntervalMillis':
options.appHangTimeoutInterval.inMilliseconds,
});

options.sdk.addIntegration('nativeSdkIntegration');
Expand Down
9 changes: 8 additions & 1 deletion flutter/lib/src/sentry_flutter_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,17 @@ class SentryFlutterOptions extends SentryOptions {
bool attachViewHierarchy = false;

/// When enabled, the SDK tracks when the application stops responding for a
/// specific amount of time (default 2s).
/// specific amount of time.
/// Only available on iOS and macOS.
bool enableAppHangTracking = true;

/// The minimum amount of time an app should be unresponsive to be classified
/// as an App Hanging. The actual amount may be a little longer. Avoid using
/// values lower than 100ms, which may cause a lot of app hangs events being
/// transmitted.
/// Only available on iOS and macOS.
Duration appHangTimeoutInterval = Duration(seconds: 2);

/// Connection timeout. This will only be synced to the Android native SDK.
Duration connectionTimeout = Duration(seconds: 5);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void main() {
'enableAppHangTracking': true,
'connectionTimeoutMillis': 5000,
'readTimeoutMillis': 5000,
'appHangTimeoutIntervalMillis': 2000,
});
});

Expand Down Expand Up @@ -100,7 +101,8 @@ void main() {
..captureFailedRequests = false
..enableAppHangTracking = false
..connectionTimeout = Duration(milliseconds: 9001)
..readTimeout = Duration(milliseconds: 9002);
..readTimeout = Duration(milliseconds: 9002)
..appHangTimeoutInterval = Duration(milliseconds: 9003);

options.sdk.addIntegration('foo');
options.sdk.addPackage('bar', '1');
Expand Down Expand Up @@ -143,6 +145,7 @@ void main() {
'enableAppHangTracking': false,
'connectionTimeoutMillis': 9001,
'readTimeoutMillis': 9002,
'appHangTimeoutIntervalMillis': 9003,
});
});

Expand Down

0 comments on commit 3c34d27

Please sign in to comment.