Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,6 @@
D8C66A372A77B1F70015696A /* SentryPropagationContext.m in Sources */ = {isa = PBXBuildFile; fileRef = D8C66A352A77B1F70015696A /* SentryPropagationContext.m */; };
D8C67E9B28000E24007E326E /* SentryUIApplication.h in Headers */ = {isa = PBXBuildFile; fileRef = D8C67E9928000E23007E326E /* SentryUIApplication.h */; };
D8C67E9C28000E24007E326E /* SentryScreenshot.h in Headers */ = {isa = PBXBuildFile; fileRef = D8C67E9A28000E23007E326E /* SentryScreenshot.h */; };
D8CA12952C203E71005894F4 /* SentrySessionListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8CA12942C203E71005894F4 /* SentrySessionListener.swift */; };
D8CAC02E2BA0663E00E38F34 /* SentryReplayOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8CAC02A2BA0663E00E38F34 /* SentryReplayOptions.swift */; };
D8CAC02F2BA0663E00E38F34 /* SentryVideoInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8CAC02B2BA0663E00E38F34 /* SentryVideoInfo.swift */; };
D8CB74152947246600A5F964 /* SentryEnvelopeAttachmentHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = D8CB74142947246600A5F964 /* SentryEnvelopeAttachmentHeader.h */; };
Expand Down Expand Up @@ -2245,7 +2244,6 @@
D8C66A352A77B1F70015696A /* SentryPropagationContext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryPropagationContext.m; sourceTree = "<group>"; };
D8C67E9928000E23007E326E /* SentryUIApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryUIApplication.h; path = include/SentryUIApplication.h; sourceTree = "<group>"; };
D8C67E9A28000E23007E326E /* SentryScreenshot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryScreenshot.h; path = include/SentryScreenshot.h; sourceTree = "<group>"; };
D8CA12942C203E71005894F4 /* SentrySessionListener.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySessionListener.swift; sourceTree = "<group>"; };
D8CAC02A2BA0663E00E38F34 /* SentryReplayOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SentryReplayOptions.swift; sourceTree = "<group>"; };
D8CAC02B2BA0663E00E38F34 /* SentryVideoInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SentryVideoInfo.swift; sourceTree = "<group>"; };
D8CB74142947246600A5F964 /* SentryEnvelopeAttachmentHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryEnvelopeAttachmentHeader.h; path = include/SentryEnvelopeAttachmentHeader.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4472,7 +4470,6 @@
isa = PBXGroup;
children = (
620078752D38F1110022CB67 /* Codable */,
D8CA12942C203E71005894F4 /* SentrySessionListener.swift */,
);
path = Protocol;
sourceTree = "<group>";
Expand Down Expand Up @@ -5329,7 +5326,6 @@
63FE716920DA4C1100CDBAE8 /* SentryCrashStackCursor.c in Sources */,
7BA61CCA247D128B00C130A8 /* SentryThreadInspector.m in Sources */,
623FD9042D3FA92700803EDA /* NSNumberDecodableWrapper.swift in Sources */,
D8CA12952C203E71005894F4 /* SentrySessionListener.swift in Sources */,
63FE718D20DA4C1100CDBAE8 /* SentryCrashReportStore.c in Sources */,
7BA0C0482805600A003E0326 /* SentryTransportAdapter.m in Sources */,
63FE712920DA4C1000CDBAE8 /* SentryCrashCPU_arm.c in Sources */,
Expand Down
3 changes: 2 additions & 1 deletion SentryTestUtils/TestDisplayLinkWrapper.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
@_spi(Private) import Sentry

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

Expand All @@ -17,7 +18,7 @@ public enum FrameRate: UInt64 {
}
}

public class TestDisplayLinkWrapper: SentryDisplayLinkWrapper {
@_spi(Private) public class TestDisplayLinkWrapper: SentryDisplayLinkWrapper, SentryReplayDisplayLinkWrapper {
public var target: AnyObject!
public var selector: Selector!
public var currentFrameRate: FrameRate = .low
Expand Down
3 changes: 3 additions & 0 deletions Sources/Sentry/SentryDependencyContainer.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
#define SENTRY_THREAD_SANITIZER_DOUBLE_CHECKED_LOCK \
SENTRY_DISABLE_THREAD_SANITIZER("Double-checked locks produce false alarms.")

@interface SentryFileManager () <SentryFileManagerProtocol>
@end

@interface SentryDependencyContainer ()

@property (nonatomic, strong) id<SentryANRTracker> anrTracker;
Expand Down
4 changes: 4 additions & 0 deletions Sources/Sentry/SentrySessionReplayIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
static NSString *SENTRY_CURRENT_REPLAY = @"replay.current";
static NSString *SENTRY_LAST_REPLAY = @"replay.last";

@interface SentryDisplayLinkWrapper (Replay) <SentryReplayDisplayLinkWrapper>

@end

/**
* We need to use this from the swizzled block
* and using an instance property would hold reference
Expand Down
8 changes: 7 additions & 1 deletion Sources/Sentry/include/SentryHub+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@
@class SentryReplayEvent;
@class SentryReplayRecording;
@protocol SentryIntegrationProtocol;
@protocol SentrySessionListener;

NS_ASSUME_NONNULL_BEGIN

@protocol SentrySessionListener

- (void)sentrySessionEnded:(SentrySession *)session;
- (void)sentrySessionStarted:(SentrySession *)session;

@end

@interface SentryHub ()

@property (nullable, nonatomic, strong) SentrySession *session;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public let delayDuration: CFTimeInterval
public let framesContributingToDelayCount: UInt

init(delayDuration: CFTimeInterval, framesContributingToDelayCount: UInt) {
public init(delayDuration: CFTimeInterval, framesContributingToDelayCount: UInt) {

Check warning on line 9 in Sources/Swift/Core/Integrations/FramesTracking/SentryFramesDelayResult.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Core/Integrations/FramesTracking/SentryFramesDelayResult.swift#L9

Added line #L9 was not covered by tests
self.delayDuration = delayDuration
self.framesContributingToDelayCount = framesContributingToDelayCount
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@
}

@objc(addIgnoreClasses:)
func addIgnoreClasses(classes: [AnyClass]) {
public func addIgnoreClasses(classes: [AnyClass]) {

Check warning on line 63 in Sources/Swift/Core/Tools/ViewCapture/SentryViewPhotographer.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Core/Tools/ViewCapture/SentryViewPhotographer.swift#L63

Added line #L63 was not covered by tests
redactBuilder.addIgnoreClasses(classes)
}

@objc(addRedactClasses:)
func addRedactClasses(classes: [AnyClass]) {
public func addRedactClasses(classes: [AnyClass]) {

Check warning on line 68 in Sources/Swift/Core/Tools/ViewCapture/SentryViewPhotographer.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Core/Tools/ViewCapture/SentryViewPhotographer.swift#L68

Added line #L68 was not covered by tests
redactBuilder.addRedactClasses(classes)
}

@objc(setIgnoreContainerClass:)
func setIgnoreContainerClass(_ containerClass: AnyClass) {
public func setIgnoreContainerClass(_ containerClass: AnyClass) {

Check warning on line 73 in Sources/Swift/Core/Tools/ViewCapture/SentryViewPhotographer.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Core/Tools/ViewCapture/SentryViewPhotographer.swift#L73

Added line #L73 was not covered by tests
redactBuilder.setIgnoreContainerClass(containerClass)
}

@objc(setRedactContainerClass:)
func setRedactContainerClass(_ containerClass: AnyClass) {
public func setRedactContainerClass(_ containerClass: AnyClass) {

Check warning on line 78 in Sources/Swift/Core/Tools/ViewCapture/SentryViewPhotographer.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Core/Tools/ViewCapture/SentryViewPhotographer.swift#L78

Added line #L78 was not covered by tests
redactBuilder.setRedactContainerClass(containerClass)
}

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

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

Check warning on line 5 in Sources/Swift/Integrations/SessionReplay/RRWeb/SentryRRWebBreadcrumbEvent.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Integrations/SessionReplay/RRWeb/SentryRRWebBreadcrumbEvent.swift#L4-L5

Added lines #L4 - L5 were not covered by tests
var payload: [String: Any] = ["type": "default", "category": category, "level": level.description, "timestamp": timestamp.timeIntervalSince1970 ]

if let message = message {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation

@objc @_spi(Private) 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
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
}
}

@objc func addFrameAsync(timestamp: Date, maskedViewImage: UIImage, forScreen screen: String?) {
@objc public func addFrameAsync(timestamp: Date, maskedViewImage: UIImage, forScreen screen: String?) {

Check warning on line 77 in Sources/Swift/Integrations/SessionReplay/SentryOnDemandReplay.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Integrations/SessionReplay/SentryOnDemandReplay.swift#L77

Added line #L77 was not covered by tests
SentrySDKLog.debug("[Session Replay] Adding frame async for screen: \(screen ?? "nil")")
// Dispatch the frame addition to a background queue to avoid blocking the main queue.
// This must be on the processing queue to avoid deadlocks.
Expand Down Expand Up @@ -125,7 +125,7 @@
return UIGraphicsGetImageFromCurrentImageContext()
}

func releaseFramesUntil(_ date: Date) {
public func releaseFramesUntil(_ date: Date) {

Check warning on line 128 in Sources/Swift/Integrations/SessionReplay/SentryOnDemandReplay.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Integrations/SessionReplay/SentryOnDemandReplay.swift#L128

Added line #L128 was not covered by tests
processingQueue.dispatchAsync {
SentrySDKLog.debug("[Session Replay] Releasing frames until date: \(date)")
while let first = self._frames.first, first.time < date {
Expand All @@ -146,7 +146,7 @@
return _frames.first?.time
}

func createVideoInBackgroundWith(beginning: Date, end: Date, completion: @escaping ([SentryVideoInfo]) -> Void) {
public func createVideoInBackgroundWith(beginning: Date, end: Date, completion: @escaping ([SentryVideoInfo]) -> Void) {

Check warning on line 149 in Sources/Swift/Integrations/SessionReplay/SentryOnDemandReplay.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Integrations/SessionReplay/SentryOnDemandReplay.swift#L149

Added line #L149 was not covered by tests
// Note: In Swift it is best practice to use `Result<Value, Error>` instead of `(Value?, Error?)`
// Due to interoperability with Objective-C and @objc, we can not use Result for the completion callback.
SentrySDKLog.debug("[Session Replay] Creating video in background with beginning: \(beginning), end: \(end)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public class SentryReplayOptions: NSObject, SentryRedactOptions {
*
* - Note: See ``SentryReplayOptions.DefaultValues.maximumDuration`` for the default value.
*/
var maximumDuration: TimeInterval
@_spi(Private) public var maximumDuration: TimeInterval

/**
* Used by hybrid SDKs to be able to configure SDK info for Session Replay
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation
import UIKit

@objc
protocol SentryReplayVideoMaker: NSObjectProtocol {
@_spi(Private) public protocol SentryReplayVideoMaker: NSObjectProtocol {
func addFrameAsync(timestamp: Date, maskedViewImage: UIImage, forScreen: String?)
func releaseFramesUntil(_ date: Date)
func createVideoInBackgroundWith(beginning: Date, end: Date, completion: @escaping ([SentryVideoInfo]) -> Void)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import Foundation
@_implementationOnly import _SentryPrivate
import UIKit

@objc
@_spi(Private) public protocol SentryReplayDisplayLinkWrapper {
func isRunning() -> Bool
func invalidate()
func link(withTarget: Any, selector: Selector)
}

// swiftlint:disable type_body_length
@objcMembers
@_spi(Private) public class SentrySessionReplay: NSObject {
Expand All @@ -23,7 +30,7 @@ import UIKit

private let replayOptions: SentryReplayOptions
private let replayMaker: SentryReplayVideoMaker
private let displayLink: SentryDisplayLinkWrapper
private let displayLink: SentryReplayDisplayLinkWrapper
private let dateProvider: SentryCurrentDateProvider
private let touchTracker: SentryTouchTracker?
private let lock = NSLock()
Expand All @@ -36,7 +43,7 @@ import UIKit
public var screenshotProvider: SentryViewScreenshotProvider
public var breadcrumbConverter: SentryReplayBreadcrumbConverter

init(
public init(
replayOptions: SentryReplayOptions,
replayFolderPath: URL,
screenshotProvider: SentryViewScreenshotProvider,
Expand All @@ -45,7 +52,7 @@ import UIKit
touchTracker: SentryTouchTracker?,
dateProvider: SentryCurrentDateProvider,
delegate: SentrySessionReplayDelegate,
displayLinkWrapper: SentryDisplayLinkWrapper
displayLinkWrapper: SentryReplayDisplayLinkWrapper
) {
self.replayOptions = replayOptions
self.dateProvider = dateProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Foundation
private let dispatchQueueWrapper: SentryDispatchQueueWrapper
private let scopeContextStore: SentryScopeContextPersistentStore

init(
public init(
withDispatchQueueWrapper dispatchQueueWrapper: SentryDispatchQueueWrapper,
scopeContextStore: SentryScopeContextPersistentStore
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
@_implementationOnly import _SentryPrivate

@_spi(Private) @objc public protocol SentryFileManagerProtocol {
func moveState(_ stateFilePath: String, toPreviousState previousStateFilePath: String)
func readData(fromPath path: String) throws -> Data
@objc(writeData:toPath:)
@discardableResult func write(_ data: Data, toPath path: String) -> Bool
func removeFile(atPath path: String)
func getSentryPathAsURL() -> URL
}

@objcMembers
@_spi(Private) public class SentryScopeContextPersistentStore: NSObject {
private let fileManager: SentryFileManager
private let fileManager: SentryFileManagerProtocol

init(fileManager: SentryFileManager) {
public init(fileManager: SentryFileManagerProtocol) {

Check warning on line 16 in Sources/Swift/Persistence/SentryScopeContextPersistentStore.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Persistence/SentryScopeContextPersistentStore.swift#L16

Added line #L16 was not covered by tests
self.fileManager = fileManager
}

Expand Down
8 changes: 0 additions & 8 deletions Sources/Swift/Protocol/SentrySessionListener.swift

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SentryTestUtils
@_spi(Private) import SentryTestUtils
import XCTest

#if os(iOS) || os(macOS) || targetEnvironment(macCatalyst)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
@_spi(Private) import SentryTestUtils
import XCTest

#if compiler(>=6.0)
@_spi(Private) extension SentryFileManager: @retroactive SentryFileManagerProtocol { }
#else
@_spi(Private) extension SentryFileManager: SentryFileManagerProtocol { }
#endif

#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)
class SentryWatchdogTerminationTrackerTests: NotificationCenterTestCase {

Expand Down
Loading