Skip to content

Commit

Permalink
Merge e0a817c into 06bac56
Browse files Browse the repository at this point in the history
  • Loading branch information
armcknight authored Jul 18, 2023
2 parents 06bac56 + e0a817c commit fe98a1e
Show file tree
Hide file tree
Showing 75 changed files with 612 additions and 401 deletions.
9 changes: 6 additions & 3 deletions SentryTestUtils/ClearTestState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ class TestCleanup: NSObject {
SentrySDK.setCurrentHub(nil)
SentrySDK.crashedLastRunCalled = false
SentrySDK.startInvocations = 0
PrivateSentrySDKOnly.onAppStartMeasurementAvailable = nil
PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = false
SentrySDK.setAppStartMeasurement(nil)
CurrentDate.setCurrentDateProvider(nil)
SentryNetworkTracker.sharedInstance.disable()

Expand All @@ -44,6 +42,11 @@ class TestCleanup: NSObject {
#if os(iOS) || os(macOS) || targetEnvironment(macCatalyst)
SentryProfiler.getCurrent().stop(for: .normal)
SentryTracer.resetConcurrencyTracking()
#endif
#endif // os(iOS) || os(macOS) || targetEnvironment(macCatalyst)

#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)
PrivateSentrySDKOnly.onAppStartMeasurementAvailable = nil
SentrySDK.setAppStartMeasurement(nil)
#endif // os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)
}
}
16 changes: 10 additions & 6 deletions SentryTestUtils/SentryTestUtils-ObjC-BridgingHeader.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
#import "SentryDefines.h"

#if SENTRY_HAS_UIKIT
# import "SentryAppStartTracker.h"
# import "SentryDisplayLinkWrapper.h"
# import "SentryFramesTracker+TestInit.h"
# import "SentryUIDeviceWrapper.h"
# import "SentryUIViewControllerPerformanceTracker.h"
#endif // SENTRY_HAS_UIKIT

#import "PrivateSentrySDKOnly.h"
#import "SentryAppStartTracker.h"
#import "SentryAppState.h"
#import "SentryClient+Private.h"
#import "SentryClient+TestInit.h"
#import "SentryCrashWrapper.h"
#import "SentryCurrentDate.h"
#import "SentryCurrentDateProvider.h"
#import "SentryDefines.h"
#import "SentryDependencyContainer.h"
#import "SentryDispatchFactory.h"
#import "SentryDispatchQueueWrapper.h"
#import "SentryDispatchSourceWrapper.h"
#import "SentryDisplayLinkWrapper.h"
#import "SentryEnvelope.h"
#import "SentryFileManager.h"
#import "SentryFramesTracker+TestInit.h"
#import "SentryGlobalEventProcessor.h"
#import "SentryLog.h"
#import "SentryNSProcessInfoWrapper.h"
Expand All @@ -33,5 +39,3 @@
#import "SentryTracer+Test.h"
#import "SentryTransport.h"
#import "SentryTransportAdapter.h"
#import "SentryUIDeviceWrapper.h"
#import "SentryUIViewControllerPerformanceTracker.h"
1 change: 0 additions & 1 deletion Sources/Sentry/Public/SentryDebugImageProvider.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#import "SentryDefines.h"
#import <Foundation/Foundation.h>

@class SentryDebugMeta, SentryThread, SentryFrame;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/Public/SentryOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ NS_SWIFT_NAME(Options)
*/
@property (nonatomic, assign) BOOL enablePreWarmedAppStartTracing;

#endif
#endif // SENTRY_HAS_UIKIT

/**
* When enabled, the SDK tracks performance for HTTP requests if auto performance tracking and
Expand Down
9 changes: 7 additions & 2 deletions Sources/Sentry/SentryAppStartMeasurement.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#import "SentryAppStartMeasurement.h"
#import "NSDate+SentryExtras.h"
#import <Foundation/Foundation.h>

#if SENTRY_HAS_UIKIT

# import "NSDate+SentryExtras.h"
# import <Foundation/Foundation.h>

@implementation SentryAppStartMeasurement

Expand Down Expand Up @@ -41,3 +44,5 @@ - (instancetype)initWithType:(SentryAppStartType)type
}

@end

#endif // SENTRY_HAS_UIKIT
33 changes: 17 additions & 16 deletions Sources/Sentry/SentryAppStartTracker.m
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#import "SentryAppStartMeasurement.h"
#import "SentryAppStateManager.h"
#import "SentryLog.h"
#import "SentrySysctl.h"
#import <Foundation/Foundation.h>
#import <PrivateSentrySDKOnly.h>
#import <SentryAppStartTracker.h>
#import <SentryAppState.h>
#import <SentryCurrentDateProvider.h>
#import <SentryDispatchQueueWrapper.h>
#import <SentryInternalNotificationNames.h>
#import <SentryLog.h>
#import <SentrySDK+Private.h>

#if SENTRY_HAS_UIKIT

# import "SentryAppStartMeasurement.h"
# import "SentryAppStateManager.h"
# import "SentryLog.h"
# import "SentrySysctl.h"
# import <Foundation/Foundation.h>
# import <PrivateSentrySDKOnly.h>
# import <SentryAppState.h>
# import <SentryCurrentDateProvider.h>
# import <SentryDispatchQueueWrapper.h>
# import <SentryInternalNotificationNames.h>
# import <SentryLog.h>
# import <SentrySDK+Private.h>
# import <UIKit/UIKit.h>

static NSDate *runtimeInit = nil;
Expand Down Expand Up @@ -82,9 +83,9 @@ - (BOOL)isActivePrewarmAvailable
} else {
return NO;
}
# else
# else // !TARGET_OS_IOS
return NO;
# endif
# endif // TARGET_OS_IOS
}

- (void)start
Expand Down Expand Up @@ -116,7 +117,7 @@ - (void)start

# if SENTRY_HAS_UIKIT
[self.appStateManager start];
# endif
# endif // SENTRY_HAS_UIKIT

self.isRunning = YES;
}
Expand Down Expand Up @@ -312,4 +313,4 @@ - (void)setRuntimeInit:(NSDate *)value

@end

#endif
#endif // SENTRY_HAS_UIKIT
34 changes: 15 additions & 19 deletions Sources/Sentry/SentryAppStartTrackingIntegration.m
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
#import "SentryAppStartTrackingIntegration.h"
#import "SentryAppStartTracker.h"
#import "SentryDefaultCurrentDateProvider.h"
#import "SentryLog.h"
#import <Foundation/Foundation.h>
#import <PrivateSentrySDKOnly.h>
#import <SentryAppStateManager.h>
#import <SentryCrashWrapper.h>
#import <SentryDependencyContainer.h>
#import <SentryDispatchQueueWrapper.h>
#import <SentrySysctl.h>

#if SENTRY_HAS_UIKIT

# import "SentryAppStartTracker.h"
# import "SentryDefaultCurrentDateProvider.h"
# import "SentryLog.h"
# import <Foundation/Foundation.h>
# import <PrivateSentrySDKOnly.h>
# import <SentryAppStateManager.h>
# import <SentryCrashWrapper.h>
# import <SentryDependencyContainer.h>
# import <SentryDispatchQueueWrapper.h>
# import <SentrySysctl.h>

@interface
SentryAppStartTrackingIntegration ()

#if SENTRY_HAS_UIKIT
@property (nonatomic, strong) SentryAppStartTracker *tracker;
#endif

@end

@implementation SentryAppStartTrackingIntegration

- (BOOL)installWithOptions:(SentryOptions *)options
{
#if SENTRY_HAS_UIKIT
if (!PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode
&& ![super installWithOptions:options]) {
return NO;
Expand All @@ -45,10 +45,6 @@ - (BOOL)installWithOptions:(SentryOptions *)options
[self.tracker start];

return YES;
#else
SENTRY_LOG_DEBUG(@"NO UIKit -> SentryAppStartTracker will not track app start up time.");
return NO;
#endif
}

- (SentryIntegrationOption)integrationOptions
Expand All @@ -63,11 +59,11 @@ - (void)uninstall

- (void)stop
{
#if SENTRY_HAS_UIKIT
if (nil != self.tracker) {
[self.tracker stop];
}
#endif
}

@end

#endif // SENTRY_HAS_UIKIT
5 changes: 5 additions & 0 deletions Sources/Sentry/SentryCrashIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ - (BOOL)installWithOptions:(nonnull SentryOptions *)options

self.options = options;

#if SENTRY_HAS_UIKIT
SentryAppStateManager *appStateManager =
[SentryDependencyContainer sharedInstance].appStateManager;
SentryWatchdogTerminationLogic *logic =
Expand All @@ -78,6 +79,10 @@ - (BOOL)installWithOptions:(nonnull SentryOptions *)options
self.crashedSessionHandler =
[[SentrySessionCrashedHandler alloc] initWithCrashWrapper:self.crashAdapter
watchdogTerminationLogic:logic];
#else
self.crashedSessionHandler =
[[SentrySessionCrashedHandler alloc] initWithCrashWrapper:self.crashAdapter];
#endif // SENTRY_HAS_UIKIT

self.scopeObserver =
[[SentryCrashScopeObserver alloc] initWithMaxBreadcrumbs:options.maxBreadcrumbs];
Expand Down
5 changes: 4 additions & 1 deletion Sources/Sentry/SentryDependencyContainer.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#import "SentryDispatchFactory.h"
#import "SentryDispatchQueueWrapper.h"
#import "SentryDisplayLinkWrapper.h"
#import "SentryFramesTracker.h"
#import "SentryNSProcessInfoWrapper.h"
#import "SentryNSTimerFactory.h"
#import "SentrySystemWrapper.h"
Expand All @@ -24,6 +23,10 @@
#import <SentryThreadWrapper.h>
#import <SentryViewHierarchy.h>

#if SENTRY_HAS_UIKIT
# import "SentryFramesTracker.h"
#endif // SENTRY_HAS_UIKIT

@implementation SentryDependencyContainer

static SentryDependencyContainer *instance;
Expand Down
26 changes: 14 additions & 12 deletions Sources/Sentry/SentryFramesTracker.m
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#import "SentryFramesTracker.h"
#import "SentryCompiler.h"
#import "SentryCurrentDate.h"
#import "SentryDisplayLinkWrapper.h"
#import "SentryLog.h"
#import "SentryProfiler.h"
#import "SentryProfilingConditionals.h"
#import "SentryTime.h"
#import "SentryTracer.h"
#import <SentryScreenFrames.h>
#include <stdatomic.h>

#if SENTRY_HAS_UIKIT

# import "SentryCompiler.h"
# import "SentryCurrentDate.h"
# import "SentryDisplayLinkWrapper.h"
# import "SentryLog.h"
# import "SentryProfiler.h"
# import "SentryProfilingConditionals.h"
# import "SentryTime.h"
# import "SentryTracer.h"
# import <SentryScreenFrames.h>
# include <stdatomic.h>

# import <UIKit/UIKit.h>

# if SENTRY_TARGET_PROFILING_SUPPORTED
Expand Down Expand Up @@ -182,7 +184,7 @@ - (void)recordTimestamp:(uint64_t)timestamp value:(NSNumber *)value array:(NSMut
BOOL shouldRecord = [SentryProfiler isCurrentlyProfiling];
# if defined(TEST) || defined(TESTCI)
shouldRecord = YES;
# endif
# endif // defined(TEST) || defined(TESTCI)
if (shouldRecord) {
[array addObject:@{ @"timestamp" : @(timestamp), @"value" : value }];
}
Expand Down Expand Up @@ -228,4 +230,4 @@ - (void)removeListener:(id<SentryFramesTrackerListener>)listener

@end

#endif
#endif // SENTRY_HAS_UIKIT
27 changes: 10 additions & 17 deletions Sources/Sentry/SentryFramesTrackingIntegration.m
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
#import "SentryFramesTrackingIntegration.h"
#import "PrivateSentrySDKOnly.h"
#import "SentryDependencyContainer.h"
#import "SentryFramesTracker.h"
#import "SentryLog.h"

#if SENTRY_HAS_UIKIT

# import "PrivateSentrySDKOnly.h"
# import "SentryDependencyContainer.h"
# import "SentryLog.h"

# import "SentryFramesTracker.h"

NS_ASSUME_NONNULL_BEGIN

@interface
SentryFramesTrackingIntegration ()

#if SENTRY_HAS_UIKIT
@property (nonatomic, strong) SentryFramesTracker *tracker;
#endif

@end

@implementation SentryFramesTrackingIntegration

- (BOOL)installWithOptions:(SentryOptions *)options
{
#if SENTRY_HAS_UIKIT
if (!PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode
&& ![super installWithOptions:options]) {
return NO;
Expand All @@ -29,14 +30,6 @@ - (BOOL)installWithOptions:(SentryOptions *)options
[self.tracker start];

return YES;
#else
[SentryLog
logWithMessage:
@"NO UIKit -> SentryFramesTrackingIntegration will not track slow and frozen frames."
andLevel:kSentryLevelInfo];

return NO;
#endif
}

- (SentryIntegrationOption)integrationOptions
Expand All @@ -51,13 +44,13 @@ - (void)uninstall

- (void)stop
{
#if SENTRY_HAS_UIKIT
if (nil != self.tracker) {
[self.tracker stop];
}
#endif
}

@end

NS_ASSUME_NONNULL_END

#endif // SENTRY_HAS_UIKIT
5 changes: 4 additions & 1 deletion Sources/Sentry/SentryHub.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
#import "SentryTracesSampler.h"
#import "SentryTransaction.h"
#import "SentryTransactionContext+Private.h"
#import "SentryUIViewControllerPerformanceTracker.h"

#if SENTRY_HAS_UIKIT
# import "SentryUIViewControllerPerformanceTracker.h"
#endif // SENTRY_HAS_UIKIT

NS_ASSUME_NONNULL_BEGIN

Expand Down
Loading

0 comments on commit fe98a1e

Please sign in to comment.