Skip to content

Commit 2c7422a

Browse files
committed
Use explicit name
1 parent a542a22 commit 2c7422a

File tree

6 files changed

+19
-7
lines changed

6 files changed

+19
-7
lines changed

Sources/Sentry/SentryHub.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -630,10 +630,10 @@ - (BOOL)isIntegrationInstalled:(Class)integrationClass
630630
}
631631
}
632632

633-
- (nullable id)getInstalledIntegration:(Class)integrationClass
633+
- (nullable id<SentryBaseIntegrationProtocol>)getInstalledIntegration:(Class)integrationClass
634634
{
635635
@synchronized(_integrationsLock) {
636-
for (id item in _installedIntegrations) {
636+
for (id<SentryBaseIntegrationProtocol> 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)integration name:(NSString *)name
654+
- (void)addInstalledIntegration:(id<SentryBaseIntegrationProtocol>)integration name:(NSString *)name
655655
{
656656
@synchronized(_integrationsLock) {
657657
[_installedIntegrations addObject:integration];
@@ -894,8 +894,8 @@ - (void)captureLog:(SentryLog *)log
894894
#if SENTRY_TARGET_REPLAY_SUPPORTED
895895
- (NSString *__nullable)getSessionReplayId
896896
{
897-
SentrySessionReplayIntegration *integration =
898-
[self getInstalledIntegration:[SentrySessionReplayIntegration class]];
897+
SentrySessionReplayIntegration *integration = (SentrySessionReplayIntegration *)[self
898+
getInstalledIntegration:[SentrySessionReplayIntegration class]];
899899
if (integration == nil || integration.sessionReplay == nil) {
900900
return nil;
901901
}

Sources/Sentry/include/SentryHub+Private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ NS_ASSUME_NONNULL_BEGIN
8686

8787
- (void)registerSessionListener:(id<SentrySessionListener>)listener;
8888
- (void)unregisterSessionListener:(id<SentrySessionListener>)listener;
89-
- (nullable id)getInstalledIntegration:(Class)integrationClass;
89+
- (nullable id<SentryBaseIntegrationProtocol>)getInstalledIntegration:(Class)integrationClass;
9090
- (NSSet<NSString *> *)installedIntegrationNames;
9191

9292
#if SENTRY_TARGET_REPLAY_SUPPORTED
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
HybridPublic/SentryIntegrationProtocol.h

Sources/Sentry/include/SentryPrivate.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
#import "SentryEnvelopeAttachmentHeader.h"
2323
#import "SentryEventSwiftHelper.h"
2424
#import "SentryHub+Private.h"
25+
// In SPM the file needs to be in the "include" directory since that is
26+
// the Public headers directory, but in Cocoapods it must be in HybridPublic because it is used in
27+
// that public interface too. In order to handle both these cases the file is in HybridPublic but
28+
// symlinked to include.
2529
#import "SentryIntegrationProtocol.h"
2630
#import "SentryNSDataUtils.h"
2731
#import "SentrySDK+Private.h"

Sources/Swift/Core/Integrations/Integrations.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ protocol Integration: SentryBaseIntegrationProtocol {
99

1010
// The initializer is failable, return nil if the integration was not installed, for example when the options that enable the integration is not enabled.
1111
init?(with options: Options, dependencies: Dependencies)
12+
13+
// Name of the integration that is used by `SentrySdkInfo`
14+
static var name: String { get }
1215
}
1316

1417
// Type erases the `Integration` so that it can be stored in an array and used for `addInstalledIntegration`
@@ -17,7 +20,7 @@ private struct AnyIntegration {
1720
let name: String
1821

1922
init<I: Integration>(_ integration: I.Type) where I.Dependencies == SentryDependencyContainer {
20-
name = NSStringFromClass(I.self)
23+
name = I.name
2124
start = {
2225
integration.init(with: $0, dependencies: $1)
2326
}

Sources/Swift/Integrations/UserFeedback/UserFeedbackIntegration.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ final class UserFeedbackIntegration<Dependencies: ScreenshotSourceProvider>: NSO
2727
}
2828

2929
func uninstall() { }
30+
31+
static var name: String {
32+
"SentryUserFeedbackIntegration"
33+
}
3034
}
3135

3236
#endif

0 commit comments

Comments
 (0)