@@ -6,9 +6,9 @@ import Foundation
66 * @note Both name and version are required.
77 * @see https://develop.sentry.dev/sdk/event-payloads/sdk/
88 */
9- @ _spi ( Private ) @ objc public final class SentrySdkInfo : NSObject , SentrySerializable {
9+ final class SentrySdkInfo {
1010
11- @ objc public static func global( ) -> Self {
11+ static func global( ) -> Self {
1212 if let options = SentrySDKInternal . currentHub ( ) . getClient ( ) ? . getOptions ( ) {
1313 let enabledFeatures = SentryDependencyContainerSwiftHelper . enabledFeatures ( options)
1414 return Self ( withEnabledFeatures: enabledFeatures, sendDefaultPii: SentryDependencyContainerSwiftHelper . sendDefaultPii ( options) )
@@ -19,49 +19,49 @@ import Foundation
1919 /**
2020 * The name of the SDK. Examples: sentry.cocoa, sentry.cocoa.vapor, ...
2121 */
22- @ objc public let name : String
22+ let name : String
2323
2424 /**
2525 * The version of the SDK. It should have the Semantic Versioning format MAJOR.MINOR.PATCH, without
2626 * any prefix (no v or anything else in front of the major version number). Examples:
2727 * 0.1.0, 1.0.0, 2.0.0-beta0
2828 */
29- @ objc public let version : String
29+ let version : String
3030
3131 /**
3232 * A list of names identifying enabled integrations. The list should
3333 * have all enabled integrations, including default integrations. Default
3434 * integrations are included because different SDK releases may contain different
3535 * default integrations.
3636 */
37- @ objc public let integrations : [ String ]
37+ let integrations : [ String ]
3838
3939 /**
4040 * A list of feature names identifying enabled SDK features. This list
4141 * should contain all enabled SDK features. On some SDKs, enabling a feature in the
4242 * options also adds an integration. We encourage tracking such features with either
4343 * integrations or features but not both to reduce the payload size.
4444 */
45- @ objc public let features : [ String ]
45+ let features : [ String ]
4646
4747 /**
4848 * A list of packages that were installed as part of this SDK or the
4949 * activated integrations. Each package consists of a name in the format
5050 * source:identifier and version.
5151 */
52- @ objc public let packages : [ [ String : String ] ]
52+ let packages : [ [ String : String ] ]
5353
5454 /**
5555 * A set of settings as part of this SDK.
5656 */
57- @ objc public let settings : SentrySDKSettings
57+ let settings : SentrySDKSettings
5858
59- @ objc public convenience init ( withOptions options: Options ? ) {
59+ convenience init ( withOptions options: Options ? ) {
6060 let features = SentryEnabledFeaturesBuilder . getEnabledFeatures ( options: options)
6161 self . init ( withEnabledFeatures: features, sendDefaultPii: options? . sendDefaultPii ?? false )
6262 }
6363
64- @ objc public convenience init ( withEnabledFeatures features: [ String ] , sendDefaultPii: Bool ) {
64+ convenience init ( withEnabledFeatures features: [ String ] , sendDefaultPii: Bool ) {
6565 let integrations = SentrySDKInternal . currentHub ( ) . trimmedInstalledIntegrationNames ( )
6666 var packages = SentryExtraPackages . getPackages ( )
6767 let sdkPackage = SentrySdkPackage . global ( )
@@ -77,7 +77,7 @@ import Foundation
7777 settings: SentrySDKSettings ( sendDefaultPii: sendDefaultPii) )
7878 }
7979
80- @ objc public init ( name: String ? , version: String ? , integrations: [ String ] ? , features: [ String ] ? , packages: [ [ String : String ] ] ? , settings: SentrySDKSettings ) {
80+ init ( name: String ? , version: String ? , integrations: [ String ] ? , features: [ String ] ? , packages: [ [ String : String ] ] ? , settings: SentrySDKSettings ) {
8181 self . name = name ?? " "
8282 self . version = version ?? " "
8383 self . integrations = integrations ?? [ ]
@@ -87,40 +87,39 @@ import Foundation
8787 }
8888
8989 // swiftlint:disable cyclomatic_complexity
90- @objc
91- public convenience init ( dict: [ AnyHashable : Any ] ) {
90+ convenience init ( dict: [ AnyHashable : Any ] ? ) {
9291 var name = " "
9392 var version = " "
9493 var integrations = Set < String > ( )
9594 var features = Set < String > ( )
9695 var packages = Set < [ String : String ] > ( )
9796 var settings = SentrySDKSettings ( dict: [ : ] )
9897
99- if let nameValue = dict [ " name " ] as? String {
98+ if let nameValue = dict ? [ " name " ] as? String {
10099 name = nameValue
101100 }
102101
103- if let versionValue = dict [ " version " ] as? String {
102+ if let versionValue = dict ? [ " version " ] as? String {
104103 version = versionValue
105104 }
106105
107- if let integrationArray = dict [ " integrations " ] as? [ Any ] {
106+ if let integrationArray = dict ? [ " integrations " ] as? [ Any ] {
108107 for item in integrationArray {
109108 if let integration = item as? String {
110109 integrations. insert ( integration)
111110 }
112111 }
113112 }
114113
115- if let featureArray = dict [ " features " ] as? [ Any ] {
114+ if let featureArray = dict ? [ " features " ] as? [ Any ] {
116115 for item in featureArray {
117116 if let feature = item as? String {
118117 features. insert ( feature)
119118 }
120119 }
121120 }
122121
123- if let packageArray = dict [ " packages " ] as? [ Any ] {
122+ if let packageArray = dict ? [ " packages " ] as? [ Any ] {
124123 for item in packageArray {
125124 if let package = item as? [ String : Any ] ,
126125 let name = package [ " name " ] as? String ,
@@ -130,7 +129,7 @@ import Foundation
130129 }
131130 }
132131
133- if let settingsDict = dict [ " settings " ] as? NSDictionary {
132+ if let settingsDict = dict ? [ " settings " ] as? NSDictionary {
134133 settings = SentrySDKSettings ( dict: settingsDict)
135134 }
136135
@@ -145,7 +144,7 @@ import Foundation
145144 }
146145 // swiftlint:enable cyclomatic_complexity
147146
148- @ objc public func serialize( ) -> [ String : Any ] {
147+ func serialize( ) -> [ String : Any ] {
149148 [
150149 " name " : self . name,
151150 " version " : self . version,
@@ -156,3 +155,11 @@ import Foundation
156155 ]
157156 }
158157}
158+
159+ @_spi ( Private) @objc public final class SentrySdkInfoObjC : NSObject {
160+
161+ @objc public static func optionsToDict( _ options: Options ) -> [ String : Any ] {
162+ SentrySdkInfo ( withOptions: options) . serialize ( )
163+ }
164+
165+ }
0 commit comments