Skip to content

Commit 02a1c4e

Browse files
committed
ref: SentryFeedbackAPI in Swift
1 parent 5fcb6a1 commit 02a1c4e

File tree

9 files changed

+196
-209
lines changed

9 files changed

+196
-209
lines changed

Sentry.xcodeproj/project.pbxproj

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,8 @@
605605
845C16D52A622A5B00EC9519 /* SentryTracer+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 845C16D42A622A5B00EC9519 /* SentryTracer+Private.h */; };
606606
845CEAEF2D83F79500B6B325 /* SentryProfilingPublicAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845CEAEE2D83F79500B6B325 /* SentryProfilingPublicAPITests.swift */; };
607607
845CEB172D8A979700B6B325 /* SentryAppStartProfilingConfigurationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845CEB162D8A979700B6B325 /* SentryAppStartProfilingConfigurationTests.swift */; };
608-
8482FA9B2DD7C397000E9283 /* SentryFeedbackAPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 8482FA992DD7C397000E9283 /* SentryFeedbackAPI.h */; settings = {ATTRIBUTES = (Public, ); }; };
609-
8482FA9C2DD7C397000E9283 /* SentryFeedbackAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = 8482FA9A2DD7C397000E9283 /* SentryFeedbackAPI.m */; };
608+
8482FA9B2DD7C397000E9283 /* SentryFeedbackAPIHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 8482FA992DD7C397000E9283 /* SentryFeedbackAPIHelper.h */; };
609+
8482FA9C2DD7C397000E9283 /* SentryFeedbackAPIHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8482FA9A2DD7C397000E9283 /* SentryFeedbackAPIHelper.m */; };
610610
848A45192BBF8D33006AAAEC /* SentryContinuousProfiler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 848A45182BBF8D33006AAAEC /* SentryContinuousProfiler.mm */; };
611611
848A451A2BBF8D33006AAAEC /* SentryContinuousProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 848A45172BBF8D33006AAAEC /* SentryContinuousProfiler.h */; };
612612
848A451D2BBF9504006AAAEC /* SentryProfilerTestHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 848A451C2BBF9504006AAAEC /* SentryProfilerTestHelpers.m */; };
@@ -1101,6 +1101,7 @@
11011101
FA8E58F12E0AD4270049F69D /* SentryDispatchQueueWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8E58F02E0AD4220049F69D /* SentryDispatchQueueWrapper.swift */; };
11021102
FA90FAA82E06614E008CAAE8 /* SentryExtraPackages.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA90FAA72E06614B008CAAE8 /* SentryExtraPackages.swift */; };
11031103
FA90FAFD2E070A3B008CAAE8 /* SentryURLRequestFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA90FAFC2E070A3B008CAAE8 /* SentryURLRequestFactory.swift */; };
1104+
FA914E6D2ECFD7D800C54BDD /* SentryFeedbackAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA914E6C2ECFD7D800C54BDD /* SentryFeedbackAPI.swift */; };
11041105
FA94E6912E6B92C100576666 /* SentryClientReport.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA94E68B2E6B92BE00576666 /* SentryClientReport.swift */; };
11051106
FA94E6B22E6D265800576666 /* SentryEnvelope.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA94E6B12E6D265500576666 /* SentryEnvelope.swift */; };
11061107
FA94E7242E6F339400576666 /* SentryEnvelopeItemType.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA94E7232E6F32FA00576666 /* SentryEnvelopeItemType.swift */; };
@@ -1963,8 +1964,8 @@
19631964
846F90332D56F59D009E86C1 /* Brewfile-ci-deploy */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = "Brewfile-ci-deploy"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
19641965
848214B42E32B10900DF6998 /* SwiftUITestSample_Crash.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = SwiftUITestSample_Crash.xctestplan; sourceTree = "<group>"; };
19651966
848214B52E32B10900DF6998 /* SwiftUITestSample_Envelope.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = SwiftUITestSample_Envelope.xctestplan; sourceTree = "<group>"; };
1966-
8482FA992DD7C397000E9283 /* SentryFeedbackAPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryFeedbackAPI.h; path = ../../../Sentry/Public/SentryFeedbackAPI.h; sourceTree = "<group>"; };
1967-
8482FA9A2DD7C397000E9283 /* SentryFeedbackAPI.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SentryFeedbackAPI.m; path = ../../../Sentry/SentryFeedbackAPI.m; sourceTree = "<group>"; };
1967+
8482FA992DD7C397000E9283 /* SentryFeedbackAPIHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryFeedbackAPIHelper.h; path = ../../../Sentry/include/SentryFeedbackAPIHelper.h; sourceTree = "<group>"; };
1968+
8482FA9A2DD7C397000E9283 /* SentryFeedbackAPIHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SentryFeedbackAPIHelper.m; path = ../../../Sentry/SentryFeedbackAPIHelper.m; sourceTree = "<group>"; };
19681969
848A45172BBF8D33006AAAEC /* SentryContinuousProfiler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryContinuousProfiler.h; path = ../include/SentryContinuousProfiler.h; sourceTree = "<group>"; };
19691970
848A45182BBF8D33006AAAEC /* SentryContinuousProfiler.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SentryContinuousProfiler.mm; sourceTree = "<group>"; };
19701971
848A451B2BBF9504006AAAEC /* SentryProfilerTestHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilerTestHelpers.h; path = ../include/SentryProfilerTestHelpers.h; sourceTree = "<group>"; };
@@ -2483,6 +2484,7 @@
24832484
FA8E58F02E0AD4220049F69D /* SentryDispatchQueueWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryDispatchQueueWrapper.swift; sourceTree = "<group>"; };
24842485
FA90FAA72E06614B008CAAE8 /* SentryExtraPackages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryExtraPackages.swift; sourceTree = "<group>"; };
24852486
FA90FAFC2E070A3B008CAAE8 /* SentryURLRequestFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryURLRequestFactory.swift; sourceTree = "<group>"; };
2487+
FA914E6C2ECFD7D800C54BDD /* SentryFeedbackAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryFeedbackAPI.swift; sourceTree = "<group>"; };
24862488
FA94E68B2E6B92BE00576666 /* SentryClientReport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryClientReport.swift; sourceTree = "<group>"; };
24872489
FA94E6B12E6D265500576666 /* SentryEnvelope.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryEnvelope.swift; sourceTree = "<group>"; };
24882490
FA94E7232E6F32FA00576666 /* SentryEnvelopeItemType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryEnvelopeItemType.swift; sourceTree = "<group>"; };
@@ -4097,8 +4099,9 @@
40974099
children = (
40984100
849B8F9E2C70091A00148E1F /* Configuration */,
40994101
849B8F962C6E906900148E1F /* SentryUserFeedbackIntegrationDriver.swift */,
4100-
8482FA992DD7C397000E9283 /* SentryFeedbackAPI.h */,
4101-
8482FA9A2DD7C397000E9283 /* SentryFeedbackAPI.m */,
4102+
8482FA992DD7C397000E9283 /* SentryFeedbackAPIHelper.h */,
4103+
8482FA9A2DD7C397000E9283 /* SentryFeedbackAPIHelper.m */,
4104+
FA914E6C2ECFD7D800C54BDD /* SentryFeedbackAPI.swift */,
41024105
84DBC62B2CE82F0E000C4904 /* SentryFeedback.swift */,
41034106
84CFA4CB2C9E0CA3008DA5F4 /* SentryUserFeedbackIntegration.h */,
41044107
84CFA4CC2C9E0CA3008DA5F4 /* SentryUserFeedbackIntegration.m */,
@@ -5098,7 +5101,7 @@
50985101
0A9BF4E428A114B50068D266 /* SentryViewHierarchyIntegration.h in Headers */,
50995102
D8BBD32728FD9FC00011F850 /* SentrySwift.h in Headers */,
51005103
84CFA4CE2C9E0CA3008DA5F4 /* SentryUserFeedbackIntegration.h in Headers */,
5101-
8482FA9B2DD7C397000E9283 /* SentryFeedbackAPI.h in Headers */,
5104+
8482FA9B2DD7C397000E9283 /* SentryFeedbackAPIHelper.h in Headers */,
51025105
8E4E7C7425DAAB49006AB9E2 /* SentrySpanProtocol.h in Headers */,
51035106
8EC4CF4A25C38DAA0093DEE9 /* SentrySpanStatus.h in Headers */,
51045107
8ECC673D25C23996000E2BF6 /* SentrySpanId.h in Headers */,
@@ -5886,6 +5889,7 @@
58865889
63FE710720DA4C1000CDBAE8 /* SentryCrashStackCursor_SelfThread.m in Sources */,
58875890
63FE711120DA4C1000CDBAE8 /* SentryCrashDebug.c in Sources */,
58885891
7B883F49253D714C00879E62 /* SentryCrashUUIDConversion.c in Sources */,
5892+
FA914E6D2ECFD7D800C54BDD /* SentryFeedbackAPI.swift in Sources */,
58895893
62F70E932D4234B800634054 /* SentryMechanismContextCodable.swift in Sources */,
58905894
843FB3232D0CD04D00558F18 /* SentryUserAccess.m in Sources */,
58915895
63FE716720DA4C1100CDBAE8 /* SentryCrashCPU.c in Sources */,
@@ -6133,7 +6137,7 @@
61336137
FACEED132E3179A10007B4AC /* SentryOptionsInternal.m in Sources */,
61346138
FAAB95C02EA163590030A2DB /* SentryScopeObserver.swift in Sources */,
61356139
D48891D02E98F2E700212823 /* SentryInfoPlistError.swift in Sources */,
6136-
8482FA9C2DD7C397000E9283 /* SentryFeedbackAPI.m in Sources */,
6140+
8482FA9C2DD7C397000E9283 /* SentryFeedbackAPIHelper.m in Sources */,
61376141
7BC9A20628F41781001E7C4C /* SentryMeasurementUnit.m in Sources */,
61386142
F429D3AA2E8562EF00DBF387 /* RateLimitParser.swift in Sources */,
61396143
F4E1E9812E8C2B150007B080 /* SentryDateUtil.swift in Sources */,

Sources/Sentry/Public/Sentry.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ FOUNDATION_EXPORT const unsigned char SentryVersionString[];
1818
# import <Sentry/SentryError.h>
1919
# import <Sentry/SentryEvent.h>
2020
# import <Sentry/SentryException.h>
21-
# import <Sentry/SentryFeedbackAPI.h>
2221
# import <Sentry/SentryFrame.h>
2322
# import <Sentry/SentryGeo.h>
2423
# import <Sentry/SentryHttpStatusCodeRange.h>

Sources/Sentry/Public/SentryWithoutUIKit.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ FOUNDATION_EXPORT const unsigned char SentryVersionString[];
1919
# import <SentryWithoutUIKit/SentryError.h>
2020
# import <SentryWithoutUIKit/SentryEvent.h>
2121
# import <SentryWithoutUIKit/SentryException.h>
22-
# import <SentryWithoutUIKit/SentryFeedbackAPI.h>
2322
# import <SentryWithoutUIKit/SentryFrame.h>
2423
# import <SentryWithoutUIKit/SentryGeo.h>
2524
# import <SentryWithoutUIKit/SentryHttpStatusCodeRange.h>

Sources/Sentry/SentryFeedbackAPI.m renamed to Sources/Sentry/SentryFeedbackAPIHelper.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88

99
#if TARGET_OS_IOS && SENTRY_HAS_UIKIT
1010

11-
# import "SentryFeedbackAPI.h"
11+
# import "SentryFeedbackAPIHelper.h"
1212
# import "SentryHub+Private.h"
1313
# import "SentryLogC.h"
1414
# import "SentrySDK+Private.h"
1515
# import "SentryUserFeedbackIntegration.h"
1616

17-
@implementation SentryFeedbackAPI
17+
@implementation SentryFeedbackAPIHelper
1818

19-
- (void)showWidget
19+
+ (void)showWidget
2020
{
2121
SentryUserFeedbackIntegration *feedback = [[SentrySDKInternal currentHub]
2222
getInstalledIntegration:[SentryUserFeedbackIntegration class]];
2323
[feedback showWidget];
2424
}
2525

26-
- (void)hideWidget
26+
+ (void)hideWidget
2727
{
2828
SentryUserFeedbackIntegration *feedback = [SentrySDKInternal.currentHub
2929
getInstalledIntegration:[SentryUserFeedbackIntegration class]];

Sources/Sentry/SentrySDKInternal.m

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@
4747
# import "SentryCrashExceptionApplication.h"
4848
#endif // TARGET_OS_MAC
4949

50-
#if SENTRY_HAS_UIKIT
51-
# if TARGET_OS_IOS
52-
# import "SentryFeedbackAPI.h"
53-
# endif // TARGET_OS_IOS
54-
#endif // SENTRY_HAS_UIKIT
55-
5650
#if SENTRY_TARGET_PROFILING_SUPPORTED
5751
# import "SentryContinuousProfiler.h"
5852
# import "SentryProfileConfiguration.h"

Sources/Sentry/Public/SentryFeedbackAPI.h renamed to Sources/Sentry/include/SentryFeedbackAPIHelper.h

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,13 @@
1212

1313
NS_ASSUME_NONNULL_BEGIN
1414

15-
@interface SentryFeedbackAPI : NSObject
16-
17-
/**
18-
* Show the feedback widget button.
19-
* @warning This is an experimental feature and may still have bugs.
20-
* @seealso See @c SentryOptions.configureUserFeedback to configure the widget.
21-
*/
22-
- (void)showWidget NS_EXTENSION_UNAVAILABLE(
15+
// Needed to access SentryFeedbackIntegration until that class is written in Swift
16+
@interface SentryFeedbackAPIHelper : NSObject
17+
18+
+ (void)showWidget NS_EXTENSION_UNAVAILABLE(
2319
"Sentry User Feedback UI cannot be used from app extensions.");
2420

25-
/**
26-
* Hide the feedback widget button.
27-
* @warning This is an experimental feature and may still have bugs.
28-
* @seealso See @c SentryOptions.configureUserFeedback to configure the widget.
29-
*/
30-
- (void)hideWidget NS_EXTENSION_UNAVAILABLE(
21+
+ (void)hideWidget NS_EXTENSION_UNAVAILABLE(
3122
"Sentry User Feedback UI cannot be used from app extensions.");
3223

3324
@end

Sources/Sentry/include/SentryPrivate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#import "SentryDelayedFramesTracker.h"
4242
#import "SentryDependencyContainerSwiftHelper.h"
4343
#import "SentryDeviceContextKeys.h"
44+
#import "SentryFeedbackAPIHelper.h"
4445
#import "SentryFileIOTrackerHelper.h"
4546
#import "SentryFileManagerHelper.h"
4647
#import "SentryMeta.h"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@_implementationOnly import _SentryPrivate
2+
3+
#if os(iOS) && !SENTRY_NO_UIKIT
4+
5+
@objc
6+
public final class SentryFeedbackAPI: NSObject {
7+
8+
/// Show the feedback widget button.
9+
/// - warning: This is an experimental feature and may still have bugs.
10+
/// - seealso: See `SentryOptions.configureUserFeedback` to configure the widget.
11+
@available(iOSApplicationExtension, unavailable)
12+
@objc public func showWidget() {
13+
SentryFeedbackAPIHelper.showWidget()
14+
}
15+
16+
/// Hide the feedback widget button.
17+
/// - warning: This is an experimental feature and may still have bugs.
18+
/// - seealso: See `SentryOptions.configureUserFeedback` to configure the widget.
19+
@available(iOSApplicationExtension, unavailable)
20+
@objc public func hideWidget() {
21+
SentryFeedbackAPIHelper.hideWidget()
22+
}
23+
}
24+
#endif

0 commit comments

Comments
 (0)