Skip to content

Commit ed5024e

Browse files
committed
ref: Convert SentryFeedbackAPI to Swift
1 parent 5fcb6a1 commit ed5024e

File tree

9 files changed

+179
-263
lines changed

9 files changed

+179
-263
lines changed

Sentry.xcodeproj/project.pbxproj

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,6 @@
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 */; };
610608
848A45192BBF8D33006AAAEC /* SentryContinuousProfiler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 848A45182BBF8D33006AAAEC /* SentryContinuousProfiler.mm */; };
611609
848A451A2BBF8D33006AAAEC /* SentryContinuousProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 848A45172BBF8D33006AAAEC /* SentryContinuousProfiler.h */; };
612610
848A451D2BBF9504006AAAEC /* SentryProfilerTestHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 848A451C2BBF9504006AAAEC /* SentryProfilerTestHelpers.m */; };
@@ -1101,6 +1099,7 @@
11011099
FA8E58F12E0AD4270049F69D /* SentryDispatchQueueWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8E58F02E0AD4220049F69D /* SentryDispatchQueueWrapper.swift */; };
11021100
FA90FAA82E06614E008CAAE8 /* SentryExtraPackages.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA90FAA72E06614B008CAAE8 /* SentryExtraPackages.swift */; };
11031101
FA90FAFD2E070A3B008CAAE8 /* SentryURLRequestFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA90FAFC2E070A3B008CAAE8 /* SentryURLRequestFactory.swift */; };
1102+
FA914E652ECFBCE300C54BDD /* SentryFeedbackAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA914E5F2ECFBCE000C54BDD /* SentryFeedbackAPI.swift */; };
11041103
FA94E6912E6B92C100576666 /* SentryClientReport.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA94E68B2E6B92BE00576666 /* SentryClientReport.swift */; };
11051104
FA94E6B22E6D265800576666 /* SentryEnvelope.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA94E6B12E6D265500576666 /* SentryEnvelope.swift */; };
11061105
FA94E7242E6F339400576666 /* SentryEnvelopeItemType.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA94E7232E6F32FA00576666 /* SentryEnvelopeItemType.swift */; };
@@ -1963,8 +1962,6 @@
19631962
846F90332D56F59D009E86C1 /* Brewfile-ci-deploy */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = "Brewfile-ci-deploy"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
19641963
848214B42E32B10900DF6998 /* SwiftUITestSample_Crash.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = SwiftUITestSample_Crash.xctestplan; sourceTree = "<group>"; };
19651964
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>"; };
19681965
848A45172BBF8D33006AAAEC /* SentryContinuousProfiler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryContinuousProfiler.h; path = ../include/SentryContinuousProfiler.h; sourceTree = "<group>"; };
19691966
848A45182BBF8D33006AAAEC /* SentryContinuousProfiler.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SentryContinuousProfiler.mm; sourceTree = "<group>"; };
19701967
848A451B2BBF9504006AAAEC /* SentryProfilerTestHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilerTestHelpers.h; path = ../include/SentryProfilerTestHelpers.h; sourceTree = "<group>"; };
@@ -2483,6 +2480,7 @@
24832480
FA8E58F02E0AD4220049F69D /* SentryDispatchQueueWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryDispatchQueueWrapper.swift; sourceTree = "<group>"; };
24842481
FA90FAA72E06614B008CAAE8 /* SentryExtraPackages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryExtraPackages.swift; sourceTree = "<group>"; };
24852482
FA90FAFC2E070A3B008CAAE8 /* SentryURLRequestFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryURLRequestFactory.swift; sourceTree = "<group>"; };
2483+
FA914E5F2ECFBCE000C54BDD /* SentryFeedbackAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryFeedbackAPI.swift; sourceTree = "<group>"; };
24862484
FA94E68B2E6B92BE00576666 /* SentryClientReport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryClientReport.swift; sourceTree = "<group>"; };
24872485
FA94E6B12E6D265500576666 /* SentryEnvelope.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryEnvelope.swift; sourceTree = "<group>"; };
24882486
FA94E7232E6F32FA00576666 /* SentryEnvelopeItemType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryEnvelopeItemType.swift; sourceTree = "<group>"; };
@@ -4097,8 +4095,6 @@
40974095
children = (
40984096
849B8F9E2C70091A00148E1F /* Configuration */,
40994097
849B8F962C6E906900148E1F /* SentryUserFeedbackIntegrationDriver.swift */,
4100-
8482FA992DD7C397000E9283 /* SentryFeedbackAPI.h */,
4101-
8482FA9A2DD7C397000E9283 /* SentryFeedbackAPI.m */,
41024098
84DBC62B2CE82F0E000C4904 /* SentryFeedback.swift */,
41034099
84CFA4CB2C9E0CA3008DA5F4 /* SentryUserFeedbackIntegration.h */,
41044100
84CFA4CC2C9E0CA3008DA5F4 /* SentryUserFeedbackIntegration.m */,
@@ -4836,6 +4832,7 @@
48364832
D8CAC02D2BA0663E00E38F34 /* Integrations */ = {
48374833
isa = PBXGroup;
48384834
children = (
4835+
FA914E5F2ECFBCE000C54BDD /* SentryFeedbackAPI.swift */,
48394836
FAB0073C2E9F47DE001C806A /* Session */,
48404837
FAE579B42E7DBE9400B710F9 /* SentryGlobalEventProcessor.swift */,
48414838
D49064862DFAE1B700555785 /* Screenshot */,
@@ -5098,7 +5095,6 @@
50985095
0A9BF4E428A114B50068D266 /* SentryViewHierarchyIntegration.h in Headers */,
50995096
D8BBD32728FD9FC00011F850 /* SentrySwift.h in Headers */,
51005097
84CFA4CE2C9E0CA3008DA5F4 /* SentryUserFeedbackIntegration.h in Headers */,
5101-
8482FA9B2DD7C397000E9283 /* SentryFeedbackAPI.h in Headers */,
51025098
8E4E7C7425DAAB49006AB9E2 /* SentrySpanProtocol.h in Headers */,
51035099
8EC4CF4A25C38DAA0093DEE9 /* SentrySpanStatus.h in Headers */,
51045100
8ECC673D25C23996000E2BF6 /* SentrySpanId.h in Headers */,
@@ -5886,6 +5882,7 @@
58865882
63FE710720DA4C1000CDBAE8 /* SentryCrashStackCursor_SelfThread.m in Sources */,
58875883
63FE711120DA4C1000CDBAE8 /* SentryCrashDebug.c in Sources */,
58885884
7B883F49253D714C00879E62 /* SentryCrashUUIDConversion.c in Sources */,
5885+
FA914E652ECFBCE300C54BDD /* SentryFeedbackAPI.swift in Sources */,
58895886
62F70E932D4234B800634054 /* SentryMechanismContextCodable.swift in Sources */,
58905887
843FB3232D0CD04D00558F18 /* SentryUserAccess.m in Sources */,
58915888
63FE716720DA4C1100CDBAE8 /* SentryCrashCPU.c in Sources */,
@@ -6133,7 +6130,6 @@
61336130
FACEED132E3179A10007B4AC /* SentryOptionsInternal.m in Sources */,
61346131
FAAB95C02EA163590030A2DB /* SentryScopeObserver.swift in Sources */,
61356132
D48891D02E98F2E700212823 /* SentryInfoPlistError.swift in Sources */,
6136-
8482FA9C2DD7C397000E9283 /* SentryFeedbackAPI.m in Sources */,
61376133
7BC9A20628F41781001E7C4C /* SentryMeasurementUnit.m in Sources */,
61386134
F429D3AA2E8562EF00DBF387 /* RateLimitParser.swift in Sources */,
61396135
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/SentryFeedbackAPI.h

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

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

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

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/include/SentryPrivate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@
6161
#import "SentryTraceHeader.h"
6262
#import "SentryTraceOrigin.h"
6363
#import "SentryTraceProfiler.h"
64+
#import "SentryUserFeedbackIntegration.h"
6465
#import "SentryWatchdogTerminationBreadcrumbProcessor.h"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
let feedback = SentrySDKInternal.currentHub().getInstalledIntegration(SentryUserFeedbackIntegration.self) as? SentryUserFeedbackIntegration
14+
feedback?.showWidget()
15+
}
16+
17+
/// Hide the feedback widget button.
18+
/// - warning: This is an experimental feature and may still have bugs.
19+
/// - seealso: See `SentryOptions.configureUserFeedback` to configure the widget.
20+
@available(iOSApplicationExtension, unavailable)
21+
@objc public func hideWidget() {
22+
let feedback = SentrySDKInternal.currentHub().getInstalledIntegration(SentryUserFeedbackIntegration.self) as? SentryUserFeedbackIntegration
23+
feedback?.hideWidget()
24+
}
25+
}
26+
#endif

0 commit comments

Comments
 (0)