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
16 changes: 14 additions & 2 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1112,8 +1112,9 @@
FAAB2EE02E4BE97500FE8B7E /* TestSentryNSApplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAB2EDF2E4BE96F00FE8B7E /* TestSentryNSApplication.swift */; };
FAAB2F972E4D345800FE8B7E /* SentryUIDeviceWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAB2F962E4D344F00FE8B7E /* SentryUIDeviceWrapper.swift */; };
FAAB30F32E4E8F2C00FE8B7E /* SentryInAppLogic.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAB30F22E4E8F2C00FE8B7E /* SentryInAppLogic.swift */; };
FAB007432E9F47E8001C806A /* SessionTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB007422E9F47E4001C806A /* SessionTracker.swift */; };
FAAB95C02EA163590030A2DB /* SentryScopeObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAB95BF2EA163590030A2DB /* SentryScopeObserver.swift */; };
FAB007362E9EF8D3001C806A /* SentryUIViewControllerPerformanceTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB007302E9EF8CB001C806A /* SentryUIViewControllerPerformanceTracker.swift */; };
FAB007432E9F47E8001C806A /* SessionTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB007422E9F47E4001C806A /* SessionTracker.swift */; };
FAB007522E9FE2FF001C806A /* SentrySwizzleWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB0074C2E9FE2FA001C806A /* SentrySwizzleWrapper.swift */; };
FAB359982E05D7E90083D5E3 /* SentryEventSwiftHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = FAB359972E05D7E90083D5E3 /* SentryEventSwiftHelper.h */; };
FAB3599A2E05D8080083D5E3 /* SentryEventSwiftHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB359992E05D8080083D5E3 /* SentryEventSwiftHelper.m */; };
Expand Down Expand Up @@ -2475,8 +2476,9 @@
FAAB2EDF2E4BE96F00FE8B7E /* TestSentryNSApplication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestSentryNSApplication.swift; sourceTree = "<group>"; };
FAAB2F962E4D344F00FE8B7E /* SentryUIDeviceWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUIDeviceWrapper.swift; sourceTree = "<group>"; };
FAAB30F22E4E8F2C00FE8B7E /* SentryInAppLogic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryInAppLogic.swift; sourceTree = "<group>"; };
FAB007422E9F47E4001C806A /* SessionTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionTracker.swift; sourceTree = "<group>"; };
FAAB95BF2EA163590030A2DB /* SentryScopeObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryScopeObserver.swift; sourceTree = "<group>"; };
FAB007302E9EF8CB001C806A /* SentryUIViewControllerPerformanceTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUIViewControllerPerformanceTracker.swift; sourceTree = "<group>"; };
FAB007422E9F47E4001C806A /* SessionTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionTracker.swift; sourceTree = "<group>"; };
FAB0074C2E9FE2FA001C806A /* SentrySwizzleWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySwizzleWrapper.swift; sourceTree = "<group>"; };
FAB359972E05D7E90083D5E3 /* SentryEventSwiftHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryEventSwiftHelper.h; path = include/SentryEventSwiftHelper.h; sourceTree = "<group>"; };
FAB359992E05D8080083D5E3 /* SentryEventSwiftHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryEventSwiftHelper.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4380,6 +4382,7 @@
D800942328F82E8D005D3943 /* Swift */ = {
isa = PBXGroup;
children = (
FAAB95B92EA1633E0030A2DB /* State */,
FA560F5A2E8C876A00F2AF7F /* SentryAppStateManager.swift */,
F429D37E2E8532A300DBF387 /* Networking */,
F4FE9E062E6248BB0014FED5 /* SentryCrash */,
Expand Down Expand Up @@ -4969,6 +4972,14 @@
path = Core;
sourceTree = "<group>";
};
FAAB95B92EA1633E0030A2DB /* State */ = {
isa = PBXGroup;
children = (
FAAB95BF2EA163590030A2DB /* SentryScopeObserver.swift */,
);
path = State;
sourceTree = "<group>";
};
FAB0073C2E9F47DE001C806A /* Session */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -6036,6 +6047,7 @@
63FE710B20DA4C1000CDBAE8 /* SentryCrashMach.c in Sources */,
63FE707720DA4C1000CDBAE8 /* SentryDictionaryDeepSearch.m in Sources */,
FACEED132E3179A10007B4AC /* SentyOptionsInternal.m in Sources */,
FAAB95C02EA163590030A2DB /* SentryScopeObserver.swift in Sources */,
D48891D02E98F2E700212823 /* SentryInfoPlistError.swift in Sources */,
8482FA9C2DD7C397000E9283 /* SentryFeedbackAPI.m in Sources */,
7BC9A20628F41781001E7C4C /* SentryMeasurementUnit.m in Sources */,
Expand Down
3 changes: 3 additions & 0 deletions Sources/Sentry/SentryCrashIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
}
}

@interface SentryCrashScopeObserver () <SentryScopeObserver>
@end

@interface SentryCrashIntegration ()

@property (nonatomic, weak) SentryOptions *options;
Expand Down
3 changes: 3 additions & 0 deletions Sources/Sentry/SentryDependencyContainer.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ @interface SentryDefaultAppStateManager () <SentryAppStateManager>
@end

#if SENTRY_HAS_UIKIT
@interface SentryWatchdogTerminationScopeObserver () <SentryScopeObserver>
@end

@interface SentryDefaultUIViewControllerPerformanceTracker () <
SentryUIViewControllerPerformanceTracker>
@end
Expand Down
1 change: 0 additions & 1 deletion Sources/Sentry/SentryScope.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#import "SentryPropagationContext.h"
#import "SentryScope+Private.h"
#import "SentryScope+PrivateSwift.h"
#import "SentryScopeObserver.h"
#import "SentrySpan.h"
#import "SentrySwift.h"
#import "SentryTracer.h"
Expand Down
29 changes: 27 additions & 2 deletions Sources/Sentry/include/SentryCrashScopeObserver.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "SentryDefines.h"
#import "SentryScopeObserver.h"

@class SentryUser;

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -15,11 +16,35 @@ NS_ASSUME_NONNULL_BEGIN
* thread. This has the downside of the scope not being 100% up to date when a crash happens and, of
* course, lots of CPU overhead.
*/
@interface SentryCrashScopeObserver : NSObject <SentryScopeObserver>
@interface SentryCrashScopeObserver : NSObject
SENTRY_NO_INIT

- (instancetype)initWithMaxBreadcrumbs:(NSInteger)maxBreadcrumbs;

- (void)setUser:(nullable SentryUser *)user;

- (void)setTags:(nullable NSDictionary<NSString *, NSString *> *)tags;

- (void)setExtras:(nullable NSDictionary<NSString *, id> *)extras;

- (void)setContext:(nullable NSDictionary<NSString *, id> *)context;

- (void)setTraceContext:(nullable NSDictionary<NSString *, id> *)traceContext;

- (void)setDist:(nullable NSString *)dist;

- (void)setEnvironment:(nullable NSString *)environment;

- (void)setFingerprint:(nullable NSArray<NSString *> *)fingerprint;

- (void)setLevel:(enum SentryLevel)level;

- (void)addSerializedBreadcrumb:(NSDictionary<NSString *, id> *)crumb;

- (void)clearBreadcrumbs;

- (void)clear;

@end

NS_ASSUME_NONNULL_END
41 changes: 0 additions & 41 deletions Sources/Sentry/include/SentryScopeObserver.h

This file was deleted.

29 changes: 26 additions & 3 deletions Sources/Sentry/include/SentryWatchdogTerminationScopeObserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

#if SENTRY_HAS_UIKIT

# import "SentryScopeObserver.h"

@class SentryWatchdogTerminationBreadcrumbProcessor;
@class SentryWatchdogTerminationAttributesProcessor;
@class SentryUser;

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -15,13 +14,37 @@ NS_ASSUME_NONNULL_BEGIN
* This class doesn't need to be thread safe as the scope already calls the scope observers in a
* thread safe manner.
*/
@interface SentryWatchdogTerminationScopeObserver : NSObject <SentryScopeObserver>
@interface SentryWatchdogTerminationScopeObserver : NSObject
SENTRY_NO_INIT

- (instancetype)
initWithBreadcrumbProcessor:(SentryWatchdogTerminationBreadcrumbProcessor *)breadcrumbProcessor
attributesProcessor:(SentryWatchdogTerminationAttributesProcessor *)attributesProcessor;

- (void)setUser:(nullable SentryUser *)user;

- (void)setTags:(nullable NSDictionary<NSString *, NSString *> *)tags;

- (void)setExtras:(nullable NSDictionary<NSString *, id> *)extras;

- (void)setContext:(nullable NSDictionary<NSString *, id> *)context;

- (void)setTraceContext:(nullable NSDictionary<NSString *, id> *)traceContext;

- (void)setDist:(nullable NSString *)dist;

- (void)setEnvironment:(nullable NSString *)environment;

- (void)setFingerprint:(nullable NSArray<NSString *> *)fingerprint;

- (void)setLevel:(enum SentryLevel)level;

- (void)addSerializedBreadcrumb:(NSDictionary<NSString *, id> *)crumb;

- (void)clearBreadcrumbs;

- (void)clear;

@end

NS_ASSUME_NONNULL_END
Expand Down
15 changes: 15 additions & 0 deletions Sources/Swift/State/SentryScopeObserver.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@_spi(Private) @objc public protocol SentryScopeObserver: NSObjectProtocol {
func setUser(_ user: User?)
func setTags(_ tags: [String: String]?)
func setExtras(_ extras: [String: Any]?)
func setContext(_ context: [String: Any]?)
func setTraceContext(_ traceContext: [String: Any]?)
func setDist(_ dist: String?)
func setEnvironment(_ environment: String?)
func setFingerprint(_ fingerprint: [String]?)
func setLevel(_ level: SentryLevel)
func addSerializedBreadcrumb(_ serializedBreadcrumb: [String: Any])
func clearBreadcrumbs()
func clear()
@objc optional func setCurrentScreen(_ currentScreen: String?)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@_spi(Private) import Sentry
import SentryTestUtils
import XCTest

@_spi(Private) extension SentryCrashScopeObserver: SentryScopeObserver { }

class SentryCrashScopeObserverTests: XCTestCase {

private class Fixture {
Expand Down
1 change: 0 additions & 1 deletion Tests/SentryTests/SentryTests-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@
#import "SentrySDKInternal+Tests.h"
#import "SentrySampleDecision+Private.h"
#import "SentryScope+Private.h"
#import "SentryScopeObserver.h"
#import "SentryScopeSyncC.h"
#import "SentryScreenshotIntegration.h"
#import "SentrySerialization.h"
Expand Down
Loading