Skip to content

Commit

Permalink
Exposes internal methods to allow compiling with APPLICATION_EXTENSIO…
Browse files Browse the repository at this point in the history
…N_API_ONLY=NO
  • Loading branch information
antonis committed Dec 4, 2024
1 parent b34716f commit fbb2243
Show file tree
Hide file tree
Showing 43 changed files with 202 additions and 170 deletions.
4 changes: 3 additions & 1 deletion Sources/Sentry/Public/SentryDebugImageProvider.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#import "SentryDebugMeta.h"
#import "SentryThread.h"
#import <Foundation/Foundation.h>

@class SentryDebugMeta, SentryThread, SentryFrame;
@class SentryFrame;

NS_ASSUME_NONNULL_BEGIN

Expand Down
6 changes: 4 additions & 2 deletions Sources/Sentry/Public/SentrySDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
# import <SentryWithoutUIKit/SentryDefines.h>
#endif

#import "SentryOptions.h"

@protocol SentrySpan;

@class SentryOptions, SentryEvent, SentryBreadcrumb, SentryScope, SentryUser, SentryId,
SentryUserFeedback, SentryTransactionContext;
@class SentryEvent, SentryBreadcrumb, SentryScope, SentryUser, SentryId, SentryUserFeedback,
SentryTransactionContext;
@class SentryMetricsAPI;
@class UIView;
@class SentryReplayApi;
Expand Down
4 changes: 2 additions & 2 deletions Sources/Sentry/SentryHub.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ - (void)startSession
endSessionExitedWithTimestamp:[SentryDependencyContainer.sharedInstance.dateProvider date]];
[self captureSession:lastSession];

[_sessionListener sentrySessionStarted:_session];
[_sessionListener sentrySessionStarted];
}

- (void)endSession
Expand All @@ -150,7 +150,7 @@ - (void)endSessionWithTimestamp:(NSDate *)timestamp
[currentSession endSessionExitedWithTimestamp:timestamp];
[self captureSession:currentSession];

[_sessionListener sentrySessionEnded:currentSession];
[_sessionListener sentrySessionEnded];
}

- (void)storeCurrentSession:(SentrySession *)session
Expand Down
24 changes: 12 additions & 12 deletions Sources/Sentry/SentrySessionReplayIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,16 @@ - (void)startWithOptions:(SentryReplayOptions *)replayOptions
attributes:attributes];

self.sessionReplay = [[SentrySessionReplay alloc]
initWithReplayOptions:replayOptions
replayFolderPath:docs
screenshotProvider:screenshotProvider
replayMaker:replayMaker
breadcrumbConverter:breadcrumbConverter
touchTracker:_touchTracker
dateProvider:SentryDependencyContainer.sharedInstance.dateProvider
delegate:self
dispatchQueue:dispatchQueue
displayLinkWrapper:[[SentryDisplayLinkWrapper alloc] init]];
initWithReplayOptions:replayOptions
replayFolderPath:docs
screenshotProvider:screenshotProvider
replayMaker:replayMaker
breadcrumbConverter:breadcrumbConverter
touchTracker:_touchTracker
dateProvider:SentryDependencyContainer.sharedInstance.dateProvider
delegate:self
dispatchQueueGeneric:dispatchQueue
displayLinkWrapperGeneric:[[SentryDisplayLinkWrapper alloc] init]];

[self.sessionReplay
startWithRootView:SentryDependencyContainer.sharedInstance.application.windows.firstObject
Expand Down Expand Up @@ -447,7 +447,7 @@ - (void)stop
self.sessionReplay = nil;
}

- (void)sentrySessionEnded:(SentrySession *)session
- (void)sentrySessionEnded
{
[self pause];
[_notificationCenter removeObserver:self
Expand All @@ -459,7 +459,7 @@ - (void)sentrySessionEnded:(SentrySession *)session
_sessionReplay = nil;
}

- (void)sentrySessionStarted:(SentrySession *)session
- (void)sentrySessionStarted
{
_rateLimited = NO;
[self startSession];
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/include/SentryProfilerSerialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#if SENTRY_TARGET_PROFILING_SUPPORTED

# import "SentryDefines.h"
# import "SentryHub.h"
# import <Foundation/Foundation.h>

@class SentryEnvelope;
@class SentryEnvelopeItem;
@class SentryHub;
@class SentryId;
@class SentryScreenFrames;
@class SentryTransaction;
Expand Down
6 changes: 3 additions & 3 deletions Sources/Swift/Helper/Log/SentryLevel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ extension SentryLevel: CustomStringConvertible {
}

@objcMembers
class SentryLevelHelper: NSObject {
static func nameForLevel(_ level: SentryLevel) -> String {
public class SentryLevelHelper: NSObject {
public static func nameForLevel(_ level: SentryLevel) -> String {
return level.description
}

static func levelForName(_ name: String) -> SentryLevel {
public static func levelForName(_ name: String) -> SentryLevel {
.fromName(name)
}

Expand Down
6 changes: 3 additions & 3 deletions Sources/Swift/Helper/SentryBaggageSerialization.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Foundation

@objcMembers
class SentryBaggageSerialization: NSObject {
public class SentryBaggageSerialization: NSObject {

private static let SENTRY_BAGGAGE_MAX_SIZE = 8_192

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

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

static func decode(_ baggage: String) -> [String: String] {
public static func decode(_ baggage: String) -> [String: String] {
guard !baggage.isEmpty else {
return [:]
}
Expand Down
12 changes: 6 additions & 6 deletions Sources/Swift/Helper/SentryCurrentDateProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ import Foundation
* Mocking the previous private class from `SentryTestUtils` stopped working in Xcode 16.
*/
@objc
protocol SentryCurrentDateProvider {
public protocol SentryCurrentDateProvider {
func date() -> Date
func timezoneOffset() -> Int
func systemTime() -> UInt64
func systemUptime() -> TimeInterval
}

@objcMembers
class SentryDefaultCurrentDateProvider: NSObject, SentryCurrentDateProvider {
func date() -> Date {
public class SentryDefaultCurrentDateProvider: NSObject, SentryCurrentDateProvider {
public func date() -> Date {
return Date()
}

func timezoneOffset() -> Int {
public func timezoneOffset() -> Int {
return TimeZone.current.secondsFromGMT()
}

func systemTime() -> UInt64 {
public func systemTime() -> UInt64 {
getAbsoluteTime()
}

func systemUptime() -> TimeInterval {
public func systemUptime() -> TimeInterval {
ProcessInfo.processInfo.systemUptime
}
}
5 changes: 3 additions & 2 deletions Sources/Swift/Helper/SentryEnabledFeaturesBuilder.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import Foundation

@objcMembers class SentryEnabledFeaturesBuilder: NSObject {
@objcMembers
public class SentryEnabledFeaturesBuilder: NSObject {

static func getEnabledFeatures(options: Options) -> [String] {
public static func getEnabledFeatures(options: Options) -> [String] {

var features: [String] = []

Expand Down
8 changes: 4 additions & 4 deletions Sources/Swift/Helper/SentryFileContents.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Foundation

@objcMembers
class SentryFileContents: NSObject {
public class SentryFileContents: NSObject {

let path: String
let contents: Data
public let path: String
public let contents: Data

init(path: String, contents: Data) {
public init(path: String, contents: Data) {
self.path = path
self.contents = contents
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Swift/Integrations/ANR/SentryANRTracker.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

@objc
protocol SentryANRTracker {
public protocol SentryANRTracker {
@objc(addListener:)
func add(listener: SentryANRTrackerDelegate)
@objc(removeListener:)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation

/// The methods are called from a background thread.
@objc
protocol SentryANRTrackerDelegate {
public protocol SentryANRTrackerDelegate {
func anrDetected(type: SentryANRType)
func anrStopped()
}
8 changes: 4 additions & 4 deletions Sources/Swift/Integrations/ANR/SentryANRType.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@objc
enum SentryANRType: Int {
public enum SentryANRType: Int {
case fullyBlocking
case nonFullyBlocking
case unknown
}

@objc
class SentryAppHangTypeMapper: NSObject {
public class SentryAppHangTypeMapper: NSObject {

private enum ExceptionType: String {
case fullyBlocking = "App Hanging Fully Blocked"
Expand All @@ -15,7 +15,7 @@ class SentryAppHangTypeMapper: NSObject {
}

@objc
static func getExceptionType(anrType: SentryANRType) -> String {
public static func getExceptionType(anrType: SentryANRType) -> String {
switch anrType {
case .fullyBlocking:
return ExceptionType.fullyBlocking.rawValue
Expand All @@ -27,7 +27,7 @@ class SentryAppHangTypeMapper: NSObject {
}

@objc
static func isExceptionTypeAppHang(exceptionType: String) -> Bool {
public static func isExceptionTypeAppHang(exceptionType: String) -> Bool {
return ExceptionType(rawValue: exceptionType) != nil
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Foundation

@objcMembers
class SentryFramesDelayResult: NSObject {
public class SentryFramesDelayResult: NSObject {
/// The frames delay for the passed time period. If frame delay can't be calculated this is -1.
let delayDuration: CFTimeInterval
let framesContributingToDelayCount: UInt
public let delayDuration: CFTimeInterval
public let framesContributingToDelayCount: UInt

init(delayDuration: CFTimeInterval, framesContributingToDelayCount: UInt) {
public init(delayDuration: CFTimeInterval, framesContributingToDelayCount: UInt) {
self.delayDuration = delayDuration
self.framesContributingToDelayCount = framesContributingToDelayCount
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Foundation

@objcMembers
class SentrySwizzleClassNameExclude: NSObject {
static func shouldExcludeClass(className: String, swizzleClassNameExcludes: Set<String>) -> Bool {
public class SentrySwizzleClassNameExclude: NSObject {
public static func shouldExcludeClass(className: String, swizzleClassNameExcludes: Set<String>) -> Bool {
for exclude in swizzleClassNameExcludes {
if className.contains(exclude) {
SentryLog.debug("Excluding class \(className) from swizzling cause it matches the exclude pattern: \(exclude).")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@_implementationOnly import _SentryPrivate
import Foundation

class SentryRRWebBreadcrumbEvent: SentryRRWebCustomEvent {
init(timestamp: Date, category: String, message: String? = nil, level: SentryLevel = .none, data: [String: Any]? = nil) {
public class SentryRRWebBreadcrumbEvent: SentryRRWebCustomEvent {
public init(timestamp: Date, category: String, message: String? = nil, level: SentryLevel = .none, data: [String: Any]? = nil) {

var payload: [String: Any] = ["type": "default", "category": category, "level": level.description, "timestamp": timestamp.timeIntervalSince1970 ]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

@objcMembers
class SentryRRWebCustomEvent: SentryRRWebEvent {
public class SentryRRWebCustomEvent: SentryRRWebEvent {
let tag: String

init(timestamp: Date, tag: String, payload: [String: Any]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ enum SentryRRWebEventType: Int {
}

@objc(SentryRRWebEvent)
protocol SentryRRWebEventProtocol: SentrySerializable {
public protocol SentryRRWebEventProtocol: SentrySerializable {
}

@objcMembers
class SentryRRWebEvent: NSObject, SentryRRWebEventProtocol {
public class SentryRRWebEvent: NSObject, SentryRRWebEventProtocol {
let type: SentryRRWebEventType
let timestamp: Date
let data: [String: Any]?
Expand All @@ -25,7 +25,7 @@ class SentryRRWebEvent: NSObject, SentryRRWebEventProtocol {
self.data = data
}

func serialize() -> [String: Any] {
public func serialize() -> [String: Any] {
var result: [String: Any] = [
"type": type.rawValue,
"timestamp": SentryDateUtil.millisecondsSince1970(timestamp)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
@_implementationOnly import _SentryPrivate
import Foundation

@objc class SentryRRWebSpanEvent: SentryRRWebCustomEvent {
@objc
public class SentryRRWebSpanEvent: SentryRRWebCustomEvent {

init(timestamp: Date, endTimestamp: Date, operation: String, description: String, data: [String: Any]) {
public init(timestamp: Date, endTimestamp: Date, operation: String, description: String, data: [String: Any]) {
super.init(timestamp: timestamp, tag: "performanceSpan", payload:
[
"op": operation,
Expand Down
Loading

0 comments on commit fbb2243

Please sign in to comment.