Skip to content

Commit 83d27f6

Browse files
authored
ref: Convert SentryUIDevice to Swift (#5943)
* ref: Convert SentryUIDevice to Swift * PR feedback
1 parent c03a8d8 commit 83d27f6

14 files changed

+154
-155
lines changed

Sentry.xcodeproj/project.pbxproj

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@
5050
0A9E917128DC7E7000FB4182 /* SentryInternalCDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A9E917028DC7E7000FB4182 /* SentryInternalCDefines.h */; };
5151
0AAE201E28ED9B9400D0CD80 /* SentryReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AAE201D28ED9B9400D0CD80 /* SentryReachability.m */; };
5252
0AAE202128ED9BCC00D0CD80 /* SentryReachability.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AAE202028ED9BCC00D0CD80 /* SentryReachability.h */; };
53-
0ADC33EC28D9BB780078D980 /* SentryUIDeviceWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 0ADC33EB28D9BB780078D980 /* SentryUIDeviceWrapper.m */; };
54-
0ADC33EE28D9BB890078D980 /* SentryUIDeviceWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0ADC33ED28D9BB890078D980 /* SentryUIDeviceWrapper.h */; };
5553
0ADC33F128D9BE940078D980 /* TestSentryUIDeviceWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ADC33EF28D9BE690078D980 /* TestSentryUIDeviceWrapper.swift */; };
5654
0AE455AD28F584D2006680E5 /* SentryReachabilityTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AE455AC28F584D2006680E5 /* SentryReachabilityTests.m */; };
5755
15360CCF2432777500112302 /* SentrySessionTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 15360CCE2432777400112302 /* SentrySessionTracker.m */; };
@@ -1107,6 +1105,7 @@
11071105
FA8E58F12E0AD4270049F69D /* SentryDispatchQueueWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8E58F02E0AD4220049F69D /* SentryDispatchQueueWrapper.swift */; };
11081106
FA90FAA82E06614E008CAAE8 /* SentryExtraPackages.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA90FAA72E06614B008CAAE8 /* SentryExtraPackages.swift */; };
11091107
FA90FAFD2E070A3B008CAAE8 /* SentryURLRequestFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA90FAFC2E070A3B008CAAE8 /* SentryURLRequestFactory.swift */; };
1108+
FAAB2F972E4D345800FE8B7E /* SentryUIDeviceWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAB2F962E4D344F00FE8B7E /* SentryUIDeviceWrapper.swift */; };
11101109
FAAB30F32E4E8F2C00FE8B7E /* SentryInAppLogic.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAB30F22E4E8F2C00FE8B7E /* SentryInAppLogic.swift */; };
11111110
FAB359982E05D7E90083D5E3 /* SentryEventSwiftHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = FAB359972E05D7E90083D5E3 /* SentryEventSwiftHelper.h */; };
11121111
FAB3599A2E05D8080083D5E3 /* SentryEventSwiftHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB359992E05D8080083D5E3 /* SentryEventSwiftHelper.m */; };
@@ -1286,8 +1285,6 @@
12861285
0A9E917028DC7E7000FB4182 /* SentryInternalCDefines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryInternalCDefines.h; path = include/SentryInternalCDefines.h; sourceTree = "<group>"; };
12871286
0AAE201D28ED9B9400D0CD80 /* SentryReachability.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryReachability.m; sourceTree = "<group>"; };
12881287
0AAE202028ED9BCC00D0CD80 /* SentryReachability.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryReachability.h; path = include/SentryReachability.h; sourceTree = "<group>"; };
1289-
0ADC33EB28D9BB780078D980 /* SentryUIDeviceWrapper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryUIDeviceWrapper.m; sourceTree = "<group>"; };
1290-
0ADC33ED28D9BB890078D980 /* SentryUIDeviceWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryUIDeviceWrapper.h; path = include/SentryUIDeviceWrapper.h; sourceTree = "<group>"; };
12911288
0ADC33EF28D9BE690078D980 /* TestSentryUIDeviceWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestSentryUIDeviceWrapper.swift; sourceTree = "<group>"; };
12921289
0AE455AC28F584D2006680E5 /* SentryReachabilityTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryReachabilityTests.m; sourceTree = "<group>"; };
12931290
15360CCE2432777400112302 /* SentrySessionTracker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentrySessionTracker.m; sourceTree = "<group>"; };
@@ -2454,6 +2451,7 @@
24542451
FA8E58F02E0AD4220049F69D /* SentryDispatchQueueWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryDispatchQueueWrapper.swift; sourceTree = "<group>"; };
24552452
FA90FAA72E06614B008CAAE8 /* SentryExtraPackages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryExtraPackages.swift; sourceTree = "<group>"; };
24562453
FA90FAFC2E070A3B008CAAE8 /* SentryURLRequestFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryURLRequestFactory.swift; sourceTree = "<group>"; };
2454+
FAAB2F962E4D344F00FE8B7E /* SentryUIDeviceWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUIDeviceWrapper.swift; sourceTree = "<group>"; };
24572455
FAAB30F22E4E8F2C00FE8B7E /* SentryInAppLogic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryInAppLogic.swift; sourceTree = "<group>"; };
24582456
FAB359972E05D7E90083D5E3 /* SentryEventSwiftHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryEventSwiftHelper.h; path = include/SentryEventSwiftHelper.h; sourceTree = "<group>"; };
24592457
FAB359992E05D8080083D5E3 /* SentryEventSwiftHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryEventSwiftHelper.m; sourceTree = "<group>"; };
@@ -2844,8 +2842,6 @@
28442842
7B7D873524864C9D00D2ECFF /* SentryCrashDefaultMachineContextWrapper.m */,
28452843
7B7A30C524B48321005A4C6E /* SentryCrashWrapper.h */,
28462844
7B7A30C724B48389005A4C6E /* SentryCrashWrapper.m */,
2847-
0ADC33ED28D9BB890078D980 /* SentryUIDeviceWrapper.h */,
2848-
0ADC33EB28D9BB780078D980 /* SentryUIDeviceWrapper.m */,
28492845
62C97D372CC64E4900DDA204 /* SentryUncaughtNSExceptions.h */,
28502846
62C97D392CC64E6B00DDA204 /* SentryUncaughtNSExceptions.m */,
28512847
);
@@ -4764,6 +4760,7 @@
47644760
FA67DCCC2DDBD4EA00896B02 /* Helper */ = {
47654761
isa = PBXGroup;
47664762
children = (
4763+
FAAB2F962E4D344F00FE8B7E /* SentryUIDeviceWrapper.swift */,
47674764
FA90FAA72E06614B008CAAE8 /* SentryExtraPackages.swift */,
47684765
FA67DCC82DDBD4EA00896B02 /* Log */,
47694766
FA67DCC92DDBD4EA00896B02 /* SentryBaggageSerialization.swift */,
@@ -4896,7 +4893,6 @@
48964893
92E5F3D62CDBB3BF00B7AD98 /* SentrySampling.h in Headers */,
48974894
92672BB629C9A2A9006B021C /* SentryBreadcrumb+Private.h in Headers */,
48984895
03BCC38E27E2A377003232C7 /* SentryProfilingConditionals.h in Headers */,
4899-
0ADC33EE28D9BB890078D980 /* SentryUIDeviceWrapper.h in Headers */,
49004896
848A451A2BBF8D33006AAAEC /* SentryContinuousProfiler.h in Headers */,
49014897
8E133FA625E72EB400ABD0BF /* SentrySamplingContext.h in Headers */,
49024898
0A9BF4E428A114B50068D266 /* SentryViewHierarchyIntegration.h in Headers */,
@@ -5597,6 +5593,7 @@
55975593
7BDB03BB2513652900BAE198 /* _SentryDispatchQueueWrapperInternal.m in Sources */,
55985594
FA6FC0A32E0B5ACE00ED2669 /* SentrySdkPackage.swift in Sources */,
55995595
D8739D142BEE5049007D2F66 /* SentryRRWebSpanEvent.swift in Sources */,
5596+
FAAB2F972E4D345800FE8B7E /* SentryUIDeviceWrapper.swift in Sources */,
56005597
7B6C5EDE264E8DF00010D138 /* SentryFramesTracker.m in Sources */,
56015598
D84F833E2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m in Sources */,
56025599
7B6438AB26A70F24000D0F65 /* UIViewController+Sentry.m in Sources */,
@@ -5724,7 +5721,6 @@
57245721
63FE70D720DA4C1000CDBAE8 /* SentryCrashMonitor_MachException.c in Sources */,
57255722
7B96572226830D2400C66E25 /* SentryScopeSyncC.c in Sources */,
57265723
0A9BF4E228A114940068D266 /* SentryViewHierarchyIntegration.m in Sources */,
5727-
0ADC33EC28D9BB780078D980 /* SentryUIDeviceWrapper.m in Sources */,
57285724
7BBD188B244841FB00427C76 /* SentryHttpDateParser.m in Sources */,
57295725
D8AFC03D2BDA79BF00118BE1 /* SentryReplayVideoMaker.swift in Sources */,
57305726
840A11122B61E27500650D02 /* SentrySamplerDecision.m in Sources */,

SentryTestUtils/SentryTestUtils-ObjC-BridgingHeader.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
# import "SentryAppStartTracker.h"
1111
# import "SentryDisplayLinkWrapper.h"
1212
# import "SentryFramesTracker+TestInit.h"
13-
# import "SentryUIDeviceWrapper.h"
1413
# import "SentryUIViewControllerPerformanceTracker.h"
1514
#endif // SENTRY_HAS_UIKIT
1615

Sources/Sentry/SentryCrashWrapper.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#import "SentryNSProcessInfoWrapper.h"
88
#import "SentryScope+PrivateSwift.h"
99
#import "SentryScope.h"
10-
#import "SentryUIDeviceWrapper.h"
10+
#import "SentrySwift.h"
1111
#import <SentryCrashCachedData.h>
1212
#import <SentryCrashDebug.h>
1313
#import <SentryCrashMonitor_System.h>

Sources/Sentry/SentryDependencyContainer.m

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#import "SentrySwift.h"
2121
#import "SentrySystemWrapper.h"
2222
#import "SentryThreadInspector.h"
23-
#import "SentryUIDeviceWrapper.h"
2423
#import <SentryAppStateManager.h>
2524
#import <SentryCrash.h>
2625
#import <SentryCrashWrapper.h>
@@ -49,10 +48,6 @@
4948
# import <SentryWatchdogTerminationBreadcrumbProcessor.h>
5049
#endif // SENTRY_HAS_UIKIT
5150

52-
#if TARGET_OS_IOS
53-
# import "SentryUIDeviceWrapper.h"
54-
#endif // TARGET_OS_IOS
55-
5651
#if TARGET_OS_OSX
5752
# import "SentryNSApplication.h"
5853
#endif
@@ -168,7 +163,8 @@ - (instancetype)init
168163

169164
_notificationCenterWrapper = [NSNotificationCenter defaultCenter];
170165
#if SENTRY_HAS_UIKIT
171-
_uiDeviceWrapper = [[SentryUIDeviceWrapper alloc] init];
166+
_uiDeviceWrapper =
167+
[[SentryDefaultUIDeviceWrapper alloc] initWithQueueWrapper:_dispatchQueueWrapper];
172168
_application = [[SentryUIApplication alloc]
173169
initWithNotificationCenterWrapper:_notificationCenterWrapper
174170
dispatchQueueWrapper:_dispatchQueueWrapper];

Sources/Sentry/SentryExtraContextProvider.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@
66

77
@class SentryCrashWrapper;
88
@class SentryNSProcessInfoWrapper;
9-
@class SentryUIDeviceWrapper;
10-
11-
#if TARGET_OS_IOS && SENTRY_HAS_UIKIT
12-
@class SentryUIDeviceWrapper;
13-
#endif // TARGET_OS_IOS && SENTRY_HAS_UIKIT
9+
@protocol SentryUIDeviceWrapper;
1410

1511
NS_ASSUME_NONNULL_BEGIN
1612

@@ -23,7 +19,7 @@ SENTRY_NO_INIT
2319
- (instancetype)initWithCrashWrapper:(SentryCrashWrapper *)crashWrapper
2420
processInfoWrapper:(SentryNSProcessInfoWrapper *)processInfoWrapper
2521
#if TARGET_OS_IOS && SENTRY_HAS_UIKIT
26-
deviceWrapper:(SentryUIDeviceWrapper *)deviceWrapper
22+
deviceWrapper:(id<SentryUIDeviceWrapper>)deviceWrapper
2723
#endif // TARGET_OS_IOS && SENTRY_HAS_UIKIT
2824
;
2925

Sources/Sentry/SentryExtraContextProvider.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#import "SentryCrashWrapper.h"
44
#import "SentryLogC.h"
55
#import "SentryNSProcessInfoWrapper.h"
6-
#import "SentryUIDeviceWrapper.h"
6+
#import "SentrySwift.h"
77

88
NSString *const kSentryProcessInfoThermalStateNominal = @"nominal";
99
NSString *const kSentryProcessInfoThermalStateFair = @"fair";
@@ -16,7 +16,7 @@ @interface SentryExtraContextProvider ()
1616
@property (nonatomic, strong) SentryNSProcessInfoWrapper *processInfoWrapper;
1717

1818
#if TARGET_OS_IOS && SENTRY_HAS_UIKIT
19-
@property (nonatomic, strong) SentryUIDeviceWrapper *deviceWrapper;
19+
@property (nonatomic, strong) id<SentryUIDeviceWrapper> deviceWrapper;
2020
#endif // TARGET_OS_IOS && SENTRY_HAS_UIKIT
2121

2222
@end
@@ -26,7 +26,7 @@ @implementation SentryExtraContextProvider
2626
- (instancetype)initWithCrashWrapper:(id)crashWrapper
2727
processInfoWrapper:(id)processInfoWrapper
2828
#if TARGET_OS_IOS && SENTRY_HAS_UIKIT
29-
deviceWrapper:(SentryUIDeviceWrapper *)deviceWrapper
29+
deviceWrapper:(id<SentryUIDeviceWrapper>)deviceWrapper
3030
#endif // TARGET_OS_IOS && SENTRY_HAS_UIKIT
3131
{
3232
if (self = [super init]) {

Sources/Sentry/SentrySDKInternal.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#endif // TARGET_OS_MAC
3535

3636
#if SENTRY_HAS_UIKIT
37-
# import "SentryUIDeviceWrapper.h"
3837
# import "SentryUIViewControllerPerformanceTracker.h"
3938
# if TARGET_OS_IOS
4039
# import "SentryFeedbackAPI.h"

Sources/Sentry/SentryUIDeviceWrapper.m

Lines changed: 0 additions & 91 deletions
This file was deleted.

Sources/Sentry/include/HybridPublic/SentryDependencyContainer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#endif // SENTRY_UIKIT_AVAILABLE
5252

5353
#if SENTRY_HAS_UIKIT
54-
@class SentryUIDeviceWrapper;
54+
@protocol SentryUIDeviceWrapper;
5555
#endif // TARGET_OS_IOS
5656

5757
#if !TARGET_OS_WATCH
@@ -100,7 +100,7 @@ SENTRY_NO_INIT
100100
#endif // !TARGET_OS_WATCH
101101

102102
#if SENTRY_HAS_UIKIT
103-
@property (nonatomic, strong) SentryUIDeviceWrapper *uiDeviceWrapper;
103+
@property (nonatomic, strong) id<SentryUIDeviceWrapper> uiDeviceWrapper;
104104
#endif // TARGET_OS_IOS
105105

106106
#pragma mark - Lazy Dependencies

Sources/Sentry/include/SentryUIDeviceWrapper.h

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)