Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
getsentry-bot committed Feb 20, 2024
1 parent d6d8ce0 commit 3d37160
Show file tree
Hide file tree
Showing 14 changed files with 371 additions and 302 deletions.
7 changes: 4 additions & 3 deletions Sources/Sentry/Public/SentryOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

NS_ASSUME_NONNULL_BEGIN

@class SentryDsn, SentryMeasurementValue, SentryHttpStatusCodeRange, SentryScope, SentryReplaySettings;
@class SentryDsn, SentryMeasurementValue, SentryHttpStatusCodeRange, SentryScope,
SentryReplaySettings;

NS_SWIFT_NAME(Options)
@interface SentryOptions : NSObject
Expand Down Expand Up @@ -269,13 +270,13 @@ NS_SWIFT_NAME(Options)
*/
@property (nonatomic, assign) BOOL enablePreWarmedAppStartTracing;


/**
* @warning This is an experimental feature and may still have bugs.
* Settings to configure the session replay.
* @node Default value is @c nil .
*/
@property (nonatomic, strong) SentryReplaySettings * sessionReplaySettings API_AVAILABLE(ios(16.0), tvos(16.0));
@property (nonatomic, strong)
SentryReplaySettings *sessionReplaySettings API_AVAILABLE(ios(16.0), tvos(16.0));

#endif // SENTRY_UIKIT_AVAILABLE

Expand Down
11 changes: 7 additions & 4 deletions Sources/Sentry/Public/SentryReplaySettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ NS_ASSUME_NONNULL_BEGIN

/**
* Inittialize the settings of session replay
*
* @param sessionSampleRate Indicates the percentage in which the replay for the session will be created.
* @param errorSampleRate Indicates the percentage in which a 30 seconds replay will be send with error events.
*
* @param sessionSampleRate Indicates the percentage in which the replay for the session will be
* created.
* @param errorSampleRate Indicates the percentage in which a 30 seconds replay will be send with
* error events.
*/
- (instancetype)initWithReplaySessionSampleRate:(CGFloat)sessionSampleRate replaysOnErrorSampleRate:(CGFloat)errorSampleRate;
- (instancetype)initWithReplaySessionSampleRate:(CGFloat)sessionSampleRate
replaysOnErrorSampleRate:(CGFloat)errorSampleRate;

@end

Expand Down
42 changes: 21 additions & 21 deletions Sources/Sentry/SentryBaseIntegration.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#import "SentryBaseIntegration.h"
#import "SentryCrashWrapper.h"
#import "SentryLog.h"
#import "SentryReplaySettings.h"
#import <Foundation/Foundation.h>
#import <SentryDependencyContainer.h>
#import <SentryOptions+Private.h>
#import "SentryReplaySettings.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -33,119 +33,119 @@ - (void)logWithReason:(NSString *)reason
- (BOOL)shouldBeEnabledWithOptions:(SentryOptions *)options
{
SentryIntegrationOption integrationOptions = [self integrationOptions];

if (integrationOptions & kIntegrationOptionNone) {
return YES;
}

if ((integrationOptions & kIntegrationOptionEnableAutoSessionTracking)
&& !options.enableAutoSessionTracking) {
[self logWithOptionName:@"enableAutoSessionTracking"];
return NO;
}

if ((integrationOptions & kIntegrationOptionEnableWatchdogTerminationTracking)
&& !options.enableWatchdogTerminationTracking) {
[self logWithOptionName:@"enableWatchdogTerminationTracking"];
return NO;
}

if ((integrationOptions & kIntegrationOptionEnableAutoPerformanceTracing)
&& !options.enableAutoPerformanceTracing) {
[self logWithOptionName:@"enableAutoPerformanceTracing"];
return NO;
}

#if SENTRY_HAS_UIKIT
if ((integrationOptions & kIntegrationOptionEnableUIViewControllerTracing)
&& !options.enableUIViewControllerTracing) {
[self logWithOptionName:@"enableUIViewControllerTracing"];
return NO;
}

# if SENTRY_HAS_UIKIT
if ((integrationOptions & kIntegrationOptionAttachScreenshot) && !options.attachScreenshot) {
[self logWithOptionName:@"attachScreenshot"];
return NO;
}
# endif // SENTRY_HAS_UIKIT

if ((integrationOptions & kIntegrationOptionEnableUserInteractionTracing)
&& !options.enableUserInteractionTracing) {
[self logWithOptionName:@"enableUserInteractionTracing"];
return NO;
}
#endif

if (integrationOptions & kIntegrationOptionEnableAppHangTracking) {
if (!options.enableAppHangTracking) {
[self logWithOptionName:@"enableAppHangTracking"];
return NO;
}

if (options.appHangTimeoutInterval == 0) {
[self logWithReason:@"because appHangTimeoutInterval is 0"];
return NO;
}
}

if ((integrationOptions & kIntegrationOptionEnableNetworkTracking)
&& !options.enableNetworkTracking) {
[self logWithOptionName:@"enableNetworkTracking"];
return NO;
}

if ((integrationOptions & kIntegrationOptionEnableFileIOTracing)
&& !options.enableFileIOTracing) {
[self logWithOptionName:@"enableFileIOTracing"];
return NO;
}

if ((integrationOptions & kIntegrationOptionEnableNetworkBreadcrumbs)
&& !options.enableNetworkBreadcrumbs) {
[self logWithOptionName:@"enableNetworkBreadcrumbs"];
return NO;
}

if ((integrationOptions & kIntegrationOptionEnableCoreDataTracing)
&& !options.enableCoreDataTracing) {
[self logWithOptionName:@"enableCoreDataTracing"];
return NO;
}

if ((integrationOptions & kIntegrationOptionEnableSwizzling) && !options.enableSwizzling) {
[self logWithOptionName:@"enableSwizzling"];
return NO;
}

if ((integrationOptions & kIntegrationOptionEnableAutoBreadcrumbTracking)
&& !options.enableAutoBreadcrumbTracking) {
[self logWithOptionName:@"enableAutoBreadcrumbTracking"];
return NO;
}

if ((integrationOptions & kIntegrationOptionIsTracingEnabled) && !options.isTracingEnabled) {
[self logWithOptionName:@"isTracingEnabled"];
return NO;
}

if ((integrationOptions & kIntegrationOptionDebuggerNotAttached) &&
[SentryDependencyContainer.sharedInstance.crashWrapper isBeingTraced]) {
[self logWithReason:@"because the debugger is attached"];
return NO;
}

#if SENTRY_HAS_UIKIT
if ((integrationOptions & kIntegrationOptionAttachViewHierarchy)
&& !options.attachViewHierarchy) {
[self logWithOptionName:@"attachViewHierarchy"];
return NO;
}

if (integrationOptions & kIntegrationOptionEnableReplay) {
if (@available(iOS 16.0, *)) {
if (options.sessionReplaySettings.replaysOnErrorSampleRate == 0
&& options.sessionReplaySettings.replaysSessionSampleRate == 0 ){
&& options.sessionReplaySettings.replaysSessionSampleRate == 0) {
[self logWithOptionName:@"sessionReplaySettings"];
return NO;
}
Expand Down
Loading

0 comments on commit 3d37160

Please sign in to comment.