-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add user feedback capturing support for desktop (#521)
- Loading branch information
1 parent
736c56b
commit 838e27b
Showing
8 changed files
with
117 additions
and
8 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
65 changes: 65 additions & 0 deletions
65
plugin-dev/Source/Sentry/Private/Desktop/SentryUserFeedbackDesktop.cpp
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,65 @@ | ||
// Copyright (c) 2022 Sentry. All Rights Reserved. | ||
|
||
#include "SentryUserFeedbackDesktop.h" | ||
|
||
#include "SentryId.h" | ||
|
||
#include "Infrastructure/SentryConvertorsDesktop.h" | ||
|
||
#if USE_SENTRY_NATIVE | ||
|
||
SentryUserFeedbackDesktop::SentryUserFeedbackDesktop() | ||
{ | ||
UserFeedbackDesktop = sentry_value_new_object(); | ||
} | ||
|
||
SentryUserFeedbackDesktop::SentryUserFeedbackDesktop(USentryId* eventId) | ||
{ | ||
UserFeedbackDesktop = sentry_value_new_object(); | ||
sentry_value_set_by_key(UserFeedbackDesktop, "event_id", sentry_value_new_string(TCHAR_TO_ANSI(*eventId->ToString()))); | ||
} | ||
|
||
SentryUserFeedbackDesktop::~SentryUserFeedbackDesktop() | ||
{ | ||
// Put custom destructor logic here if needed | ||
} | ||
|
||
sentry_value_t SentryUserFeedbackDesktop::GetNativeObject() | ||
{ | ||
return UserFeedbackDesktop; | ||
} | ||
|
||
void SentryUserFeedbackDesktop::SetName(const FString& name) | ||
{ | ||
sentry_value_set_by_key(UserFeedbackDesktop, "name", sentry_value_new_string(TCHAR_TO_ANSI(*name))); | ||
} | ||
|
||
FString SentryUserFeedbackDesktop::GetName() const | ||
{ | ||
sentry_value_t username = sentry_value_get_by_key(UserFeedbackDesktop, "name"); | ||
return FString(sentry_value_as_string(username)); | ||
} | ||
|
||
void SentryUserFeedbackDesktop::SetEmail(const FString& email) | ||
{ | ||
sentry_value_set_by_key(UserFeedbackDesktop, "email", sentry_value_new_string(TCHAR_TO_ANSI(*email))); | ||
} | ||
|
||
FString SentryUserFeedbackDesktop::GetEmail() const | ||
{ | ||
sentry_value_t email = sentry_value_get_by_key(UserFeedbackDesktop, "email"); | ||
return FString(sentry_value_as_string(email)); | ||
} | ||
|
||
void SentryUserFeedbackDesktop::SetComment(const FString& comment) | ||
{ | ||
sentry_value_set_by_key(UserFeedbackDesktop, "comments", sentry_value_new_string(TCHAR_TO_ANSI(*comment))); | ||
} | ||
|
||
FString SentryUserFeedbackDesktop::GetComment() const | ||
{ | ||
sentry_value_t comment = sentry_value_get_by_key(UserFeedbackDesktop, "comments"); | ||
return FString(sentry_value_as_string(comment)); | ||
} | ||
|
||
#endif |
33 changes: 33 additions & 0 deletions
33
plugin-dev/Source/Sentry/Private/Desktop/SentryUserFeedbackDesktop.h
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,33 @@ | ||
// Copyright (c) 2022 Sentry. All Rights Reserved. | ||
|
||
#pragma once | ||
|
||
#include "Convenience/SentryInclude.h" | ||
|
||
#include "Interface/SentryUserFeedbackInterface.h" | ||
|
||
#if USE_SENTRY_NATIVE | ||
|
||
class USentryId; | ||
|
||
class SentryUserFeedbackDesktop : public ISentryUserFeedback | ||
{ | ||
public: | ||
SentryUserFeedbackDesktop(); | ||
SentryUserFeedbackDesktop(USentryId* eventId); | ||
virtual ~SentryUserFeedbackDesktop() override; | ||
|
||
sentry_value_t GetNativeObject(); | ||
|
||
virtual void SetName(const FString& name) override; | ||
virtual FString GetName() const override; | ||
virtual void SetEmail(const FString& email) override; | ||
virtual FString GetEmail() const override; | ||
virtual void SetComment(const FString& comment) override; | ||
virtual FString GetComment() const override; | ||
|
||
private: | ||
sentry_value_t UserFeedbackDesktop; | ||
}; | ||
|
||
#endif |
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