-
-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new SentryFeedback interface and thread callpath to capture in en…
…velope
- Loading branch information
1 parent
210286d
commit 13b0327
Showing
13 changed files
with
155 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
Sources/Swift/Integrations/UserFeedback/SentryFeedback.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import Foundation | ||
#if os(iOS) && !SENTRY_NO_UIKIT | ||
@_implementationOnly import _SentryPrivate | ||
import UIKit | ||
|
||
/** | ||
* A user feedback item that serializes to an envelope with the new format described at | ||
* https://develop.sentry.dev/application/feedback-architecture/#feedback-events. | ||
*/ | ||
@objcMembers | ||
class SentryFeedback: NSObject, SentrySerializable { | ||
enum Source: String { | ||
case widget | ||
case custom | ||
} | ||
|
||
var name: String? | ||
var email: String? | ||
var message: String | ||
var hints: [String: Any]? | ||
var source: Source | ||
let eventId: SentryId | ||
|
||
/// The event id that this feedback is associated with, like a crash report. | ||
var associatedEventId: String? | ||
|
||
init(name: String?, email: String?, message: String, hints: [String: Any]?, source: Source, associatedEventId: String?) { | ||
self.eventId = SentryId() | ||
self.name = name | ||
self.email = email | ||
self.message = message | ||
self.hints = hints | ||
self.source = source | ||
self.associatedEventId = associatedEventId | ||
super.init() | ||
} | ||
|
||
func serialize() -> [String : Any] { | ||
var dict: [String: Any] = [ | ||
"message": message | ||
] | ||
if let name = name { | ||
dict["name"] = name | ||
} | ||
if let email = email { | ||
dict["contact_email"] = email | ||
} | ||
if let associatedEventId = associatedEventId { | ||
dict["associated_event_id"] = associatedEventId | ||
} | ||
dict["source"] = source.rawValue | ||
|
||
return dict | ||
} | ||
} | ||
|
||
#endif // os(iOS) && !SENTRY_NO_UIKIT |