diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 650b565ee51..228b024ba98 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -4783,6 +4783,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + OTHER_SWIFT_FLAGS = "-DSENTRY_USE_UIKIT"; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.Sentry.tests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -4813,6 +4814,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + OTHER_SWIFT_FLAGS = "-DSENTRY_USE_UIKIT"; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.Sentry.tests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -4953,6 +4955,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + OTHER_SWIFT_FLAGS = "-DSENTRY_USE_UIKIT"; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.Sentry.tests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -4964,6 +4967,286 @@ }; name = TestCI; }; + 841C60C32A69DE6B00E1C00F /* Debug_Use_UIKit */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D8BD2E27292D1F7300D96C6A /* SDK.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_MODULES_AUTOLINK = NO; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = "$(CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION)"; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = "$(CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION)"; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = "$(CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION)"; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = ""; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SWIFT_TREAT_WARNINGS_AS_ERRORS = YES; + VERSIONING_SYSTEM = ""; + VERSION_INFO_PREFIX = ""; + }; + name = Debug_Use_UIKit; + }; + 841C60C42A69DE6B00E1C00F /* Debug_Use_UIKit */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; + CLANG_ENABLE_MODULES = YES; + CLANG_MODULES_AUTOLINK = NO; + CLANG_WARN_ASSIGN_ENUM = NO; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_FLOAT_CONVERSION = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + COPY_PHASE_STRIP = YES; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_NS_ASSERTIONS = YES; + ENABLE_STRICT_OBJC_MSGSEND = NO; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_SHADOW = YES; + INFOPLIST_FILE = Sources/Sentry/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + ONLY_ACTIVE_ARCH = YES; + OTHER_CFLAGS = "-DCARTHAGE_$(CARTHAGE)"; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.Sentry; + PRODUCT_NAME = Sentry; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + USE_HEADERMAP = YES; + }; + name = Debug_Use_UIKit; + }; + 841C60C52A69DE6B00E1C00F /* Debug_Use_UIKit */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 63AA76AE1EB9D5CD00D153DE /* SentryTests.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_ENABLE_MODULES = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = Tests/SentryTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.Sentry.tests; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; + SWIFT_OBJC_BRIDGING_HEADER = "Tests/SentryTests/SentryTests-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 5.0; + }; + name = Debug_Use_UIKit; + }; + 841C60C62A69DE6B00E1C00F /* Debug_Use_UIKit */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D81A34A0291D5715005A27A9 /* SentryPrivate.xcconfig */; + buildSettings = { + ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_MODULES_AUTOLINK = NO; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2022 Sentry. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryPrivate; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug_Use_UIKit; + }; + 841C60C72A69DE6B00E1C00F /* Debug_Use_UIKit */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D8199DCF29376FF40074249E /* SentrySwiftUI.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 97JCY7859U; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_C_LANGUAGE_STANDARD = gnu11; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2022 Sentry. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentrySwiftUI; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OBJC_BRIDGING_HEADER = Sources/SentrySwiftUI/SentrySwiftUI.h; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug_Use_UIKit; + }; + 841C60C82A69DE6B00E1C00F /* Debug_Use_UIKit */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 63AA76AE1EB9D5CD00D153DE /* SentryTests.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_ENABLE_MODULES = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = "SentryTests copy-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.Sentry.tests; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; + SWIFT_OBJC_BRIDGING_HEADER = "Tests/SentryTests/SentryTests-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 5.0; + }; + name = Debug_Use_UIKit; + }; + 841C60C92A69DE6B00E1C00F /* Debug_Use_UIKit */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 63AA76AE1EB9D5CD00D153DE /* SentryTests.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = NO; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = ""; + EXECUTABLE_PREFIX = lib; + GCC_C_LANGUAGE_STANDARD = gnu99; + MTL_ENABLE_DEBUG_INFO = YES; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtils; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = "SentryTestUtils/SentryTestUtils-ObjC-BridgingHeader.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug_Use_UIKit; + }; 8431EFD529B27B1100D8DC56 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 63AA76AE1EB9D5CD00D153DE /* SentryTests.xcconfig */; @@ -5326,6 +5609,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + OTHER_SWIFT_FLAGS = "-DSENTRY_USE_UIKIT"; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.Sentry.tests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -5654,6 +5938,7 @@ isa = XCConfigurationList; buildConfigurations = ( 6327C5E51EB8A783004E799B /* Debug */, + 841C60C32A69DE6B00E1C00F /* Debug_Use_UIKit */, D8079A6727178911004B0F61 /* Test */, 7BFC80A8282B736400E83A05 /* TestCI */, 6327C5E61EB8A783004E799B /* Release */, @@ -5665,6 +5950,7 @@ isa = XCConfigurationList; buildConfigurations = ( 63AA75A11EB8AEF500D153DE /* Debug */, + 841C60C42A69DE6B00E1C00F /* Debug_Use_UIKit */, D8079A6827178911004B0F61 /* Test */, 7BFC80A9282B736400E83A05 /* TestCI */, 63AA75A21EB8AEF500D153DE /* Release */, @@ -5676,6 +5962,7 @@ isa = XCConfigurationList; buildConfigurations = ( 63AA766D1EB8CB2F00D153DE /* Debug */, + 841C60C52A69DE6B00E1C00F /* Debug_Use_UIKit */, D8079A6927178911004B0F61 /* Test */, 7BFC80AA282B736400E83A05 /* TestCI */, 63AA766E1EB8CB2F00D153DE /* Release */, @@ -5687,6 +5974,7 @@ isa = XCConfigurationList; buildConfigurations = ( 8431EFD529B27B1100D8DC56 /* Debug */, + 841C60C82A69DE6B00E1C00F /* Debug_Use_UIKit */, 8431EFD629B27B1100D8DC56 /* Test */, 8431EFD729B27B1100D8DC56 /* TestCI */, 8431EFD829B27B1100D8DC56 /* Release */, @@ -5698,6 +5986,7 @@ isa = XCConfigurationList; buildConfigurations = ( 8431F01129B284F200D8DC56 /* Debug */, + 841C60C92A69DE6B00E1C00F /* Debug_Use_UIKit */, 8431F01229B284F200D8DC56 /* Test */, 8431F01329B284F200D8DC56 /* TestCI */, 8431F01429B284F200D8DC56 /* Release */, @@ -5709,6 +5998,7 @@ isa = XCConfigurationList; buildConfigurations = ( D8199DAE29376E9B0074249E /* Debug */, + 841C60C72A69DE6B00E1C00F /* Debug_Use_UIKit */, D8199DAF29376E9B0074249E /* Test */, D8199DB029376E9B0074249E /* TestCI */, D8199DB129376E9B0074249E /* Release */, @@ -5720,6 +6010,7 @@ isa = XCConfigurationList; buildConfigurations = ( D81A348D291D0AC0005A27A9 /* Debug */, + 841C60C62A69DE6B00E1C00F /* Debug_Use_UIKit */, D81A348E291D0AC0005A27A9 /* Test */, D81A348F291D0AC0005A27A9 /* TestCI */, D81A3490291D0AC0005A27A9 /* Release */, diff --git a/Sentry.xcodeproj/xcshareddata/xcschemes/Sentry.xcscheme b/Sentry.xcodeproj/xcshareddata/xcschemes/Sentry.xcscheme index 401f23ba682..850d9176a50 100644 --- a/Sentry.xcodeproj/xcshareddata/xcschemes/Sentry.xcscheme +++ b/Sentry.xcodeproj/xcshareddata/xcschemes/Sentry.xcscheme @@ -91,7 +91,7 @@ -typedef NS_ENUM(NSInteger, SENTRY_UIDeviceBatteryState) { - SENTRY_UIDeviceBatteryStateUnknown, - SENTRY_UIDeviceBatteryStateUnplugged, // on battery, discharging - SENTRY_UIDeviceBatteryStateCharging, // plugged in, less than 100% - SENTRY_UIDeviceBatteryStateFull, // plugged in, at 100% -} API_UNAVAILABLE(tvos); // available in iPhone 3.0 - -typedef NS_ENUM(NSInteger, SENTRY_UIDeviceOrientation) { - SENTRY_UIDeviceOrientationUnknown, - SENTRY_UIDeviceOrientationPortrait, // Device oriented vertically, home button on the bottom - SENTRY_UIDeviceOrientationPortraitUpsideDown, // Device oriented vertically, home button on the - // top - SENTRY_UIDeviceOrientationLandscapeLeft, // Device oriented horizontally, home button on the - // right - SENTRY_UIDeviceOrientationLandscapeRight, // Device oriented horizontally, home button on the - // left - SENTRY_UIDeviceOrientationFaceUp, // Device oriented flat, face up - SENTRY_UIDeviceOrientationFaceDown // Device oriented flat, face down -} API_UNAVAILABLE(tvos); - -static inline BOOL -SENTRY_UIDeviceOrientationIsLandscape(SENTRY_UIDeviceOrientation orientation) API_UNAVAILABLE(tvos) -{ - return ((orientation) == SENTRY_UIDeviceOrientationLandscapeLeft - || (orientation) == SENTRY_UIDeviceOrientationLandscapeRight); -} - -static inline BOOL -SENTRY_UIDeviceOrientationIsPortrait(SENTRY_UIDeviceOrientation orientation) API_UNAVAILABLE(tvos) -{ - return ((orientation) == SENTRY_UIDeviceOrientationPortrait - || (orientation) == SENTRY_UIDeviceOrientationPortraitUpsideDown); -} - -static inline __attribute__((always_inline)) BOOL -SENTRY_UIDeviceOrientationIsValidInterfaceOrientation(SENTRY_UIDeviceOrientation orientation) - API_UNAVAILABLE(tvos) -{ - return ((orientation) == SENTRY_UIDeviceOrientationPortrait - || (orientation) == SENTRY_UIDeviceOrientationPortraitUpsideDown - || (orientation) == SENTRY_UIDeviceOrientationLandscapeLeft - || (orientation) == SENTRY_UIDeviceOrientationLandscapeRight); -} - -typedef NS_ENUM(NSInteger, SENTRY_UITouchPhase) { - SENTRY_UITouchPhaseBegan, // whenever a finger touches the surface. - SENTRY_UITouchPhaseMoved, // whenever a finger moves on the surface. - SENTRY_UITouchPhaseStationary, // whenever a finger is touching the surface but hasn't moved - // since the previous event. - SENTRY_UITouchPhaseEnded, // whenever a finger leaves the surface. - SENTRY_UITouchPhaseCancelled, // whenever a touch doesn't end but we need to stop tracking (e.g. - // putting device to face) - SENTRY_UITouchPhaseRegionEntered API_AVAILABLE(ios(13.4), tvos(13.4)) - API_UNAVAILABLE(watchos), // whenever a touch is entering the region of a user interface - SENTRY_UITouchPhaseRegionMoved API_AVAILABLE(ios(13.4), tvos(13.4)) - API_UNAVAILABLE(watchos), // when a touch is inside the region of a user interface, but - // hasn’t yet made contact or left the region - SENTRY_UITouchPhaseRegionExited API_AVAILABLE(ios(13.4), tvos(13.4)) - API_UNAVAILABLE(watchos), // when a touch is exiting the region of a user interface -}; - -typedef NS_OPTIONS(NSUInteger, SENTRY_UIControlEvents) { - SENTRY_UIControlEventTouchDown = 1 << 0, // on all touch downs - SENTRY_UIControlEventTouchDownRepeat = 1 << 1, // on multiple touchdowns (tap count > 1) - SENTRY_UIControlEventTouchDragInside = 1 << 2, - SENTRY_UIControlEventTouchDragOutside = 1 << 3, - SENTRY_UIControlEventTouchDragEnter = 1 << 4, - SENTRY_UIControlEventTouchDragExit = 1 << 5, - SENTRY_UIControlEventTouchUpInside = 1 << 6, - SENTRY_UIControlEventTouchUpOutside = 1 << 7, - SENTRY_UIControlEventTouchCancel = 1 << 8, - - SENTRY_UIControlEventValueChanged = 1 << 12, // sliders, etc. - SENTRY_UIControlEventPrimaryActionTriggered API_AVAILABLE(ios(9.0)) = 1 - << 13, // semantic action: for buttons, etc. - SENTRY_UIControlEventMenuActionTriggered API_AVAILABLE(ios(14.0)) = 1 - << 14, // triggered when the menu gesture fires but before the menu presents - - SENTRY_UIControlEventEditingDidBegin = 1 << 16, // UITextField - SENTRY_UIControlEventEditingChanged = 1 << 17, - SENTRY_UIControlEventEditingDidEnd = 1 << 18, - SENTRY_UIControlEventEditingDidEndOnExit = 1 << 19, // 'return key' ending editing - - SENTRY_UIControlEventAllTouchEvents = 0x00000FFF, // for touch events - SENTRY_UIControlEventAllEditingEvents = 0x000F0000, // for UITextField - SENTRY_UIControlEventApplicationReserved = 0x0F000000, // range available for application use - SENTRY_UIControlEventSystemReserved = 0xF0000000, // range reserved for internal framework use - SENTRY_UIControlEventAllEvents = 0xFFFFFFFF -}; - -typedef NS_ENUM(NSInteger, SENTRY_UISceneActivationState) { - SENTRY_UISceneActivationStateUnattached = -1, - SENTRY_UISceneActivationStateForegroundActive, - SENTRY_UISceneActivationStateForegroundInactive, - SENTRY_UISceneActivationStateBackground -} API_AVAILABLE(ios(13.0)); - -# define SENTRY_UIDevice NSClassFromString(@"UIDevice") -# define SENTRY_UIButton NSClassFromString(@"UIButton") -# define SENTRY_UITextField NSClassFromString(@"UITextField") -# define SENTRY_UIViewController NSClassFromString(@"UIViewController") -# define SENTRY_UIView NSClassFromString(@"UIView") -# define SENTRY_UIBarButtonItem NSClassFromString(@"UIBarButtonItem") -# define SENTRY_UISegmentedControl NSClassFromString(@"UISegmentedControl") -# define SENTRY_UIPageControl NSClassFromString(@"UIPageControl") -# define SENTRY_UIApplication NSClassFromString(@"UIApplication") -# define SENTRY_UIWindow NSClassFromString(@"UIWindow") - -# define SENTRY_UIApplicationDidBecomeActiveNotification \ - @"UIApplicationDidBecomeActiveNotification" +# define SENTRY_UIDevice UIDevice +# define SENTRY_UIButton UIButton +# define SENTRY_UITextField UITextField +# define SENTRY_UIViewController UIViewController +# define SENTRY_UIView UIView +# define SENTRY_UIBarButtonItem UIBarButtonItem +# define SENTRY_UISegmentedControl UISegmentedControl +# define SENTRY_UIPageControl UIPageControl +# define SENTRY_UIApplication UIApplication +# define SENTRY_UIWindow UIWindow + +# define SENTRY_UIApplicationDidBecomeActiveNotification UIApplicationDidBecomeActiveNotification # define SENTRY_UIApplicationWillResignActiveNotification \ - @"UIApplicationWillResignActiveNotification" -# define SENTRY_UIApplicationWillTerminateNotification @"UIApplicationWillTerminateNotification" -# define SENTRY_UIKeyboardDidShowNotification @"UIKeyboardDidShowNotification" -# define SENTRY_UIKeyboardDidHideNotification @"UIKeyboardDidHideNotification" + UIApplicationWillResignActiveNotification +# define SENTRY_UIApplicationWillTerminateNotification UIApplicationWillTerminateNotification +# define SENTRY_UIKeyboardDidShowNotification UIKeyboardDidShowNotification +# define SENTRY_UIKeyboardDidHideNotification UIKeyboardDidHideNotification # define SENTRY_UIApplicationUserDidTakeScreenshotNotification \ - @"UIApplicationUserDidTakeScreenshotNotification" + UIApplicationUserDidTakeScreenshotNotification # define SENTRY_UIDeviceBatteryLevelDidChangeNotification \ - @"UIDeviceBatteryLevelDidChangeNotification" + UIDeviceBatteryLevelDidChangeNotification # define SENTRY_UIDeviceBatteryStateDidChangeNotification \ - @"UIDeviceBatteryStateDidChangeNotification" -# define SENTRY_UIDeviceOrientationDidChangeNotification \ - @"UIDeviceOrientationDidChangeNotification" -# define SENTRY_UIDeviceOrientationDidChangeNotification \ - @"UIDeviceOrientationDidChangeNotification" + UIDeviceBatteryStateDidChangeNotification +# define SENTRY_UIDeviceOrientationDidChangeNotification UIDeviceOrientationDidChangeNotification +# define SENTRY_UIDeviceOrientationDidChangeNotification UIDeviceOrientationDidChangeNotification # define SENTRY_UIApplicationDidEnterBackgroundNotification \ - @"UIApplicationDidEnterBackgroundNotification" + UIApplicationDidEnterBackgroundNotification # define SENTRY_UIApplicationDidReceiveMemoryWarningNotification \ - @"UIApplicationDidReceiveMemoryWarningNotification" + UIApplicationDidReceiveMemoryWarningNotification # define SENTRY_UIApplicationDidFinishLaunchingNotification \ - @"UIApplicationDidFinishLaunchingNotification" -# define SENTRY_UIWindowDidBecomeVisibleNotification @"UIWindowDidBecomeVisibleNotification" -# define SENTRY_UISceneWillConnectNotification @"UISceneWillConnectNotification" + UIApplicationDidFinishLaunchingNotification +# define SENTRY_UIWindowDidBecomeVisibleNotification UIWindowDidBecomeVisibleNotification +# define SENTRY_UISceneWillConnectNotification UISceneWillConnectNotification # define SENTRY_UIApplicationWillEnterForegroundNotification \ - @"UIApplicationWillEnterForegroundNotification" + UIApplicationWillEnterForegroundNotification # define SENTRY_UIApplicationWillEnterForegroundNotification \ - @"UIApplicationWillEnterForegroundNotification" + UIApplicationWillEnterForegroundNotification + +# if CONFIGURATION != Debug_Use_UIKit +# undef SENTRY_UIDevice +# undef SENTRY_UIButton +# undef SENTRY_UITextField +# undef SENTRY_UIViewController +# undef SENTRY_UIView +# undef SENTRY_UIBarButtonItem +# undef SENTRY_UISegmentedControl +# undef SENTRY_UIPageControl +# undef SENTRY_UIApplication +# undef SENTRY_UIWindow + +# undef SENTRY_UIApplicationDidBecomeActiveNotification +# undef SENTRY_UIApplicationWillResignActiveNotification +# undef SENTRY_UIApplicationWillTerminateNotification +# undef SENTRY_UIKeyboardDidShowNotification +# undef SENTRY_UIKeyboardDidHideNotification +# undef SENTRY_UIApplicationUserDidTakeScreenshotNotification +# undef SENTRY_UIDeviceBatteryLevelDidChangeNotification +# undef SENTRY_UIDeviceBatteryStateDidChangeNotification +# undef SENTRY_UIDeviceOrientationDidChangeNotification +# undef SENTRY_UIDeviceOrientationDidChangeNotification +# undef SENTRY_UIApplicationDidEnterBackgroundNotification +# undef SENTRY_UIApplicationDidReceiveMemoryWarningNotification +# undef SENTRY_UIApplicationDidFinishLaunchingNotification +# undef SENTRY_UIWindowDidBecomeVisibleNotification +# undef SENTRY_UISceneWillConnectNotification +# undef SENTRY_UIApplicationWillEnterForegroundNotification +# undef SENTRY_UIApplicationWillEnterForegroundNotification + +# define SENTRY_UIDevice NSClassFromString(@"UIDevice") +# define SENTRY_UIButton NSClassFromString(@"UIButton") +# define SENTRY_UITextField NSClassFromString(@"UITextField") +# define SENTRY_UIViewController NSClassFromString(@"UIViewController") +# define SENTRY_UIView NSClassFromString(@"UIView") +# define SENTRY_UIBarButtonItem NSClassFromString(@"UIBarButtonItem") +# define SENTRY_UISegmentedControl NSClassFromString(@"UISegmentedControl") +# define SENTRY_UIPageControl NSClassFromString(@"UIPageControl") +# define SENTRY_UIApplication NSClassFromString(@"UIApplication") +# define SENTRY_UIWindow NSClassFromString(@"UIWindow") + +# define SENTRY_UIApplicationDidBecomeActiveNotification \ + @"UIApplicationDidBecomeActiveNotification" +# define SENTRY_UIApplicationWillResignActiveNotification \ + @"UIApplicationWillResignActiveNotification" +# define SENTRY_UIApplicationWillTerminateNotification \ + @"UIApplicationWillTerminateNotification" +# define SENTRY_UIKeyboardDidShowNotification @"UIKeyboardDidShowNotification" +# define SENTRY_UIKeyboardDidHideNotification @"UIKeyboardDidHideNotification" +# define SENTRY_UIApplicationUserDidTakeScreenshotNotification \ + @"UIApplicationUserDidTakeScreenshotNotification" +# define SENTRY_UIDeviceBatteryLevelDidChangeNotification \ + @"UIDeviceBatteryLevelDidChangeNotification" +# define SENTRY_UIDeviceBatteryStateDidChangeNotification \ + @"UIDeviceBatteryStateDidChangeNotification" +# define SENTRY_UIDeviceOrientationDidChangeNotification \ + @"UIDeviceOrientationDidChangeNotification" +# define SENTRY_UIDeviceOrientationDidChangeNotification \ + @"UIDeviceOrientationDidChangeNotification" +# define SENTRY_UIApplicationDidEnterBackgroundNotification \ + @"UIApplicationDidEnterBackgroundNotification" +# define SENTRY_UIApplicationDidReceiveMemoryWarningNotification \ + @"UIApplicationDidReceiveMemoryWarningNotification" +# define SENTRY_UIApplicationDidFinishLaunchingNotification \ + @"UIApplicationDidFinishLaunchingNotification" +# define SENTRY_UIWindowDidBecomeVisibleNotification @"UIWindowDidBecomeVisibleNotification" +# define SENTRY_UISceneWillConnectNotification @"UISceneWillConnectNotification" +# define SENTRY_UIApplicationWillEnterForegroundNotification \ + @"UIApplicationWillEnterForegroundNotification" +# define SENTRY_UIApplicationWillEnterForegroundNotification \ + @"UIApplicationWillEnterForegroundNotification" +# endif // !defined(SENTRY_USE_UIKIT) + #endif // __has_include() #define SENTRY_NO_INIT \ diff --git a/Sources/Sentry/SentryBreadcrumbTracker.m b/Sources/Sentry/SentryBreadcrumbTracker.m index 281c8f259ff..87246466c65 100644 --- a/Sources/Sentry/SentryBreadcrumbTracker.m +++ b/Sources/Sentry/SentryBreadcrumbTracker.m @@ -143,7 +143,7 @@ - (void)addEnabledCrumb #if SENTRY_HAS_UIKIT + (BOOL)avoidSender:(id)sender forTarget:(id)target action:(NSString *)action { - if ([sender isKindOfClass:SENTRY_UITextField]) { + if ([sender isKindOfClass:[SENTRY_UITextField class]]) { // This is required to avoid creating breadcrumbs for every key pressed in a text field. // Textfield may invoke many types of event, in order to check if is a // `UIControlEventEditingChanged` we need to compare the current action to all events @@ -153,9 +153,8 @@ + (BOOL)avoidSender:(id)sender forTarget:(id)target action:(NSString *)action UITextField *textField = sender; NSArray *actions = [textField actionsForTarget:target - forControlEvent:(UIControlEvents) - SENTRY_UIControlEventEditingChanged]; // ???: does this cast force - // linking UIKit? + forControlEvent:(UIControlEvents)UIControlEventEditingChanged]; // ???: does this cast + // force linking UIKit? return [actions containsObject:action]; } return NO; @@ -173,8 +172,7 @@ - (void)swizzleSendAction NSDictionary *data = nil; for (UITouch *touch in event.allTouches) { - if (touch.phase == SENTRY_UITouchPhaseCancelled - || touch.phase == SENTRY_UITouchPhaseEnded) { + if (touch.phase == UITouchPhaseCancelled || touch.phase == UITouchPhaseEnded) { data = [SentryBreadcrumbTracker extractDataFromView:touch.view]; } } @@ -238,7 +236,7 @@ + (NSDictionary *)extractDataFromView:(UIView *)view [result setValue:view.accessibilityIdentifier forKey:@"accessibilityIdentifier"]; } - if ([view isKindOfClass:SENTRY_UIButton]) { + if ([view isKindOfClass:[SENTRY_UIButton class]]) { UIButton *button = (UIButton *)view; if (button.currentTitle && ![button.currentTitle isEqual:@""]) { [result setValue:[button currentTitle] forKey:@"title"]; diff --git a/Sources/Sentry/SentryExtraContextProvider.m b/Sources/Sentry/SentryExtraContextProvider.m index dec3fb88e1c..84b674ab5af 100644 --- a/Sources/Sentry/SentryExtraContextProvider.m +++ b/Sources/Sentry/SentryExtraContextProvider.m @@ -59,18 +59,16 @@ - (NSDictionary *)getExtraDeviceContext extraDeviceContext[@"processor_count"] = @([self.processInfoWrapper processorCount]); #if TARGET_OS_IOS - if (self.deviceWrapper.orientation != SENTRY_UIDeviceOrientationUnknown) { + if (self.deviceWrapper.orientation != UIDeviceOrientationUnknown) { extraDeviceContext[@"orientation"] - = SENTRY_UIDeviceOrientationIsPortrait( - (SENTRY_UIDeviceOrientation)self.deviceWrapper.orientation) + = UIDeviceOrientationIsPortrait((UIDeviceOrientation)self.deviceWrapper.orientation) ? @"portrait" : @"landscape"; } if (self.deviceWrapper.isBatteryMonitoringEnabled) { extraDeviceContext[@"charging"] - = self.deviceWrapper.batteryState == SENTRY_UIDeviceBatteryStateCharging ? @(YES) - : @(NO); + = self.deviceWrapper.batteryState == UIDeviceBatteryStateCharging ? @(YES) : @(NO); extraDeviceContext[@"battery_level"] = @((int)(self.deviceWrapper.batteryLevel * 100)); } #endif diff --git a/Sources/Sentry/SentrySubClassFinder.m b/Sources/Sentry/SentrySubClassFinder.m index d71b4bb1310..f6486e1635b 100644 --- a/Sources/Sentry/SentrySubClassFinder.m +++ b/Sources/Sentry/SentrySubClassFinder.m @@ -25,10 +25,11 @@ - (instancetype)initWithDispatchQueue:(SentryDispatchQueueWrapper *)dispatchQueu return self; } +#if SENTRY_HAS_UIKIT - (void)actOnSubclassesOfViewControllerInImage:(NSString *)imageName block:(void (^)(Class))block; { [self.dispatchQueue dispatchAsyncWithBlock:^{ - Class viewControllerClass = SENTRY_UIViewController; + Class viewControllerClass = [SENTRY_UIViewController class]; if (viewControllerClass == nil) { SENTRY_LOG_DEBUG(@"UIViewController class not found."); return; @@ -73,6 +74,7 @@ - (void)actOnSubclassesOfViewControllerInImage:(NSString *)imageName block:(void }]; }]; } +#endif // SENTRY_HAS_UIKIT - (BOOL)isClass:(Class)childClass subClassOf:(Class)parentClass { diff --git a/Sources/Sentry/SentrySystemEventBreadcrumbs.m b/Sources/Sentry/SentrySystemEventBreadcrumbs.m index 8e747d8c816..ee06b496c7d 100644 --- a/Sources/Sentry/SentrySystemEventBreadcrumbs.m +++ b/Sources/Sentry/SentrySystemEventBreadcrumbs.m @@ -127,15 +127,15 @@ - (void)batteryStateChanged:(NSNotification *)notification UIDeviceBatteryState currentState = [currentDevice batteryState]; BOOL isPlugged = NO; // UIDeviceBatteryStateUnknown or UIDeviceBatteryStateUnplugged - if ((currentState == SENTRY_UIDeviceBatteryStateCharging) - || (currentState == SENTRY_UIDeviceBatteryStateFull)) { + if ((currentState == UIDeviceBatteryStateCharging) + || (currentState == UIDeviceBatteryStateFull)) { isPlugged = YES; } float currentLevel = [currentDevice batteryLevel]; NSMutableDictionary *batteryData = [NSMutableDictionary new]; // W3C spec says level must be null if it is unknown - if ((currentState != SENTRY_UIDeviceBatteryStateUnknown) && (currentLevel != -1.0)) { + if ((currentState != UIDeviceBatteryStateUnknown) && (currentLevel != -1.0)) { float w3cLevel = (currentLevel * 100); batteryData[@"level"] = @(w3cLevel); } else { @@ -165,16 +165,15 @@ - (void)orientationChanged:(NSNotification *)notification SentryBreadcrumb *crumb = [[SentryBreadcrumb alloc] initWithLevel:kSentryLevelInfo category:@"device.orientation"]; - SENTRY_UIDeviceOrientation currentOrientation - = (SENTRY_UIDeviceOrientation)currentDevice.orientation; + UIDeviceOrientation currentOrientation = currentDevice.orientation; // Ignore changes in device orientation if unknown, face up, or face down. - if (!SENTRY_UIDeviceOrientationIsValidInterfaceOrientation(currentOrientation)) { + if (!UIDeviceOrientationIsValidInterfaceOrientation(currentOrientation)) { SENTRY_LOG_DEBUG(@"currentOrientation is unknown."); return; } - if (SENTRY_UIDeviceOrientationIsLandscape(currentOrientation)) { + if (UIDeviceOrientationIsLandscape(currentOrientation)) { crumb.data = @{ @"position" : @"landscape" }; } else { crumb.data = @{ @"position" : @"portrait" }; diff --git a/Sources/Sentry/SentryUIApplication.m b/Sources/Sentry/SentryUIApplication.m index 143cfd36338..26574264b87 100644 --- a/Sources/Sentry/SentryUIApplication.m +++ b/Sources/Sentry/SentryUIApplication.m @@ -35,8 +35,8 @@ - (UIApplication *)sharedApplication if (@available(iOS 13.0, tvOS 13.0, *)) { NSArray *scenes = [self getApplicationConnectedScenes:app]; for (UIScene *scene in scenes) { - if (scene.activationState == SENTRY_UISceneActivationStateForegroundActive - && scene.delegate && [scene.delegate respondsToSelector:@selector(window)]) { + if (scene.activationState == UISceneActivationStateForegroundActive && scene.delegate && + [scene.delegate respondsToSelector:@selector(window)]) { id window = [scene.delegate performSelector:@selector(window)]; if (window) { [result addObject:window]; diff --git a/Sources/Sentry/SentryUIDeviceWrapper.m b/Sources/Sentry/SentryUIDeviceWrapper.m index 53c3381cd69..72ddad1ead8 100644 --- a/Sources/Sentry/SentryUIDeviceWrapper.m +++ b/Sources/Sentry/SentryUIDeviceWrapper.m @@ -61,9 +61,9 @@ - (void)dealloc [self stop]; } -- (SENTRY_UIDeviceOrientation)orientation +- (UIDeviceOrientation)orientation { - return (SENTRY_UIDeviceOrientation)[SENTRY_UIDevice currentDevice].orientation; + return (UIDeviceOrientation)[SENTRY_UIDevice currentDevice].orientation; } - (BOOL)isBatteryMonitoringEnabled @@ -71,9 +71,9 @@ - (BOOL)isBatteryMonitoringEnabled return [SENTRY_UIDevice currentDevice].isBatteryMonitoringEnabled; } -- (SENTRY_UIDeviceBatteryState)batteryState +- (UIDeviceBatteryState)batteryState { - return (SENTRY_UIDeviceBatteryState)[SENTRY_UIDevice currentDevice].batteryState; + return (UIDeviceBatteryState)[SENTRY_UIDevice currentDevice].batteryState; } - (float)batteryLevel diff --git a/Sources/Sentry/SentryUIEventTracker.m b/Sources/Sentry/SentryUIEventTracker.m index ef3136083a0..afd6c9f9347 100644 --- a/Sources/Sentry/SentryUIEventTracker.m +++ b/Sources/Sentry/SentryUIEventTracker.m @@ -136,7 +136,7 @@ - (void)start transactionName, bindToScope ? @"YES" : @"NO"); }]; - if ([[sender class] isSubclassOfClass:SENTRY_UIView]) { + if ([[sender class] isSubclassOfClass:[SENTRY_UIView class]]) { UIView *view = sender; if (view.accessibilityIdentifier) { [transaction setTagValue:view.accessibilityIdentifier @@ -170,10 +170,10 @@ - (void)stop - (NSString *)getOperation:(id)sender { Class senderClass = [sender class]; - if ([senderClass isSubclassOfClass:SENTRY_UIButton] || - [senderClass isSubclassOfClass:SENTRY_UIBarButtonItem] || - [senderClass isSubclassOfClass:SENTRY_UISegmentedControl] || - [senderClass isSubclassOfClass:SENTRY_UIPageControl]) { + if ([senderClass isSubclassOfClass:[SENTRY_UIButton class]] || + [senderClass isSubclassOfClass:[SENTRY_UIBarButtonItem class]] || + [senderClass isSubclassOfClass:[SENTRY_UISegmentedControl class]] || + [senderClass isSubclassOfClass:[SENTRY_UIPageControl class]]) { return SentrySpanOperationUIActionClick; } diff --git a/Sources/Sentry/SentryUIViewControllerSwizzling.m b/Sources/Sentry/SentryUIViewControllerSwizzling.m index 7be6636602e..c3e38ba9685 100644 --- a/Sources/Sentry/SentryUIViewControllerSwizzling.m +++ b/Sources/Sentry/SentryUIViewControllerSwizzling.m @@ -242,7 +242,7 @@ - (void)swizzleRootViewControllerFromSceneDelegateNotification:(NSNotification * NSArray *windowList = windows; for (id window in windowList) { - if ([window isKindOfClass:SENTRY_UIWindow] + if ([window isKindOfClass:[SENTRY_UIWindow class]] && ((UIWindow *)window).rootViewController != nil) { [self swizzleRootViewControllerAndDescendant:((UIWindow *)window).rootViewController]; @@ -359,7 +359,8 @@ - (void)swizzleLoadView:(Class)class // workaround, we skip swizzling the loadView and accept that the SKD doesn't create a span for // loadView if the UIViewController doesn't implement it. SEL selector = NSSelectorFromString(@"loadView"); - IMP viewControllerImp = class_getMethodImplementation(SENTRY_UIViewController, selector); + IMP viewControllerImp + = class_getMethodImplementation([SENTRY_UIViewController class], selector); IMP classLoadViewImp = class_getMethodImplementation(class, selector); if (viewControllerImp == classLoadViewImp) { return; diff --git a/Sources/Sentry/SentryViewHierarchy.m b/Sources/Sentry/SentryViewHierarchy.m index 189c25da2b6..4aeb1bef2c0 100644 --- a/Sources/Sentry/SentryViewHierarchy.m +++ b/Sources/Sentry/SentryViewHierarchy.m @@ -129,7 +129,7 @@ - (int)viewHierarchyFromView:(UIView *)view intoContext:(SentryCrashJSONEncodeCo tryJson(sentrycrashjson_addFloatingPointElement(context, "alpha", view.alpha)); tryJson(sentrycrashjson_addBooleanElement(context, "visible", !view.hidden)); - if ([view.nextResponder isKindOfClass:SENTRY_UIViewController]) { + if ([view.nextResponder isKindOfClass:[SENTRY_UIViewController class]]) { UIViewController *vc = (UIViewController *)view.nextResponder; if (vc.view == view) { const char *viewControllerClassName = diff --git a/Sources/Sentry/include/SentrySubClassFinder.h b/Sources/Sentry/include/SentrySubClassFinder.h index 889fdbaf0e0..3c7a26ade80 100644 --- a/Sources/Sentry/include/SentrySubClassFinder.h +++ b/Sources/Sentry/include/SentrySubClassFinder.h @@ -12,6 +12,7 @@ SENTRY_NO_INIT - (instancetype)initWithDispatchQueue:(SentryDispatchQueueWrapper *)dispatchQueue objcRuntimeWrapper:(id)objcRuntimeWrapper; +#if SENTRY_HAS_UIKIT /** * Fetch all subclasses of @c UIViewController from given objc Image on a background thread and then * act on them on the main thread. As there is no straightforward way to get all sub-classes in @@ -22,6 +23,7 @@ SENTRY_NO_INIT * @param block The block to execute for each subclass. This block runs on the main thread. */ - (void)actOnSubclassesOfViewControllerInImage:(NSString *)imageName block:(void (^)(Class))block; +#endif // SENTRY_HAS_UIKIT @end diff --git a/Sources/Sentry/include/SentryUIDeviceWrapper.h b/Sources/Sentry/include/SentryUIDeviceWrapper.h index fd3a874d9c8..e336cb9a82a 100644 --- a/Sources/Sentry/include/SentryUIDeviceWrapper.h +++ b/Sources/Sentry/include/SentryUIDeviceWrapper.h @@ -10,9 +10,9 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; - (instancetype)initWithDispatchQueueWrapper:(SentryDispatchQueueWrapper *)dispatchQueueWrapper; - (void)stop; -- (SENTRY_UIDeviceOrientation)orientation; +- (UIDeviceOrientation)orientation; - (BOOL)isBatteryMonitoringEnabled; -- (SENTRY_UIDeviceBatteryState)batteryState; +- (UIDeviceBatteryState)batteryState; - (float)batteryLevel; #endif diff --git a/Tests/SentryTests/Categories/UIViewControllerSentryTests.swift b/Tests/SentryTests/Categories/UIViewControllerSentryTests.swift index 4ab2f0f8c69..0ba28d2b154 100644 --- a/Tests/SentryTests/Categories/UIViewControllerSentryTests.swift +++ b/Tests/SentryTests/Categories/UIViewControllerSentryTests.swift @@ -1,11 +1,10 @@ import XCTest -#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) +#if (os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)) && SENTRY_USE_UIKIT class UIViewControllerSentryTests: XCTestCase { func testOnlyOneViewController() { let viewController = UIViewController() - XCTAssertEqual([viewController], viewController.sentry_descendantViewControllers) } @@ -37,4 +36,4 @@ class UIViewControllerSentryTests: XCTestCase { } } -#endif +#endif // (os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)) && SENTRY_USE_UIKIT diff --git a/Tests/SentryTests/Categories/UIViewRecursiveDescriptionTests.swift b/Tests/SentryTests/Categories/UIViewRecursiveDescriptionTests.swift index d7eaec6b1ef..7accc3dffee 100644 --- a/Tests/SentryTests/Categories/UIViewRecursiveDescriptionTests.swift +++ b/Tests/SentryTests/Categories/UIViewRecursiveDescriptionTests.swift @@ -1,7 +1,7 @@ @testable import Sentry import XCTest -#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) +#if (os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)) && SENTRY_USE_UIKIT class UIViewRecursiveDescriptionTests: XCTestCase { func testSimpleView() { let view = UIView() @@ -27,4 +27,4 @@ class UIViewRecursiveDescriptionTests: XCTestCase { XCTAssertEqual(description, expected.joined(separator: "\n") + "\n") } } -#endif +#endif // (os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)) && SENTRY_USE_UIKIT diff --git a/scripts/no-changes-in-high-risk-files.sh b/scripts/no-changes-in-high-risk-files.sh index a943b74d234..03569c8063f 100755 --- a/scripts/no-changes-in-high-risk-files.sh +++ b/scripts/no-changes-in-high-risk-files.sh @@ -6,9 +6,9 @@ set -euox pipefail ACTUAL=$(shasum -a 256 ./Sources/Sentry/SentryNSURLSessionTaskSearch.m ./Sources/Sentry/SentryNetworkTracker.m ./Sources/Sentry/SentryUIViewControllerSwizzling.m ./Sources/Sentry/SentryNSDataSwizzling.m ./Sources/Sentry/SentrySubClassFinder.m ./Sources/Sentry/SentryCoreDataSwizzling.m ./Sources/Sentry/SentrySwizzleWrapper.m ./Sources/Sentry/include/SentrySwizzle.h ./Sources/Sentry/SentrySwizzle.m) EXPECTED="819d5ca5e3db2ac23c859b14c149b7f0754d3ae88bea1dba92c18f49a81da0e1 ./Sources/Sentry/SentryNSURLSessionTaskSearch.m 797f1e4f1f4d0986770c749c6614243417373d3858044a0aa6e16bd4a52533ed ./Sources/Sentry/SentryNetworkTracker.m -44a1349af49fd76a6b0a7728d1e363dc38218a6a29ac369766d16f94da4b3f80 ./Sources/Sentry/SentryUIViewControllerSwizzling.m +eb2eddc05a7d567271c39b71cd240ab16e39c398cfb0e50094a83549d7333ff2 ./Sources/Sentry/SentryUIViewControllerSwizzling.m e95e62ec7363984f20c78643bb7d992a41a740f97e1befb71525ac34caf88b37 ./Sources/Sentry/SentryNSDataSwizzling.m -0a685b5ee8d660958b79b663df7e65ca558d976c8be8ad44d3d2ff11bc8f8e62 ./Sources/Sentry/SentrySubClassFinder.m +1dce42aea918131df3538881882ea1b6dfe5afc0a11a5a914c0e5cac78e039cc ./Sources/Sentry/SentrySubClassFinder.m 59db11da66e6ac0058526be0be08b57cdccd3727033e85164a631b205e972134 ./Sources/Sentry/SentryCoreDataSwizzling.m 71a493066cb209b674cdc434db74d45caf3afa3e5560cc2a28fccd64b0556bf0 ./Sources/Sentry/SentrySwizzleWrapper.m b1c642450170358cab39b4cc6cd546f27c41b12eacb90c3ad93f87733d46e56c ./Sources/Sentry/include/SentrySwizzle.h