Skip to content

Commit 9aa0b44

Browse files
authored
ref: Convert SentryUserFeedback to Swift (#5377)
* ref: Convert SentryUserFeedback to Swift * Move files * Fix Swift name * Use open * Update json
1 parent b3d0285 commit 9aa0b44

File tree

12 files changed

+471
-518
lines changed

12 files changed

+471
-518
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### Improvements
1010

11+
- Converted SentryUserFeedback from Objective-C to Swift (#5377)
1112
- Crashes for uncaught NSExceptions will now report the stracktrace recorded within the exception (#5306)
1213
- Fix usage of `@available` to be `iOS` instead of `iOSApplicationExtension` (#5361)
1314

Sentry.xcodeproj/project.pbxproj

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,6 @@
510510
7BAF3DD4243DD40F008A5414 /* SentryTransportFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BAF3DD3243DD40F008A5414 /* SentryTransportFactory.h */; };
511511
7BAF3DD92440AEC8008A5414 /* SentryRequestManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BAF3DD82440AEC8008A5414 /* SentryRequestManager.h */; };
512512
7BB42EF124F3B7B700D7B39A /* SentrySession+Equality.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BB42EF024F3B7B700D7B39A /* SentrySession+Equality.m */; };
513-
7BB654FB253DC14A00887E87 /* SentryUserFeedback.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BB654FA253DC14A00887E87 /* SentryUserFeedback.h */; settings = {ATTRIBUTES = (Public, ); }; };
514-
7BB65501253DC1B500887E87 /* SentryUserFeedback.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BB65500253DC1B500887E87 /* SentryUserFeedback.m */; };
515513
7BB6550D253EEB3900887E87 /* SentryUserFeedbackTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BB6550C253EEB3900887E87 /* SentryUserFeedbackTests.swift */; };
516514
7BB7E7C729267A28004BF96B /* EmptyIntegration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BB7E7C629267A28004BF96B /* EmptyIntegration.swift */; };
517515
7BBC826D25DFCFDE005F1ED8 /* SentryInAppLogic.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BBC826C25DFCFDE005F1ED8 /* SentryInAppLogic.h */; };
@@ -1065,6 +1063,7 @@
10651063
FA67DD192DDBD4EA00896B02 /* SwizzleClassNameExclude.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA67DCD52DDBD4EA00896B02 /* SwizzleClassNameExclude.swift */; };
10661064
FA8A36182DEAA1EB0058D883 /* SentryThread+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = FA8A36172DEAA1EB0058D883 /* SentryThread+Private.h */; };
10671065
FAEC273D2DF3933A00878871 /* NSData+Unzip.m in Sources */ = {isa = PBXBuildFile; fileRef = FAEC273C2DF3933200878871 /* NSData+Unzip.m */; };
1066+
FAEC270E2DF3526000878871 /* SentryUserFeedback.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAEC270D2DF3526000878871 /* SentryUserFeedback.swift */; };
10681067
/* End PBXBuildFile section */
10691068

10701069
/* Begin PBXContainerItemProxy section */
@@ -1688,8 +1687,6 @@
16881687
7BAF3DD82440AEC8008A5414 /* SentryRequestManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryRequestManager.h; path = include/SentryRequestManager.h; sourceTree = "<group>"; };
16891688
7BB42EEF24F3B7B700D7B39A /* SentrySession+Equality.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentrySession+Equality.h"; sourceTree = "<group>"; };
16901689
7BB42EF024F3B7B700D7B39A /* SentrySession+Equality.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "SentrySession+Equality.m"; sourceTree = "<group>"; };
1691-
7BB654FA253DC14A00887E87 /* SentryUserFeedback.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryUserFeedback.h; path = Public/SentryUserFeedback.h; sourceTree = "<group>"; };
1692-
7BB65500253DC1B500887E87 /* SentryUserFeedback.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryUserFeedback.m; sourceTree = "<group>"; };
16931690
7BB6550C253EEB3900887E87 /* SentryUserFeedbackTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUserFeedbackTests.swift; sourceTree = "<group>"; };
16941691
7BB7E7C629267A28004BF96B /* EmptyIntegration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyIntegration.swift; sourceTree = "<group>"; };
16951692
7BBC826C25DFCFDE005F1ED8 /* SentryInAppLogic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryInAppLogic.h; path = include/SentryInAppLogic.h; sourceTree = "<group>"; };
@@ -2307,6 +2304,7 @@
23072304
FA67DCF12DDBD4EA00896B02 /* SentryExperimentalOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryExperimentalOptions.swift; sourceTree = "<group>"; };
23082305
FA67DCF22DDBD4EA00896B02 /* SwiftDescriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftDescriptor.swift; sourceTree = "<group>"; };
23092306
FA8A36172DEAA1EB0058D883 /* SentryThread+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryThread+Private.h"; path = "include/SentryThread+Private.h"; sourceTree = "<group>"; };
2307+
FAEC270D2DF3526000878871 /* SentryUserFeedback.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUserFeedback.swift; sourceTree = "<group>"; };
23102308
FAEC273C2DF3933200878871 /* NSData+Unzip.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSData+Unzip.m"; sourceTree = "<group>"; };
23112309
FAEC273E2DF393E000878871 /* NSData+Unzip.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+Unzip.h"; sourceTree = "<group>"; };
23122310
/* End PBXFileReference section */
@@ -2566,8 +2564,6 @@
25662564
7B88F2FF24BC5A7D00ADF90A /* SentrySdkInfo.m */,
25672565
7BFC169A2524995700FF6266 /* SentryMessage.h */,
25682566
7BFC16A025249A9D00FF6266 /* SentryMessage.m */,
2569-
7BB654FA253DC14A00887E87 /* SentryUserFeedback.h */,
2570-
7BB65500253DC1B500887E87 /* SentryUserFeedback.m */,
25712567
7B4E375425822C4500059C93 /* SentryAttachment.h */,
25722568
D86B6834294348A400B8B1FC /* SentryAttachment+Private.h */,
25732569
7B4E375E258231FC00059C93 /* SentryAttachment.m */,
@@ -3891,6 +3887,7 @@
38913887
84A903702D39F66F00690CE4 /* SentryUserFeedbackFormViewModel.swift */,
38923888
84BA62262CAE2EEF0049F636 /* SentryUserFeedbackWidgetButtonView.swift */,
38933889
84E13B832CBF1D91003B52EC /* SentryUserFeedbackWidgetButtonMegaphoneIconView.swift */,
3890+
FAEC270D2DF3526000878871 /* SentryUserFeedback.swift */,
38943891
);
38953892
name = UserFeedback;
38963893
path = ../Swift/Integrations/UserFeedback;
@@ -4752,7 +4749,6 @@
47524749
63FE707F20DA4C1000CDBAE8 /* SentryCrashVarArgs.h in Headers */,
47534750
03F84D2627DD414C008FE43F /* SentryThreadMetadataCache.hpp in Headers */,
47544751
7BC9A20228F41350001E7C4C /* SentryMeasurementUnit.h in Headers */,
4755-
7BB654FB253DC14A00887E87 /* SentryUserFeedback.h in Headers */,
47564752
7B8ECBFA26498907005FE2EF /* SentryAppStateManager.h in Headers */,
47574753
639FCFA01EBC804600778193 /* SentryException.h in Headers */,
47584754
7BA235632600B61200E12865 /* SentryInternalNotificationNames.h in Headers */,
@@ -5271,6 +5267,7 @@
52715267
7B3B473825D6CC7E00D01640 /* SentryNSError.m in Sources */,
52725268
621AE74D2C626C510012E730 /* SentryANRTrackerV2.m in Sources */,
52735269
84CFA4CA2C9DF884008DA5F4 /* SentryUserFeedbackWidget.swift in Sources */,
5270+
FAEC270E2DF3526000878871 /* SentryUserFeedback.swift in Sources */,
52745271
F49D419E2DEA3D0600D9244E /* SentryCrashExceptionApplicationHelper.m in Sources */,
52755272
D8ACE3C82762187200F5A213 /* SentryFileIOTracker.m in Sources */,
52765273
7BE3C77D2446112C00A38442 /* SentryRateLimitParser.m in Sources */,
@@ -5501,7 +5498,6 @@
55015498
D85596F3280580F10041FF8B /* SentryScreenshotIntegration.m in Sources */,
55025499
7BAF3DCE243DCBFE008A5414 /* SentryTransportFactory.m in Sources */,
55035500
844EDC70294143B900C86F34 /* SentryNSProcessInfoWrapper.mm in Sources */,
5504-
7BB65501253DC1B500887E87 /* SentryUserFeedback.m in Sources */,
55055501
7D5C441A237C2E1F00DAB0A3 /* SentrySDK.m in Sources */,
55065502
7D65260E237F649E00113EA2 /* SentryScope.m in Sources */,
55075503
D4EDF9842D0B2A210071E7B3 /* Data+SentryTracing.swift in Sources */,

Sources/Sentry/Public/Sentry.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,5 @@ FOUNDATION_EXPORT const unsigned char SentryVersionString[];
4949
# import <Sentry/SentryTraceHeader.h>
5050
# import <Sentry/SentryTransactionContext.h>
5151
# import <Sentry/SentryUser.h>
52-
# import <Sentry/SentryUserFeedback.h>
5352
# import <Sentry/SentryWithoutUIKit.h>
5453
#endif // __has_include(<Sentry/Sentry.h>)

Sources/Sentry/Public/SentryUserFeedback.h

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

Sources/Sentry/Public/SentryWithoutUIKit.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,4 @@ FOUNDATION_EXPORT const unsigned char SentryVersionString[];
5050
# import <SentryWithoutUIKit/SentryTraceHeader.h>
5151
# import <SentryWithoutUIKit/SentryTransactionContext.h>
5252
# import <SentryWithoutUIKit/SentryUser.h>
53-
# import <SentryWithoutUIKit/SentryUserFeedback.h>
5453
#endif // __has_include(<SentryWithoutUIKit/Sentry.h>)

Sources/Sentry/SentryClient.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
#import "SentryUIApplication.h"
4949
#import "SentryUseNSExceptionCallstackWrapper.h"
5050
#import "SentryUser.h"
51-
#import "SentryUserFeedback.h"
5251
#import "SentryWatchdogTerminationTracker.h"
5352

5453
#if SENTRY_HAS_UIKIT

Sources/Sentry/SentryEnvelope.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#import "SentrySession.h"
1515
#import "SentrySwift.h"
1616
#import "SentryTransaction.h"
17-
#import "SentryUserFeedback.h"
1817

1918
NS_ASSUME_NONNULL_BEGIN
2019

Sources/Sentry/SentryTransportAdapter.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#import "SentryEnvelope.h"
33
#import "SentryEvent.h"
44
#import "SentryOptions.h"
5-
#import "SentryUserFeedback.h"
5+
#import "SentrySwift.h"
66

77
NS_ASSUME_NONNULL_BEGIN
88

Sources/Sentry/SentryUserFeedback.m

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import Foundation
2+
3+
/// Adds additional information about what happened to an event.
4+
/// @deprecated Use `SentryFeedback`.
5+
@objc(SentryUserFeedback)
6+
@available(*, deprecated, message: "Use SentryFeedback.")
7+
open class UserFeedback: NSObject, SentrySerializable {
8+
9+
/// The eventId of the event to which the user feedback is associated.
10+
@objc open private(set) var eventId: SentryId
11+
12+
/// The name of the user.
13+
@objc open var name: String
14+
15+
/// The email of the user.
16+
@objc open var email: String
17+
18+
/// Comments of the user about what happened.
19+
@objc open var comments: String
20+
21+
/// Initializes SentryUserFeedback and sets the required eventId.
22+
/// - Parameter eventId: The eventId of the event to which the user feedback is associated.
23+
@objc public init(eventId: SentryId) {
24+
self.eventId = eventId
25+
self.email = ""
26+
self.name = ""
27+
self.comments = ""
28+
super.init()
29+
}
30+
31+
open func serialize() -> [String: Any] {
32+
return [
33+
"event_id": eventId.sentryIdString,
34+
"email": email,
35+
"name": name,
36+
"comments": comments
37+
]
38+
}
39+
}

0 commit comments

Comments
 (0)