Skip to content

Commit 2ce5d0a

Browse files
committed
Rename
1 parent 2c7422a commit 2ce5d0a

File tree

7 files changed

+27
-20
lines changed

7 files changed

+27
-20
lines changed

SentryTestUtils/Headers/SentryHub+Test.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@class SentryCrashWrapper;
55
@class SentryDispatchQueueWrapper;
66
@class SentryClientInternal;
7-
@protocol SentryBaseIntegrationProtocol;
7+
@protocol SentryIntegrationProtocol;
88
NS_ASSUME_NONNULL_BEGIN
99

1010
/** Expose the internal test init for testing. */
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
1515
andCrashWrapper:(SentryCrashWrapper *)crashAdapter
1616
andDispatchQueue:(SentryDispatchQueueWrapper *)dispatchQueue;
1717

18-
- (NSArray<id<SentryBaseIntegrationProtocol>> *)installedIntegrations;
18+
- (NSArray<id<SentryIntegrationProtocol>> *)installedIntegrations;
1919
- (NSSet<NSString *> *)installedIntegrationNames;
2020

2121
- (BOOL)eventContainsOnlyHandledErrors:(NSDictionary *)eventDictionary;

Sources/Sentry/SentryHub.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ - (void)configureScope:(void (^)(SentryScope *scope))callback
621621
- (BOOL)isIntegrationInstalled:(Class)integrationClass
622622
{
623623
@synchronized(_integrationsLock) {
624-
for (id<SentryBaseIntegrationProtocol> item in _installedIntegrations) {
624+
for (id<SentryIntegrationProtocol> item in _installedIntegrations) {
625625
if ([item isKindOfClass:integrationClass]) {
626626
return YES;
627627
}
@@ -630,10 +630,10 @@ - (BOOL)isIntegrationInstalled:(Class)integrationClass
630630
}
631631
}
632632

633-
- (nullable id<SentryBaseIntegrationProtocol>)getInstalledIntegration:(Class)integrationClass
633+
- (nullable id<SentryIntegrationProtocol>)getInstalledIntegration:(Class)integrationClass
634634
{
635635
@synchronized(_integrationsLock) {
636-
for (id<SentryBaseIntegrationProtocol> item in _installedIntegrations) {
636+
for (id<SentryIntegrationProtocol> item in _installedIntegrations) {
637637
if ([item isKindOfClass:integrationClass]) {
638638
return item;
639639
}
@@ -651,7 +651,7 @@ - (BOOL)hasIntegration:(NSString *)integrationName
651651
}
652652
}
653653

654-
- (void)addInstalledIntegration:(id<SentryBaseIntegrationProtocol>)integration name:(NSString *)name
654+
- (void)addInstalledIntegration:(id<SentryIntegrationProtocol>)integration name:(NSString *)name
655655
{
656656
@synchronized(_integrationsLock) {
657657
[_installedIntegrations addObject:integration];
@@ -661,7 +661,7 @@ - (void)addInstalledIntegration:(id<SentryBaseIntegrationProtocol>)integration n
661661

662662
- (void)removeAllIntegrations
663663
{
664-
for (NSObject<SentryBaseIntegrationProtocol> *integration in self.installedIntegrations) {
664+
for (NSObject<SentryIntegrationProtocol> *integration in self.installedIntegrations) {
665665
if ([integration respondsToSelector:@selector(uninstall)]) {
666666
[integration uninstall];
667667
}
@@ -672,7 +672,7 @@ - (void)removeAllIntegrations
672672
}
673673
}
674674

675-
- (NSArray<id<SentryBaseIntegrationProtocol>> *)installedIntegrations
675+
- (NSArray<id<SentryIntegrationProtocol>> *)installedIntegrations
676676
{
677677
@synchronized(_integrationsLock) {
678678
return _installedIntegrations.copy;

Sources/Sentry/SentrySDKInternal.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ + (void)installIntegrations
561561
continue;
562562
}
563563

564-
id<SentryIntegrationProtocol> integrationInstance = [[integrationClass alloc] init];
564+
id<SentryObjCIntegrationProtocol> integrationInstance = [[integrationClass alloc] init];
565565
BOOL shouldInstall = [integrationInstance installWithOptions:options];
566566
if (shouldInstall) {
567567
SENTRY_LOG_DEBUG(@"Integration installed: %@", NSStringFromClass(integrationClass));

Sources/Sentry/include/HybridPublic/SentryBaseIntegration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ typedef NS_OPTIONS(NSUInteger, SentryIntegrationOption) {
3434

3535
@class SentryOptions;
3636

37-
@interface SentryBaseIntegration : NSObject <SentryIntegrationProtocol>
37+
@interface SentryBaseIntegration : NSObject <SentryObjCIntegrationProtocol>
3838

3939
- (NSString *)integrationName;
4040
- (BOOL)installWithOptions:(SentryOptions *)options;

Sources/Sentry/include/HybridPublic/SentryIntegrationProtocol.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ NS_ASSUME_NONNULL_BEGIN
44

55
@class SentryOptions;
66

7-
@protocol SentryBaseIntegrationProtocol <NSObject>
7+
// All Integrations conform to this protocol so that the SDK
8+
// can uninstall them when the SDK is closed.
9+
@protocol SentryIntegrationProtocol <NSObject>
810

911
/**
1012
* Uninstalls the integration.
@@ -13,7 +15,11 @@ NS_ASSUME_NONNULL_BEGIN
1315

1416
@end
1517

16-
@protocol SentryIntegrationProtocol <SentryBaseIntegrationProtocol>
18+
// ObjC integrations conform to this protocol. This should not be used for new
19+
// integrations. New ones should be written in Swift and use the `Sentry.Integration`
20+
// protocol. The main difference is that the ObjC protocol does not inject dependencies
21+
// so conformers need to access the singleton.
22+
@protocol SentryObjCIntegrationProtocol <SentryIntegrationProtocol>
1723

1824
/**
1925
* Installs the integration and returns YES if successful.

Sources/Sentry/include/SentryHub+Private.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@class SentryReplayEvent;
1313
@class SentryAttachment;
1414
@class SentryReplayRecording;
15-
@protocol SentryBaseIntegrationProtocol;
15+
@protocol SentryIntegrationProtocol;
1616

1717
NS_ASSUME_NONNULL_BEGIN
1818

@@ -27,8 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
2727

2828
@property (nullable, nonatomic, strong) SentrySession *session;
2929

30-
@property (nonatomic, strong)
31-
NSMutableArray<id<SentryBaseIntegrationProtocol>> *installedIntegrations;
30+
@property (nonatomic, strong) NSMutableArray<id<SentryIntegrationProtocol>> *installedIntegrations;
3231

3332
@property (nonatomic, readonly, strong) NSObject *_swiftLogger;
3433

@@ -38,8 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
3837
*/
3938
- (NSArray<NSString *> *)trimmedInstalledIntegrationNames;
4039

41-
- (void)addInstalledIntegration:(id<SentryBaseIntegrationProtocol>)integration
42-
name:(NSString *)name;
40+
- (void)addInstalledIntegration:(id<SentryIntegrationProtocol>)integration name:(NSString *)name;
4341
- (void)removeAllIntegrations;
4442

4543
- (SentryClientInternal *_Nullable)client;
@@ -86,7 +84,7 @@ NS_ASSUME_NONNULL_BEGIN
8684

8785
- (void)registerSessionListener:(id<SentrySessionListener>)listener;
8886
- (void)unregisterSessionListener:(id<SentrySessionListener>)listener;
89-
- (nullable id<SentryBaseIntegrationProtocol>)getInstalledIntegration:(Class)integrationClass;
87+
- (nullable id<SentryIntegrationProtocol>)getInstalledIntegration:(Class)integrationClass;
9088
- (NSSet<NSString *> *)installedIntegrationNames;
9189

9290
#if SENTRY_TARGET_REPLAY_SUPPORTED

Sources/Swift/Core/Integrations/Integrations.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
@_implementationOnly import _SentryPrivate
22

3-
protocol Integration: SentryBaseIntegrationProtocol {
3+
// The Swift counterpart to `SentryObjcIntegrationProtocol`. This protocol allows
4+
// injecting the dependencies in a way that does not require the Integration to
5+
// depend on SentryDependencyContainer.
6+
protocol Integration: SentryIntegrationProtocol {
47
// The dependencies required for the integration. The easiest way to satisfy this requirement when migrating from ObjC
58
// is to define it as `SentryDependencyContainer` with a typealias. However, a generic Swift class that has a protocol
69
// constraint on the `Dependencies` type can make it easier to test and to use without a direct dependency on all
@@ -16,7 +19,7 @@ protocol Integration: SentryBaseIntegrationProtocol {
1619

1720
// Type erases the `Integration` so that it can be stored in an array and used for `addInstalledIntegration`
1821
private struct AnyIntegration {
19-
let start: (Options, SentryDependencyContainer) -> SentryBaseIntegrationProtocol?
22+
let start: (Options, SentryDependencyContainer) -> SentryIntegrationProtocol?
2023
let name: String
2124

2225
init<I: Integration>(_ integration: I.Type) where I.Dependencies == SentryDependencyContainer {

0 commit comments

Comments
 (0)