diff --git a/.github/workflows/flutter_integration_test.yml b/.github/workflows/flutter_test.yml similarity index 65% rename from .github/workflows/flutter_integration_test.yml rename to .github/workflows/flutter_test.yml index 37c071bd02..375db90f57 100644 --- a/.github/workflows/flutter_integration_test.yml +++ b/.github/workflows/flutter_test.yml @@ -1,14 +1,15 @@ -name: flutter integration tests +name: flutter native & integration test on: - # Currently broken, enable after fixing - workflow_dispatch - # push: - # branches: - # - main - # - release/** - # pull_request: - # paths-ignore: - # - 'file/**' + push: + branches: + - main + - release/** + pull_request: + paths-ignore: + - 'file/**' + +env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} jobs: cancel-previous-workflow: @@ -73,6 +74,22 @@ jobs: profile: Nexus 6 script: echo 'Generated AVD snapshot for caching.' + - name: build apk + working-directory: ./flutter/example/android + run: flutter build apk --debug + + - name: launch android emulator & run android native test + uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b #pin@v2.28.0 + with: + working-directory: ./flutter/example/android + api-level: 21 + force-avd-creation: false + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + arch: x86_64 + profile: Nexus 6 + script: ./gradlew testDebugUnitTest + - name: launch android emulator & run android integration test uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b #pin@v2.28.0 with: @@ -110,10 +127,26 @@ jobs: - name: flutter pub get run: flutter pub get + - name: pod install + working-directory: ./flutter/example/ios + run: pod install + - name: launch ios simulator + id: sim run: | simulator_id=$(xcrun simctl create sentryPhone com.apple.CoreSimulator.SimDeviceType.iPhone-14 com.apple.CoreSimulator.SimRuntime.iOS-16-2) + echo "SIMULATOR_ID=${simulator_id}" >> "$GITHUB_OUTPUT" xcrun simctl boot ${simulator_id} +# Disable flutter integration tests because of flaky execution +# - name: run ios integration test +# env: +# SIMULATOR_ID: ${{ steps.sim.outputs.SIMULATOR_ID }} +# run: flutter test -d "$SIMULATOR_ID" integration_test/integration_test.dart --verbose + + - name: run ios native test + working-directory: ./flutter/example/ios + env: + SIMULATOR_ID: ${{ steps.sim.outputs.SIMULATOR_ID }} + run: xcodebuild test -workspace Runner.xcworkspace -scheme Runner -configuration Debug -destination "platform=iOS Simulator,id=$SIMULATOR_ID" -allowProvisioningUpdates CODE_SIGNING_ALLOWED=NO + - - name: run ios integration test - run: flutter test integration_test/integration_test.dart --verbose diff --git a/flutter/android/build.gradle b/flutter/android/build.gradle index 5e40acda85..6773e4fd96 100644 --- a/flutter/android/build.gradle +++ b/flutter/android/build.gradle @@ -62,4 +62,7 @@ android { dependencies { api 'io.sentry:sentry-android:6.28.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + + // Required -- JUnit 4 framework + testImplementation "junit:junit:4.13.2" } diff --git a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutter.kt b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutter.kt new file mode 100644 index 0000000000..962414c6a9 --- /dev/null +++ b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutter.kt @@ -0,0 +1,129 @@ +package io.sentry.flutter + +import io.sentry.SentryLevel +import io.sentry.android.core.BuildConfig +import io.sentry.android.core.SentryAndroidOptions +import io.sentry.protocol.SdkVersion +import java.util.Locale + +class SentryFlutter( + private val androidSdk: String, + private val nativeSdk: String +) { + + var autoPerformanceTracingEnabled = false + + fun updateOptions(options: SentryAndroidOptions, data: Map) { + data.getIfNotNull("dsn") { + options.dsn = it + } + data.getIfNotNull("debug") { + options.isDebug = it + } + data.getIfNotNull("environment") { + options.environment = it + } + data.getIfNotNull("release") { + options.release = it + } + data.getIfNotNull("dist") { + options.dist = it + } + data.getIfNotNull("enableAutoSessionTracking") { + options.isEnableAutoSessionTracking = it + } + data.getIfNotNull("autoSessionTrackingIntervalMillis") { + options.sessionTrackingIntervalMillis = it + } + data.getIfNotNull("anrTimeoutIntervalMillis") { + options.anrTimeoutIntervalMillis = it + } + data.getIfNotNull("attachThreads") { + options.isAttachThreads = it + } + data.getIfNotNull("attachStacktrace") { + options.isAttachStacktrace = it + } + data.getIfNotNull("enableAutoNativeBreadcrumbs") { + options.isEnableActivityLifecycleBreadcrumbs = it + options.isEnableAppLifecycleBreadcrumbs = it + options.isEnableSystemEventBreadcrumbs = it + options.isEnableAppComponentBreadcrumbs = it + options.isEnableUserInteractionBreadcrumbs = it + } + data.getIfNotNull("maxBreadcrumbs") { + options.maxBreadcrumbs = it + } + data.getIfNotNull("maxCacheItems") { + options.maxCacheItems = it + } + data.getIfNotNull("diagnosticLevel") { + if (options.isDebug) { + val sentryLevel = SentryLevel.valueOf(it.toUpperCase(Locale.ROOT)) + options.setDiagnosticLevel(sentryLevel) + } + } + data.getIfNotNull("anrEnabled") { + options.isAnrEnabled = it + } + data.getIfNotNull("sendDefaultPii") { + options.isSendDefaultPii = it + } + data.getIfNotNull("enableNdkScopeSync") { + options.isEnableScopeSync = it + } + data.getIfNotNull("proguardUuid") { + options.proguardUuid = it + } + + val nativeCrashHandling = (data["enableNativeCrashHandling"] as? Boolean) ?: true + // nativeCrashHandling has priority over anrEnabled + if (!nativeCrashHandling) { + options.isEnableUncaughtExceptionHandler = false + options.isAnrEnabled = false + // if split symbols are enabled, we need Ndk integration so we can't really offer the option + // to turn it off + // options.isEnableNdk = false + } + + data.getIfNotNull("enableAutoPerformanceTracing") { enableAutoPerformanceTracing -> + if (enableAutoPerformanceTracing) { + autoPerformanceTracingEnabled = true + } + } + + data.getIfNotNull("sendClientReports") { + options.isSendClientReports = it + } + + data.getIfNotNull("maxAttachmentSize") { + options.maxAttachmentSize = it + } + + var sdkVersion = options.sdkVersion + if (sdkVersion == null) { + sdkVersion = SdkVersion(androidSdk, BuildConfig.VERSION_NAME) + } else { + sdkVersion.name = androidSdk + } + + options.sdkVersion = sdkVersion + options.sentryClientName = "$androidSdk/${BuildConfig.VERSION_NAME}" + options.nativeSdkName = nativeSdk + + data.getIfNotNull("connectionTimeoutMillis") { + options.connectionTimeoutMillis = it + } + data.getIfNotNull("readTimeoutMillis") { + options.readTimeoutMillis = it + } + } +} + +// Call the `completion` closure if cast to map value with `key` and type `T` is successful. +@Suppress("UNCHECKED_CAST") +private fun Map.getIfNotNull(key: String, callback: (T) -> Unit) { + (get(key) as? T)?.let { + callback(it) + } +} diff --git a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt index cc864f7333..9468ed40ff 100644 --- a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt +++ b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt @@ -36,6 +36,7 @@ import java.util.UUID class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { private lateinit var channel: MethodChannel private lateinit var context: Context + private lateinit var sentryFlutter: SentryFlutter private var activity: WeakReference? = null private var framesTracker: ActivityFramesTracker? = null @@ -45,6 +46,11 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { context = flutterPluginBinding.applicationContext channel = MethodChannel(flutterPluginBinding.binaryMessenger, "sentry_flutter") channel.setMethodCallHandler(this) + + sentryFlutter = SentryFlutter( + androidSdk = androidSdk, + nativeSdk = nativeSdk + ) } override fun onMethodCall(call: MethodCall, result: Result) { @@ -119,79 +125,13 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { } SentryAndroid.init(context) { options -> - args.getIfNotNull("dsn") { options.dsn = it } - args.getIfNotNull("debug") { options.isDebug = it } - args.getIfNotNull("environment") { options.environment = it } - args.getIfNotNull("release") { options.release = it } - args.getIfNotNull("dist") { options.dist = it } - args.getIfNotNull("enableAutoSessionTracking") { - options.isEnableAutoSessionTracking = it - } - args.getIfNotNull("autoSessionTrackingIntervalMillis") { - options.sessionTrackingIntervalMillis = it - } - args.getIfNotNull("anrTimeoutIntervalMillis") { - options.anrTimeoutIntervalMillis = it - } - args.getIfNotNull("attachThreads") { options.isAttachThreads = it } - args.getIfNotNull("attachStacktrace") { options.isAttachStacktrace = it } - args.getIfNotNull("enableAutoNativeBreadcrumbs") { - options.isEnableActivityLifecycleBreadcrumbs = it - options.isEnableAppLifecycleBreadcrumbs = it - options.isEnableSystemEventBreadcrumbs = it - options.isEnableAppComponentBreadcrumbs = it - options.isEnableUserInteractionBreadcrumbs = it - } - args.getIfNotNull("maxBreadcrumbs") { options.maxBreadcrumbs = it } - args.getIfNotNull("maxCacheItems") { options.maxCacheItems = it } - args.getIfNotNull("diagnosticLevel") { - if (options.isDebug) { - val sentryLevel = SentryLevel.valueOf(it.toUpperCase(Locale.ROOT)) - options.setDiagnosticLevel(sentryLevel) - } - } - args.getIfNotNull("anrEnabled") { options.isAnrEnabled = it } - args.getIfNotNull("sendDefaultPii") { options.isSendDefaultPii = it } - args.getIfNotNull("enableNdkScopeSync") { options.isEnableScopeSync = it } - args.getIfNotNull("proguardUuid") { options.proguardUuid = it } - - val nativeCrashHandling = (args["enableNativeCrashHandling"] as? Boolean) ?: true - // nativeCrashHandling has priority over anrEnabled - if (!nativeCrashHandling) { - options.isEnableUncaughtExceptionHandler = false - options.isAnrEnabled = false - // if split symbols are enabled, we need Ndk integration so we can't really offer the option - // to turn it off - // options.isEnableNdk = false - } - - args.getIfNotNull("enableAutoPerformanceTracing") { enableAutoPerformanceTracing -> - if (enableAutoPerformanceTracing) { - autoPerformanceTracingEnabled = true - framesTracker = ActivityFramesTracker(LoadClass(), options) - } - } - - args.getIfNotNull("sendClientReports") { options.isSendClientReports = it } + sentryFlutter.updateOptions(options, args) - args.getIfNotNull("maxAttachmentSize") { options.maxAttachmentSize = it } - - var sdkVersion = options.sdkVersion - if (sdkVersion == null) { - sdkVersion = SdkVersion(androidSdk, VERSION_NAME) - } else { - sdkVersion.name = androidSdk + if (sentryFlutter.autoPerformanceTracingEnabled) { + framesTracker = ActivityFramesTracker(LoadClass(), options) } - options.sdkVersion = sdkVersion - options.sentryClientName = "$androidSdk/$VERSION_NAME" - options.nativeSdkName = nativeSdk options.beforeSend = BeforeSendCallbackImpl(options.sdkVersion) - - args.getIfNotNull("connectionTimeoutMillis") { options.connectionTimeoutMillis = it } - args.getIfNotNull("readTimeoutMillis") { options.readTimeoutMillis = it } - - // missing proxy } result.success("") } @@ -455,10 +395,3 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { } } } - -// Call the `completion` closure if cast to map value with `key` and type `T` is successful. -private fun Map.getIfNotNull(key: String, callback: (T) -> Unit) { - (get(key) as? T)?.let { - callback(it) - } -} diff --git a/flutter/android/src/test/kotlin/io/sentry/flutter/SentryFlutterTest.kt b/flutter/android/src/test/kotlin/io/sentry/flutter/SentryFlutterTest.kt new file mode 100644 index 0000000000..3a5c8678f8 --- /dev/null +++ b/flutter/android/src/test/kotlin/io/sentry/flutter/SentryFlutterTest.kt @@ -0,0 +1,139 @@ +package io.sentry.flutter + +import io.sentry.SentryLevel +import io.sentry.android.core.BuildConfig +import io.sentry.android.core.SentryAndroidOptions +import org.junit.Assert.assertEquals +import org.junit.Before +import org.junit.Test + +class SentryFlutterTest { + + private lateinit var fixture: Fixture + + @Before + fun before() { + fixture = Fixture() + } + + @Test + fun updateOptions() { + // Given + val sut = fixture.getSut() + + // When + sut.updateOptions(fixture.options, fixture.data) + + // Then + assertEquals("fixture-dsn", fixture.options.dsn) + assertEquals(true, fixture.options.isDebug) + assertEquals("fixture-environment", fixture.options.environment) + assertEquals("fixture-release", fixture.options.release) + assertEquals("fixture-dist", fixture.options.dist) + assertEquals(false, fixture.options.isEnableAutoSessionTracking) + assertEquals(9001L, fixture.options.sessionTrackingIntervalMillis) + assertEquals(9002L, fixture.options.anrTimeoutIntervalMillis) + assertEquals(true, fixture.options.isAttachThreads) + assertEquals(false, fixture.options.isAttachStacktrace) + assertEquals(false, fixture.options.isEnableActivityLifecycleBreadcrumbs) + assertEquals(false, fixture.options.isEnableAppLifecycleBreadcrumbs) + assertEquals(false, fixture.options.isEnableSystemEventBreadcrumbs) + assertEquals(false, fixture.options.isEnableAppComponentBreadcrumbs) + assertEquals(false, fixture.options.isEnableUserInteractionBreadcrumbs) + assertEquals(9003, fixture.options.maxBreadcrumbs) + assertEquals(9004, fixture.options.maxCacheItems) + assertEquals(false, fixture.options.isAnrEnabled) + assertEquals(true, fixture.options.isSendDefaultPii) + assertEquals(false, fixture.options.isEnableScopeSync) + assertEquals("fixture-proguardUuid", fixture.options.proguardUuid) + assertEquals(false, fixture.options.isSendClientReports) + assertEquals(9005L, fixture.options.maxAttachmentSize) + + assertEquals("sentry.java.android.flutter", fixture.options.sdkVersion?.name) + assertEquals(BuildConfig.VERSION_NAME, fixture.options.sdkVersion?.version) + assertEquals( + "sentry.java.android.flutter/${BuildConfig.VERSION_NAME}", + fixture.options.sentryClientName + ) + assertEquals("fixture-nativeSdk", fixture.options.nativeSdkName) + + assertEquals(true, sut.autoPerformanceTracingEnabled) + + assertEquals(9006, fixture.options.connectionTimeoutMillis) + assertEquals(9007, fixture.options.readTimeoutMillis) + } + + @Test + fun initNativeSdkDiagnosticLevel() { + // Given + val sut = fixture.getSut() + fixture.options.isDebug = true + + // When + sut.updateOptions( + fixture.options, + mapOf( + "diagnosticLevel" to "warning" + ) + ) + + // Then + assertEquals(SentryLevel.WARNING, fixture.options.diagnosticLevel) + } + + @Test + fun initNativeSdkEnableNativeCrashHandling() { + // Given + val sut = fixture.getSut() + + // When + sut.updateOptions( + fixture.options, + mapOf( + "enableNativeCrashHandling" to false + ) + ) + + // Then + assertEquals(false, fixture.options.isEnableUncaughtExceptionHandler) + assertEquals(false, fixture.options.isAnrEnabled) + } +} + +class Fixture { + + var options = SentryAndroidOptions() + + val data = mapOf( + "dsn" to "fixture-dsn", + "debug" to true, + "environment" to "fixture-environment", + "release" to "fixture-release", + "dist" to "fixture-dist", + "enableAutoSessionTracking" to false, + "autoSessionTrackingIntervalMillis" to 9001L, + "anrTimeoutIntervalMillis" to 9002L, + "attachThreads" to true, + "attachStacktrace" to false, + "enableAutoNativeBreadcrumbs" to false, + "maxBreadcrumbs" to 9003, + "maxCacheItems" to 9004, + "anrEnabled" to false, + "sendDefaultPii" to true, + "enableNdkScopeSync" to false, + "proguardUuid" to "fixture-proguardUuid", + "enableNativeCrashHandling" to false, + "sendClientReports" to false, + "maxAttachmentSize" to 9005L, + "enableAutoPerformanceTracing" to true, + "connectionTimeoutMillis" to 9006, + "readTimeoutMillis" to 9007 + ) + + fun getSut(): SentryFlutter { + return SentryFlutter( + androidSdk = "sentry.java.android.flutter", + nativeSdk = "fixture-nativeSdk" + ) + } +} diff --git a/flutter/config/detekt-bl.xml b/flutter/config/detekt-bl.xml index c8da2b8940..bf2e55e08b 100644 --- a/flutter/config/detekt-bl.xml +++ b/flutter/config/detekt-bl.xml @@ -3,8 +3,8 @@ ComplexMethod:SentryFlutterPlugin.kt$SentryFlutterPlugin$override fun onMethodCall(call: MethodCall, result: Result) - ComplexMethod:SentryFlutterPlugin.kt$SentryFlutterPlugin$private fun setUser(user: Map<String, Any?>?, result: Result) - LongMethod:SentryFlutterPlugin.kt$SentryFlutterPlugin$private fun initNativeSdk(call: MethodCall, result: Result) + CyclomaticComplexMethod:SentryFlutterPlugin.kt$SentryFlutterPlugin$override fun onMethodCall(call: MethodCall, result: Result) + LongMethod:SentryFlutter.kt$SentryFlutter$fun updateOptions(options: SentryAndroidOptions, data: Map<String, Any>) MagicNumber:MainActivity.kt$MainActivity$6_000 TooGenericExceptionCaught:MainActivity.kt$MainActivity$e: Exception TooGenericExceptionThrown:MainActivity.kt$MainActivity$throw Exception("Catch this java exception thrown from Kotlin thread!") diff --git a/flutter/example/android/build.gradle b/flutter/example/android/build.gradle index 71b614b7a1..e628374358 100644 --- a/flutter/example/android/build.gradle +++ b/flutter/example/android/build.gradle @@ -1,5 +1,6 @@ buildscript { ext.kotlin_version = '1.6.21' + repositories { google() mavenCentral() @@ -31,3 +32,4 @@ subprojects { tasks.register("clean", Delete) { delete rootProject.buildDir } + diff --git a/flutter/example/integration_test/integration_test.dart b/flutter/example/integration_test/integration_test.dart index ae42ae3945..c4c71edb41 100644 --- a/flutter/example/integration_test/integration_test.dart +++ b/flutter/example/integration_test/integration_test.dart @@ -10,9 +10,9 @@ import 'package:sentry_flutter_example/main.dart'; import 'package:http/http.dart'; void main() { - const org = 'sentry-sdks'; - const slug = 'sentry-flutter'; - const authToken = String.fromEnvironment('SENTRY_AUTH_TOKEN'); + // const org = 'sentry-sdks'; + // const slug = 'sentry-flutter'; + // const authToken = String.fromEnvironment('SENTRY_AUTH_TOKEN'); const fakeDsn = 'https://abc@def.ingest.sentry.io/1234567'; TestWidgetsFlutterBinding.ensureInitialized(); @@ -141,59 +141,59 @@ void main() { await transaction.finish(); }); - group('e2e', () { - var output = find.byKey(const Key('output')); - late Fixture fixture; - - setUp(() { - fixture = Fixture(); - }); - - testWidgets('captureException', (tester) async { - await setupSentryAndApp(tester, - dsn: exampleDsn, beforeSendCallback: fixture.beforeSend); - - await tester.tap(find.text('captureException')); - await tester.pumpAndSettle(); - - final text = output.evaluate().single.widget as Text; - final id = text.data!; - - final uri = Uri.parse( - 'https://sentry.io/api/0/projects/$org/$slug/events/$id/', - ); - expect(authToken, isNotEmpty); - - final event = await fixture.poll(uri, authToken); - expect(event, isNotNull); - - final sentEvent = fixture.sentEvent; - expect(sentEvent, isNotNull); - - final tags = event!["tags"] as List; - - expect(sentEvent!.eventId.toString(), event["id"]); - expect("_Exception: Exception: captureException", event["title"]); - expect(sentEvent.release, event["release"]["version"]); - expect( - 2, - (tags.firstWhere((e) => e["value"] == sentEvent.environment) as Map) - .length); - expect(sentEvent.fingerprint, event["fingerprint"] ?? []); - expect( - 2, - (tags.firstWhere((e) => e["value"] == SentryLevel.error.name) as Map) - .length); - expect(sentEvent.logger, event["logger"]); - - final dist = tags.firstWhere((element) => element['key'] == 'dist'); - expect('1', dist['value']); - - final environment = - tags.firstWhere((element) => element['key'] == 'environment'); - expect('integration', environment['value']); - }); - }); + // group('e2e', () { + // var output = find.byKey(const Key('output')); + // late Fixture fixture; + // + // setUp(() { + // fixture = Fixture(); + // }); + // + // testWidgets('captureException', (tester) async { + // await setupSentryAndApp(tester, + // dsn: exampleDsn, beforeSendCallback: fixture.beforeSend); + // + // await tester.tap(find.text('captureException')); + // await tester.pumpAndSettle(); + // + // final text = output.evaluate().single.widget as Text; + // final id = text.data!; + // + // final uri = Uri.parse( + // 'https://sentry.io/api/0/projects/$org/$slug/events/$id/', + // ); + // expect(authToken, isNotEmpty); + // + // final event = await fixture.poll(uri, authToken); + // expect(event, isNotNull); + // + // final sentEvent = fixture.sentEvent; + // expect(sentEvent, isNotNull); + // + // final tags = event!["tags"] as List; + // + // expect(sentEvent!.eventId.toString(), event["id"]); + // expect("_Exception: Exception: captureException", event["title"]); + // expect(sentEvent.release, event["release"]["version"]); + // expect( + // 2, + // (tags.firstWhere((e) => e["value"] == sentEvent.environment) as Map) + // .length); + // expect(sentEvent.fingerprint, event["fingerprint"] ?? []); + // expect( + // 2, + // (tags.firstWhere((e) => e["value"] == SentryLevel.error.name) as Map) + // .length); + // expect(sentEvent.logger, event["logger"]); + // + // final dist = tags.firstWhere((element) => element['key'] == 'dist'); + // expect('1', dist['value']); + // + // final environment = + // tags.firstWhere((element) => element['key'] == 'environment'); + // expect('integration', environment['value']); + // }); + // }); } class Fixture { diff --git a/flutter/example/ios/Podfile b/flutter/example/ios/Podfile index 313ea4a153..7b1e6a2394 100644 --- a/flutter/example/ios/Podfile +++ b/flutter/example/ios/Podfile @@ -32,6 +32,12 @@ target 'Runner' do use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + + # Configure test target + target 'RunnerTests' do + inherit! :search_paths + end + end post_install do |installer| diff --git a/flutter/example/ios/Runner.xcodeproj/project.pbxproj b/flutter/example/ios/Runner.xcodeproj/project.pbxproj index b9f077ebb4..29c58327af 100644 --- a/flutter/example/ios/Runner.xcodeproj/project.pbxproj +++ b/flutter/example/ios/Runner.xcodeproj/project.pbxproj @@ -7,16 +7,28 @@ objects = { /* Begin PBXBuildFile section */ + 0E6A6386E49E9527E131F978 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 804FA4C73FD409C61067DA3C /* Pods_RunnerTests.framework */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 15A74CDF250075770078F130 /* Buggy.m in Sources */ = {isa = PBXBuildFile; fileRef = 15A74CDE250075770078F130 /* Buggy.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 4DFA0D3B754F0E702B3CB4B1 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4B1A3E5A486E474A287B9BF /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 92B25CED2A80EB3100884BDF /* SentryFlutterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92B25CEC2A80EB3100884BDF /* SentryFlutterTests.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 92B25CEE2A80EB3100884BDF /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXCopyFilesBuildPhase section */ 9705A1C41CF9048500538489 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; @@ -37,11 +49,15 @@ 15A74CDE250075770078F130 /* Buggy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Buggy.m; sourceTree = ""; }; 38199AEAF0F80C193173BC10 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 3CEA108DF90E0A3E0A377D59 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; 4F22DC026405C7E7F57CEBA6 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 768362D06CA53D13052997C4 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 804FA4C73FD409C61067DA3C /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 92B25CEA2A80EB3100884BDF /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 92B25CEC2A80EB3100884BDF /* SentryFlutterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryFlutterTests.swift; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -50,9 +66,19 @@ 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C4B1A3E5A486E474A287B9BF /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F2579A3BD1D48D0BC33E4ADF /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + FDFDFB8E5235EA47CE65FBC5 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 92B25CE72A80EB3100884BDF /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 0E6A6386E49E9527E131F978 /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 97C146EB1CF9000F007C117D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -70,10 +96,21 @@ 38199AEAF0F80C193173BC10 /* Pods-Runner.debug.xcconfig */, 4F22DC026405C7E7F57CEBA6 /* Pods-Runner.release.xcconfig */, 768362D06CA53D13052997C4 /* Pods-Runner.profile.xcconfig */, + F2579A3BD1D48D0BC33E4ADF /* Pods-RunnerTests.debug.xcconfig */, + FDFDFB8E5235EA47CE65FBC5 /* Pods-RunnerTests.release.xcconfig */, + 3CEA108DF90E0A3E0A377D59 /* Pods-RunnerTests.profile.xcconfig */, ); path = Pods; sourceTree = ""; }; + 92B25CEB2A80EB3100884BDF /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 92B25CEC2A80EB3100884BDF /* SentryFlutterTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -90,6 +127,7 @@ children = ( 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, + 92B25CEB2A80EB3100884BDF /* RunnerTests */, 97C146EF1CF9000F007C117D /* Products */, 2BEB9477FF568D2F04848764 /* Pods */, EDEF7FDEB4F4BFCED18D7311 /* Frameworks */, @@ -100,6 +138,7 @@ isa = PBXGroup; children = ( 97C146EE1CF9000F007C117D /* Runner.app */, + 92B25CEA2A80EB3100884BDF /* RunnerTests.xctest */, ); name = Products; sourceTree = ""; @@ -125,6 +164,7 @@ isa = PBXGroup; children = ( C4B1A3E5A486E474A287B9BF /* Pods_Runner.framework */, + 804FA4C73FD409C61067DA3C /* Pods_RunnerTests.framework */, ); name = Frameworks; sourceTree = ""; @@ -132,6 +172,25 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 92B25CE92A80EB3100884BDF /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 92B25CF32A80EB3100884BDF /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 95EC4C94BEBF8B73E55C82BD /* [CP] Check Pods Manifest.lock */, + 92B25CE62A80EB3100884BDF /* Sources */, + 92B25CE72A80EB3100884BDF /* Frameworks */, + 92B25CE82A80EB3100884BDF /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 92B25CEF2A80EB3100884BDF /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 92B25CEA2A80EB3100884BDF /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 97C146ED1CF9000F007C117D /* Runner */ = { isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; @@ -161,9 +220,14 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; - LastUpgradeCheck = 1300; + LastSwiftUpdateCheck = 1430; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { + 92B25CE92A80EB3100884BDF = { + CreatedOnToolsVersion = 14.3.1; + TestTargetID = 97C146ED1CF9000F007C117D; + }; 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; LastSwiftMigration = 1100; @@ -184,11 +248,19 @@ projectRoot = ""; targets = ( 97C146ED1CF9000F007C117D /* Runner */, + 92B25CE92A80EB3100884BDF /* RunnerTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 92B25CE82A80EB3100884BDF /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 97C146EC1CF9000F007C117D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -239,7 +311,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n"; }; 4D812E05A580E1EFEF066A51 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; @@ -258,6 +330,28 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; + 95EC4C94BEBF8B73E55C82BD /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -271,11 +365,19 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 92B25CE62A80EB3100884BDF /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 92B25CED2A80EB3100884BDF /* SentryFlutterTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 97C146EA1CF9000F007C117D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -288,6 +390,14 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 92B25CEF2A80EB3100884BDF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 92B25CEE2A80EB3100884BDF /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 97C146FA1CF9000F007C117D /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -389,6 +499,90 @@ }; name = Profile; }; + 92B25CF02A80EB3100884BDF /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F2579A3BD1D48D0BC33E4ADF /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 97JCY7859U; + GCC_C_LANGUAGE_STANDARD = gnu11; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 92B25CF12A80EB3100884BDF /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FDFDFB8E5235EA47CE65FBC5 /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 97JCY7859U; + GCC_C_LANGUAGE_STANDARD = gnu11; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 92B25CF22A80EB3100884BDF /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 3CEA108DF90E0A3E0A377D59 /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 97JCY7859U; + GCC_C_LANGUAGE_STANDARD = gnu11; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -562,6 +756,16 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 92B25CF32A80EB3100884BDF /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 92B25CF02A80EB3100884BDF /* Debug */, + 92B25CF12A80EB3100884BDF /* Release */, + 92B25CF22A80EB3100884BDF /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index c87d15a335..0fa7c24eb1 100644 --- a/flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ + + + + SentryFlutter { + return SentryFlutter() + } + } +} diff --git a/flutter/example/macos/Podfile b/flutter/example/macos/Podfile index fe733905db..6feac427ca 100644 --- a/flutter/example/macos/Podfile +++ b/flutter/example/macos/Podfile @@ -1,4 +1,4 @@ -platform :osx, '10.13' +platform :osx, '10.14' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' @@ -36,5 +36,8 @@ end post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_macos_build_settings(target) + target.build_configurations.each do |config| + config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.14' + end end end diff --git a/flutter/example/macos/Runner.xcodeproj/project.pbxproj b/flutter/example/macos/Runner.xcodeproj/project.pbxproj index d74803f7c0..ad9c506c71 100644 --- a/flutter/example/macos/Runner.xcodeproj/project.pbxproj +++ b/flutter/example/macos/Runner.xcodeproj/project.pbxproj @@ -208,8 +208,8 @@ 33CC10E52044A3C60003C045 /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; + LastSwiftUpdateCheck = 1430; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { @@ -412,7 +412,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -492,7 +492,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -539,7 +539,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 152c342968..99a6840afc 100644 --- a/flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ SentryLevel { + switch diagnosticLevel { + case "fatal": + return .fatal + case "error": + return .error + case "debug": + return .debug + case "warning": + return .warning + case "info": + return .info + default: + return .none + } + } +} diff --git a/flutter/ios/Classes/SentryFlutterPluginApple.swift b/flutter/ios/Classes/SentryFlutterPluginApple.swift index f531fda120..5a41c2fcc2 100644 --- a/flutter/ios/Classes/SentryFlutterPluginApple.swift +++ b/flutter/ios/Classes/SentryFlutterPluginApple.swift @@ -39,6 +39,8 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin { registrar.addMethodCallDelegate(instance, channel: channel) } + private lazy var sentryFlutter = SentryFlutter() + private func registerObserver() { NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive), @@ -250,7 +252,7 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin { } SentrySDK.start { options in - self.updateOptions(arguments: arguments, options: options) + self.sentryFlutter.update(options: options, with: arguments) if arguments["enableAutoPerformanceTracing"] as? Bool ?? false { PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = true @@ -307,106 +309,6 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin { result("") } - // swiftlint:disable:next cyclomatic_complexity - private func updateOptions(arguments: [String: Any], options: Options) { - if let dsn = arguments["dsn"] as? String { - options.dsn = dsn - } - - if let isDebug = arguments["debug"] as? Bool { - options.debug = isDebug - } - - if let environment = arguments["environment"] as? String { - options.environment = environment - } - - if let releaseName = arguments["release"] as? String { - options.releaseName = releaseName - } - - if let enableAutoSessionTracking = arguments["enableAutoSessionTracking"] as? Bool { - options.enableAutoSessionTracking = enableAutoSessionTracking - } - - if let attachStacktrace = arguments["attachStacktrace"] as? Bool { - options.attachStacktrace = attachStacktrace - } - - if let diagnosticLevel = arguments["diagnosticLevel"] as? String, options.debug == true { - options.diagnosticLevel = logLevelFrom(diagnosticLevel: diagnosticLevel) - } - - if let sessionTrackingIntervalMillis = arguments["autoSessionTrackingIntervalMillis"] as? UInt { - options.sessionTrackingIntervalMillis = sessionTrackingIntervalMillis - } - - if let dist = arguments["dist"] as? String { - options.dist = dist - } - - if let enableAutoNativeBreadcrumbs = arguments["enableAutoNativeBreadcrumbs"] as? Bool { - options.enableAutoBreadcrumbTracking = enableAutoNativeBreadcrumbs - } - - if let enableNativeCrashHandling = arguments["enableNativeCrashHandling"] as? Bool { - options.enableCrashHandler = enableNativeCrashHandling - } - - if let maxBreadcrumbs = arguments["maxBreadcrumbs"] as? UInt { - options.maxBreadcrumbs = maxBreadcrumbs - } - - if let sendDefaultPii = arguments["sendDefaultPii"] as? Bool { - options.sendDefaultPii = sendDefaultPii - } - - if let maxCacheItems = arguments["maxCacheItems"] as? UInt { - options.maxCacheItems = maxCacheItems - } - - if let enableWatchdogTerminationTracking = arguments["enableWatchdogTerminationTracking"] as? Bool { - options.enableWatchdogTerminationTracking = enableWatchdogTerminationTracking - } - - if let sendClientReports = arguments["sendClientReports"] as? Bool { - options.sendClientReports = sendClientReports - } - - if let maxAttachmentSize = arguments["maxAttachmentSize"] as? UInt { - options.maxAttachmentSize = maxAttachmentSize - } - - if let captureFailedRequests = arguments["captureFailedRequests"] as? Bool { - options.enableCaptureFailedRequests = captureFailedRequests - } - - if let enableAppHangTracking = arguments["enableAppHangTracking"] as? Bool { - options.enableAppHangTracking = enableAppHangTracking - } - - if let appHangTimeoutIntervalMillis = arguments["appHangTimeoutIntervalMillis"] as? UInt { - options.appHangTimeoutInterval = TimeInterval(appHangTimeoutIntervalMillis) / 1000 - } - } - - private func logLevelFrom(diagnosticLevel: String) -> SentryLevel { - switch diagnosticLevel { - case "fatal": - return .fatal - case "error": - return .error - case "debug": - return .debug - case "warning": - return .warning - case "info": - return .info - default: - return .none - } - } - private func setEventOriginTag(event: Event) { guard let sdk = event.sdk else { return diff --git a/flutter/macos/Classes/SentryFlutter.swift b/flutter/macos/Classes/SentryFlutter.swift new file mode 120000 index 0000000000..ea42d8c01c --- /dev/null +++ b/flutter/macos/Classes/SentryFlutter.swift @@ -0,0 +1 @@ +../../ios/Classes/SentryFlutter.swift \ No newline at end of file