Skip to content

Commit

Permalink
Use PrivateSentrySDKOnly options instead of holding reference (#1097)
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto authored Oct 31, 2022
1 parent 04db237 commit 3e9fb0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
9 changes: 3 additions & 6 deletions flutter/ios/Classes/SentryFlutterPluginApple.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import AppKit
// swiftlint:disable:next type_body_length
public class SentryFlutterPluginApple: NSObject, FlutterPlugin {

private var sentryOptions: Options?

// The Cocoa SDK is init. after the notification didBecomeActiveNotification is registered.
// We need to be able to receive this notification and start a session when the SDK is fully operational.
private var didReceiveDidBecomeActiveNotification = false
Expand Down Expand Up @@ -166,7 +164,7 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin {
infos["user"] = ["id": PrivateSentrySDKOnly.installationID]
}

if let integrations = self.sentryOptions?.integrations {
if let integrations = PrivateSentrySDKOnly.options.integrations {
infos["integrations"] = integrations
}

Expand Down Expand Up @@ -201,8 +199,6 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin {
#endif
}

self.sentryOptions = options

// note : for now, in sentry-cocoa, beforeSend is not called before captureEnvelope
options.beforeSend = { event in
self.setEventOriginTag(event: event)
Expand Down Expand Up @@ -231,7 +227,8 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin {
}

if didReceiveDidBecomeActiveNotification &&
(sentryOptions?.enableAutoSessionTracking == true || sentryOptions?.enableOutOfMemoryTracking == true) {
(PrivateSentrySDKOnly.options.enableAutoSessionTracking ||
PrivateSentrySDKOnly.options.enableOutOfMemoryTracking) {
// We send a SentryHybridSdkDidBecomeActive to the Sentry Cocoa SDK, so the SDK will mimics
// the didBecomeActiveNotification notification. This is needed for session and OOM tracking.
NotificationCenter.default.post(name: Notification.Name("SentryHybridSdkDidBecomeActive"), object: nil)
Expand Down

0 comments on commit 3e9fb0e

Please sign in to comment.