-
-
Notifications
You must be signed in to change notification settings - Fork 52
New API for capturing user feedback #1051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5320dfb
Update feedback API
tustanivsky 4e1767b
Update package snapshot
tustanivsky 7f65788
Format code
getsentry-bot 1aa2cc4
Fix minor errors on Mac
tustanivsky d08e6e6
Fix Android build errors
tustanivsky c742483
Clean up Apple implementation
tustanivsky 539a721
Fix naming
tustanivsky 8e2d3f4
Add feedback message getter
tustanivsky ef28286
Add feedback tests
tustanivsky 75456b6
Remove dashes from event id string on Windows/Linux
tustanivsky df3e2f7
Fix minor build errors
tustanivsky b7d17c5
Update package snapshot
tustanivsky e0bc880
Update changelog
tustanivsky 6a96e7c
Merge branch 'main' into feat/new-feedback
tustanivsky 46d5dc0
Add feedback associated event id check to setter
tustanivsky b66f96d
Merge branch 'main' into feat/new-feedback
tustanivsky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
68 changes: 68 additions & 0 deletions
68
plugin-dev/Source/Sentry/Private/Android/AndroidSentryFeedback.cpp
This file contains hidden or 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,68 @@ | ||
| // Copyright (c) 2025 Sentry. All Rights Reserved. | ||
|
|
||
| #include "AndroidSentryFeedback.h" | ||
|
|
||
| #include "AndroidSentryId.h" | ||
|
|
||
| #include "Infrastructure/AndroidSentryJavaClasses.h" | ||
|
|
||
| FAndroidSentryFeedback::FAndroidSentryFeedback(const FString& message) | ||
| : FSentryJavaObjectWrapper(SentryJavaClasses::Feedback, "(Ljava/lang/String;)V", | ||
| *GetJString(message)) | ||
| { | ||
| SetupClassMethods(); | ||
| } | ||
|
|
||
| void FAndroidSentryFeedback::SetupClassMethods() | ||
| { | ||
| GetMessageMethod = GetMethod("getMessage", "()Ljava/lang/String;"); | ||
| SetNameMethod = GetMethod("setName", "(Ljava/lang/String;)V"); | ||
| GetNameMethod = GetMethod("getName", "()Ljava/lang/String;"); | ||
| SetContactEmailMethod = GetMethod("setContactEmail", "(Ljava/lang/String;)V"); | ||
| GetContactEmailMethod = GetMethod("getContactEmail", "()Ljava/lang/String;"); | ||
| SetAssociatedEventMethod = GetMethod("setAssociatedEventId", "(Lio/sentry/protocol/SentryId;)V"); | ||
| GetAssociatedEventMethod = GetMethod("getAssociatedEventId", "()Lio/sentry/protocol/SentryId;"); | ||
| } | ||
|
|
||
| FString FAndroidSentryFeedback::GetMessage() const | ||
| { | ||
| return CallMethod<FString>(GetMessageMethod); | ||
| } | ||
|
|
||
| void FAndroidSentryFeedback::SetName(const FString& name) | ||
| { | ||
| CallMethod<void>(SetNameMethod, *GetJString(name)); | ||
| } | ||
|
|
||
| FString FAndroidSentryFeedback::GetName() const | ||
| { | ||
| return CallMethod<FString>(GetNameMethod); | ||
| } | ||
|
|
||
| void FAndroidSentryFeedback::SetContactEmail(const FString& email) | ||
| { | ||
| CallMethod<void>(SetContactEmailMethod, *GetJString(email)); | ||
| } | ||
|
|
||
| FString FAndroidSentryFeedback::GetContactEmail() const | ||
| { | ||
| return CallMethod<FString>(GetContactEmailMethod); | ||
| } | ||
|
|
||
| void FAndroidSentryFeedback::SetAssociatedEvent(const FString& eventId) | ||
| { | ||
| TSharedPtr<FAndroidSentryId> idAndroid = MakeShareable(new FAndroidSentryId(eventId)); | ||
| CallMethod<void>(SetAssociatedEventMethod, idAndroid->GetJObject()); | ||
| } | ||
|
|
||
| FString FAndroidSentryFeedback::GetAssociatedEvent() const | ||
| { | ||
| auto idAndroid = CallObjectMethod<jobject>(GetAssociatedEventMethod); | ||
| if (!idAndroid) | ||
| { | ||
| return FString(); | ||
| } | ||
|
|
||
| TSharedPtr<FAndroidSentryId> eventId = MakeShareable(new FAndroidSentryId(*idAndroid)); | ||
| return eventId->ToString(); | ||
| } | ||
36 changes: 36 additions & 0 deletions
36
plugin-dev/Source/Sentry/Private/Android/AndroidSentryFeedback.h
This file contains hidden or 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,36 @@ | ||
| // Copyright (c) 2025 Sentry. All Rights Reserved. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "Interface/SentryFeedbackInterface.h" | ||
|
|
||
| #include "Infrastructure/AndroidSentryJavaObjectWrapper.h" | ||
|
|
||
| class ISentryId; | ||
|
|
||
| class FAndroidSentryFeedback : public ISentryFeedback, public FSentryJavaObjectWrapper | ||
| { | ||
| public: | ||
| FAndroidSentryFeedback(const FString& message); | ||
|
|
||
| void SetupClassMethods(); | ||
|
|
||
| virtual FString GetMessage() const override; | ||
| virtual void SetName(const FString& name) override; | ||
| virtual FString GetName() const override; | ||
| virtual void SetContactEmail(const FString& email) override; | ||
| virtual FString GetContactEmail() const override; | ||
| virtual void SetAssociatedEvent(const FString& eventId) override; | ||
| virtual FString GetAssociatedEvent() const override; | ||
|
|
||
| private: | ||
| FSentryJavaMethod GetMessageMethod; | ||
| FSentryJavaMethod SetNameMethod; | ||
| FSentryJavaMethod GetNameMethod; | ||
| FSentryJavaMethod SetContactEmailMethod; | ||
| FSentryJavaMethod GetContactEmailMethod; | ||
| FSentryJavaMethod SetAssociatedEventMethod; | ||
| FSentryJavaMethod GetAssociatedEventMethod; | ||
| }; | ||
|
|
||
| typedef FAndroidSentryFeedback FPlatformSentryFeedback; |
This file contains hidden or 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 hidden or 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
54 changes: 0 additions & 54 deletions
54
plugin-dev/Source/Sentry/Private/Android/AndroidSentryUserFeedback.cpp
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
plugin-dev/Source/Sentry/Private/Android/AndroidSentryUserFeedback.h
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
70 changes: 70 additions & 0 deletions
70
plugin-dev/Source/Sentry/Private/Apple/AppleSentryFeedback.cpp
This file contains hidden or 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,70 @@ | ||
| // Copyright (c) 2025 Sentry. All Rights Reserved. | ||
|
|
||
| #include "AppleSentryFeedback.h" | ||
|
|
||
| #include "AppleSentryId.h" | ||
|
|
||
| #include "Convenience/AppleSentryInclude.h" | ||
| #include "Convenience/AppleSentryMacro.h" | ||
|
|
||
| FAppleSentryFeedback::FAppleSentryFeedback(const FString& message) | ||
| : Message(message) | ||
| { | ||
| } | ||
|
|
||
| FAppleSentryFeedback::~FAppleSentryFeedback() | ||
| { | ||
| // Put custom destructor logic here if needed | ||
| } | ||
|
|
||
| FString FAppleSentryFeedback::GetMessage() const | ||
| { | ||
| return Message; | ||
| } | ||
|
|
||
| void FAppleSentryFeedback::SetName(const FString& name) | ||
| { | ||
| Name = name; | ||
| } | ||
|
|
||
| FString FAppleSentryFeedback::GetName() const | ||
| { | ||
| return Name; | ||
| } | ||
|
|
||
| void FAppleSentryFeedback::SetContactEmail(const FString& email) | ||
| { | ||
| Email = email; | ||
| } | ||
|
|
||
| FString FAppleSentryFeedback::GetContactEmail() const | ||
| { | ||
| return Email; | ||
| } | ||
|
|
||
| void FAppleSentryFeedback::SetAssociatedEvent(const FString& eventId) | ||
| { | ||
| EventId = eventId; | ||
| } | ||
|
|
||
| FString FAppleSentryFeedback::GetAssociatedEvent() const | ||
| { | ||
| return EventId; | ||
| } | ||
|
|
||
| SentryFeedback* FAppleSentryFeedback::CreateSentryFeedback(TSharedPtr<FAppleSentryFeedback> feedback) | ||
| { | ||
| SentryId* id = nil; | ||
| if (!feedback->EventId.IsEmpty()) | ||
| { | ||
| TSharedPtr<FAppleSentryId> idIOS = MakeShareable(new FAppleSentryId(feedback->EventId)); | ||
| id = idIOS->GetNativeObject(); | ||
| } | ||
|
|
||
| return [[SENTRY_APPLE_CLASS(SentryFeedback) alloc] initWithMessage:feedback->Message.GetNSString() | ||
| name:feedback->Name.GetNSString() | ||
| email:feedback->Email.GetNSString() | ||
| source:SentryFeedbackSourceCustom | ||
| associatedEventId:id | ||
| attachments:nil]; | ||
| } |
32 changes: 32 additions & 0 deletions
32
plugin-dev/Source/Sentry/Private/Apple/AppleSentryFeedback.h
This file contains hidden or 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,32 @@ | ||
| // Copyright (c) 2025 Sentry. All Rights Reserved. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "Interface/SentryFeedbackInterface.h" | ||
|
|
||
| @class SentryFeedback; | ||
|
|
||
| class FAppleSentryFeedback : public ISentryFeedback | ||
| { | ||
| public: | ||
| FAppleSentryFeedback(const FString& message); | ||
| virtual ~FAppleSentryFeedback() override; | ||
|
|
||
| virtual FString GetMessage() const override; | ||
| virtual void SetName(const FString& name) override; | ||
| virtual FString GetName() const override; | ||
| virtual void SetContactEmail(const FString& email) override; | ||
| virtual FString GetContactEmail() const override; | ||
| virtual void SetAssociatedEvent(const FString& eventId) override; | ||
| virtual FString GetAssociatedEvent() const override; | ||
|
|
||
| static SentryFeedback* CreateSentryFeedback(TSharedPtr<FAppleSentryFeedback> feedback); | ||
|
|
||
| private: | ||
| FString Message; | ||
| FString Name; | ||
| FString Email; | ||
| FString EventId; | ||
| }; | ||
|
|
||
| typedef FAppleSentryFeedback FPlatformSentryFeedback; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.