Skip to content

Commit 561db82

Browse files
authored
Add more SPI (#5330)
1 parent ec7496f commit 561db82

14 files changed

+9197
-8199
lines changed

Sources/Swift/Core/Helper/SentryBaggageSerialization.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Foundation
22

33
@objcMembers
4-
class SentryBaggageSerialization: NSObject {
4+
@_spi(Private) public class SentryBaggageSerialization: NSObject {
55

66
private static let SENTRY_BAGGAGE_MAX_SIZE = 8_192
77

8-
static func encodeDictionary(_ dictionary: [String: String]) -> String {
8+
public static func encodeDictionary(_ dictionary: [String: String]) -> String {
99
var items: [String] = []
1010
items.reserveCapacity(dictionary.count)
1111

@@ -29,7 +29,7 @@ class SentryBaggageSerialization: NSObject {
2929
return items.sorted().joined(separator: ",")
3030
}
3131

32-
static func decode(_ baggage: String) -> [String: String] {
32+
public static func decode(_ baggage: String) -> [String: String] {
3333
guard !baggage.isEmpty else {
3434
return [:]
3535
}

Sources/Swift/Core/Helper/SentryCurrentDateProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protocol SentryCurrentDateProvider {
3030
Self.getAbsoluteTime()
3131
}
3232

33-
func systemUptime() -> TimeInterval {
33+
public func systemUptime() -> TimeInterval {
3434
ProcessInfo.processInfo.systemUptime
3535
}
3636

Sources/Swift/Core/Integrations/ANR/SentryANRTracker.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22

33
@objc
4-
protocol SentryANRTracker {
4+
@_spi(Private) public protocol SentryANRTracker {
55
@objc(addListener:)
66
func add(listener: SentryANRTrackerDelegate)
77
@objc(removeListener:)

Sources/Swift/Core/Integrations/ANR/SentryANRTrackerV2Delegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import Foundation
22

33
/// The methods are called from a background thread.
44
@objc
5-
protocol SentryANRTrackerDelegate {
5+
@_spi(Private) public protocol SentryANRTrackerDelegate {
66
func anrDetected(type: SentryANRType)
77

88
func anrStopped(result: SentryANRStoppedResult?)
99
}
1010

1111
@objcMembers
12-
class SentryANRStoppedResult: NSObject {
12+
@_spi(Private) public class SentryANRStoppedResult: NSObject {
1313

1414
let minDuration: TimeInterval
1515
let maxDuration: TimeInterval

Sources/Swift/Core/Integrations/ANR/SentryANRType.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22

33
@objc
4-
enum SentryANRType: Int {
4+
@_spi(Private) public enum SentryANRType: Int {
55
case fatalFullyBlocking
66
case fatalNonFullyBlocking
77
case fullyBlocking
@@ -10,7 +10,7 @@ enum SentryANRType: Int {
1010
}
1111

1212
@objc
13-
class SentryAppHangTypeMapper: NSObject {
13+
@_spi(Private) public class SentryAppHangTypeMapper: NSObject {
1414

1515
private enum ExceptionType: String {
1616
case fatalFullyBlocking = "Fatal App Hang Fully Blocked"
@@ -21,7 +21,7 @@ class SentryAppHangTypeMapper: NSObject {
2121
}
2222

2323
@objc
24-
static func getExceptionType(anrType: SentryANRType) -> String {
24+
public static func getExceptionType(anrType: SentryANRType) -> String {
2525
switch anrType {
2626
case .fatalFullyBlocking:
2727
return ExceptionType.fatalFullyBlocking.rawValue
@@ -46,7 +46,7 @@ class SentryAppHangTypeMapper: NSObject {
4646
}
4747

4848
@objc
49-
static func isExceptionTypeAppHang(exceptionType: String) -> Bool {
49+
public static func isExceptionTypeAppHang(exceptionType: String) -> Bool {
5050
return ExceptionType(rawValue: exceptionType) != nil
5151
}
5252
}

Sources/Swift/Core/SentryExperimentalOptions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ public class SentryExperimentalOptions: NSObject {
2121
*/
2222
public var enableFileManagerSwizzling = false
2323

24-
func validateOptions(_ options: [String: Any]?) {
24+
@_spi(Private) public func validateOptions(_ options: [String: Any]?) {
2525
}
2626
}

Sources/Swift/Integrations/SessionReplay/SentryReplayRecording.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ import Foundation
2727
self.events = [meta, video] + (extraEvents ?? [])
2828
}
2929

30-
func headerForReplayRecording() -> [String: Any] {
30+
public func headerForReplayRecording() -> [String: Any] {
3131
return ["segment_id": segmentId]
3232
}
3333

34-
func serialize() -> [[String: Any]] {
34+
public func serialize() -> [[String: Any]] {
3535
return events.map { $0.serialize() }
3636
}
3737
}

Sources/Swift/Integrations/UserFeedback/SentryFeedback.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class SentryFeedback: NSObject {
1818
var email: String?
1919
var message: String
2020
var source: SentryFeedbackSource
21-
let eventId: SentryId
21+
@_spi(Private) public let eventId: SentryId
2222

2323
/// Data objects for any attachments. Currently the web UI only supports showing one attached image, like for a screenshot.
2424
private var attachments: [Data]?
@@ -83,7 +83,7 @@ extension SentryFeedback {
8383
/**
8484
* - note: Currently there is only a single attachment possible, for the screenshot, of which there can be only one.
8585
*/
86-
func attachmentsForEnvelope() -> [Attachment] {
86+
@_spi(Private) public func attachmentsForEnvelope() -> [Attachment] {
8787
var items = [Attachment]()
8888
if let screenshot = attachments?.first {
8989
items.append(Attachment(data: screenshot, filename: "screenshot.png", contentType: "application/png"))

Tests/SentryTests/Helper/SentryBaggageSerializationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Foundation
2-
@testable import Sentry
2+
@_spi(Private) @testable import Sentry
33
import XCTest
44

55
class SentryBaggageSerializationTests: XCTestCase {

Tests/SentryTests/Integrations/ANR/SentryANRTrackerV1IntegrationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@testable import Sentry
1+
@_spi(Private) @testable import Sentry
22
import XCTest
33

44
#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)

0 commit comments

Comments
 (0)