File tree Expand file tree Collapse file tree 12 files changed +58
-17
lines changed
android/src/main/kotlin/io/sentry/flutter Expand file tree Collapse file tree 12 files changed +58
-17
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,12 @@ class SentryClient {
63
63
final rateLimiter = RateLimiter (options);
64
64
options.transport = HttpTransport (options, rateLimiter);
65
65
}
66
- if (options.spotlight.enabled) {
66
+ // TODO: Web might change soon to use the JS SDK so we can remove it here later on
67
+ final enableSpotlight = (options.spotlight.enabled &&
68
+ (options.platformChecker.isWeb ||
69
+ options.platformChecker.platform.isLinux ||
70
+ options.platformChecker.platform.isWindows));
71
+ if (enableSpotlight) {
67
72
options.transport = SpotlightHttpTransport (options, options.transport);
68
73
}
69
74
return SentryClient ._(options);
Original file line number Diff line number Diff line change @@ -8,14 +8,7 @@ class Spotlight {
8
8
/// The Spotlight Sidecar URL.
9
9
/// Defaults to http://10.0.2.2:8969/stream due to Emulator on Android.
10
10
/// Otherwise defaults to http://localhost:8969/stream.
11
- String url;
11
+ String ? url;
12
12
13
- Spotlight ({required this .enabled, String ? url})
14
- : url = url ?? _defaultSpotlightUrl ();
15
- }
16
-
17
- String _defaultSpotlightUrl () {
18
- return (PlatformChecker ().platform.isAndroid
19
- ? 'http://10.0.2.2:8969/stream'
20
- : 'http://localhost:8969/stream' );
13
+ Spotlight ({required this .enabled, this .url});
21
14
}
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ import '../http_client/client_provider.dart'
8
8
if (dart.library.io) '../http_client/io_client_provider.dart' ;
9
9
10
10
/// Spotlight HTTP transport decorator that sends Sentry envelopes to both Sentry and Spotlight.
11
+ /// This will be used on platforms that do not have native SDK support.
12
+ /// Platforms with native SDK support will configure spotlight directly in the native SDK options.
11
13
class SpotlightHttpTransport extends Transport {
12
14
final SentryOptions _options;
13
15
final Transport _transport;
@@ -21,8 +23,8 @@ class SpotlightHttpTransport extends Transport {
21
23
}
22
24
23
25
SpotlightHttpTransport ._(this ._options, this ._transport)
24
- : _requestHandler = HttpTransportRequestHandler (
25
- _options, Uri .parse (_options.spotlight.url));
26
+ : _requestHandler = HttpTransportRequestHandler (_options,
27
+ Uri .parse (_options.spotlight.url ?? _defaultSpotlightUrl () ));
26
28
27
29
@override
28
30
Future <SentryId ?> send (SentryEnvelope envelope) async {
@@ -48,3 +50,7 @@ class SpotlightHttpTransport extends Transport {
48
50
target: 'Spotlight' );
49
51
}
50
52
}
53
+
54
+ String _defaultSpotlightUrl () {
55
+ return 'http://localhost:8969/stream' ;
56
+ }
Original file line number Diff line number Diff line change @@ -81,6 +81,12 @@ class SentryFlutter(
81
81
data.getIfNotNull<String >(" proguardUuid" ) {
82
82
options.proguardUuid = it
83
83
}
84
+ data.getIfNotNull<Boolean >(" enableSpotlight" ) {
85
+ options.isEnableSpotlight = it
86
+ }
87
+ data.getIfNotNull<String >(" spotlightUrl" ) {
88
+ options.spotlightConnectionUrl = it
89
+ }
84
90
85
91
val nativeCrashHandling = (data[" enableNativeCrashHandling" ] as ? Boolean ) ? : true
86
92
// nativeCrashHandling has priority over anrEnabled
Original file line number Diff line number Diff line change
1
+ # # This file must *NOT* be checked into Version Control Systems,
2
+ # as it contains information specific to your local configuration.
3
+ #
4
+ # Location of the SDK. This is only used by Gradle.
5
+ # For customization when using a Version Control System, please read the
6
+ # header note.
7
+ # Tue Sep 10 17:20:30 CEST 2024
8
+ sdk.dir =/Users/giancarlobuenaflor/Library/Android/sdk
Original file line number Diff line number Diff line change 8
8
android : allowBackup =" false"
9
9
android : label =" sentry_flutter_example"
10
10
android : icon =" @mipmap/ic_launcher"
11
- android : extractNativeLibs =" true" >
11
+ android : extractNativeLibs =" true"
12
+ android : networkSecurityConfig =" @xml/network" >
12
13
<activity
13
14
android : name =" .MainActivity"
14
15
android : launchMode =" singleTop"
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <network-security-config >
3
+ <domain-config cleartextTrafficPermitted =" true" >
4
+ <!-- Allow cleartext traffic from the emulator to the host machine -->
5
+ <!-- See https://developer.android.com/studio/run/emulator-networking for more details -->
6
+ <domain includeSubdomains =" true" >10.0.2.2</domain >
7
+ </domain-config >
8
+ </network-security-config >
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import UIKit
2
2
import Flutter
3
3
import Sentry
4
4
5
- @UIApplicationMain
5
+ @main
6
6
@objc class AppDelegate : FlutterAppDelegate {
7
7
private let _channel = " example.flutter.sentry.io "
8
8
Original file line number Diff line number Diff line change @@ -90,8 +90,8 @@ Future<void> setupSentry(
90
90
options.maxResponseBodySize = MaxResponseBodySize .always;
91
91
options.navigatorKey = navigatorKey;
92
92
93
- options.experimental.replay.sessionSampleRate = 1.0 ;
94
- options.experimental.replay.onErrorSampleRate = 1.0 ;
93
+ // options.experimental.replay.sessionSampleRate = 1.0;
94
+ // options.experimental.replay.onErrorSampleRate = 1.0;
95
95
96
96
_isIntegrationTest = isIntegrationTest;
97
97
if (_isIntegrationTest) {
Original file line number Diff line number Diff line change @@ -70,6 +70,12 @@ public final class SentryFlutter {
70
70
if let appHangTimeoutIntervalMillis = data [ " appHangTimeoutIntervalMillis " ] as? NSNumber {
71
71
options. appHangTimeoutInterval = appHangTimeoutIntervalMillis. doubleValue / 1000
72
72
}
73
+ if let spotlightUrl = data [ " spotlightUrl " ] as? String {
74
+ options. spotlightUrl = spotlightUrl
75
+ }
76
+ if let enableSpotlight = data [ " enableSpotlight " ] as? Bool {
77
+ options. enableSpotlight = enableSpotlight
78
+ }
73
79
if let proxy = data [ " proxy " ] as? [ String : Any ] {
74
80
guard let host = proxy [ " host " ] as? String ,
75
81
let port = proxy [ " port " ] as? Int ,
You can’t perform that action at this time.
0 commit comments