Skip to content

Commit aae4b98

Browse files
committed
Use variant for breadcrumb data
1 parent ea47372 commit aae4b98

27 files changed

+100
-83
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
### Breaking Changes
44

5-
- In `SentryScope` class the "Value" suffix has been removed from the get/set functions for tags and extras.
6-
- The get/set functions for tags, contexts, and extras in `SentryScope` now accept a variant type instead of string for the value.
5+
- The "Value" suffix has been removed from the get/set function names for tags and extras in `SentryScope`.
6+
- The get/set functions for contexts and extras in `SentryScope` now accept a variant type instead of string for the value.
7+
- The get/set functions for arbitrary data in `SentryBreadcrumb` now accept a variant type instead of string for the value.
78

89
## 1.0.0-beta.3
910

plugin-dev/Source/Sentry/Private/Android/AndroidSentryBreadcrumb.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ FString FAndroidSentryBreadcrumb::GetCategory() const
6161
return CallMethod<FString>(GetCategoryMethod);
6262
}
6363

64-
void FAndroidSentryBreadcrumb::SetData(const TMap<FString, FString>& data)
64+
void FAndroidSentryBreadcrumb::SetData(const TMap<FString, FSentryVariant>& data)
6565
{
6666
for (const auto& dataItem : data)
6767
{
68-
CallMethod<void>(SetDataMethod, *GetJString(dataItem.Key), *GetJString(dataItem.Value));
68+
CallMethod<void>(SetDataMethod, *GetJString(dataItem.Key), FAndroidSentryConverters::VariantToNative(dataItem.Value)->GetJObject());
6969
}
7070
}
7171

72-
TMap<FString, FString> FAndroidSentryBreadcrumb::GetData() const
72+
TMap<FString, FSentryVariant> FAndroidSentryBreadcrumb::GetData() const
7373
{
7474
auto data = CallObjectMethod<jobject>(GetDataMethod);
75-
return FAndroidSentryConverters::StringMapToUnreal(*data);
75+
return FAndroidSentryConverters::VariantMapToUnreal(*data);
7676
}
7777

7878
void FAndroidSentryBreadcrumb::SetLevel(ESentryLevel level)

plugin-dev/Source/Sentry/Private/Android/AndroidSentryBreadcrumb.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class FAndroidSentryBreadcrumb : public ISentryBreadcrumb, public FSentryJavaObj
2020
virtual FString GetType() const override;
2121
virtual void SetCategory(const FString& category) override;
2222
virtual FString GetCategory() const override;
23-
virtual void SetData(const TMap<FString, FString>& data) override;
24-
virtual TMap<FString, FString> GetData() const override;
23+
virtual void SetData(const TMap<FString, FSentryVariant>& data) override;
24+
virtual TMap<FString, FSentryVariant> GetData() const override;
2525
virtual void SetLevel(ESentryLevel level) override;
2626
virtual ESentryLevel GetLevel() const override;
2727

plugin-dev/Source/Sentry/Private/Android/AndroidSentrySubsystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void FAndroidSentrySubsystem::AddBreadcrumb(TSharedPtr<ISentryBreadcrumb> breadc
109109
breadcrumbAndroid->GetJObject());
110110
}
111111

112-
void FAndroidSentrySubsystem::AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap<FString, FString>& Data, ESentryLevel Level)
112+
void FAndroidSentrySubsystem::AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap<FString, FSentryVariant>& Data, ESentryLevel Level)
113113
{
114114
TSharedPtr<FAndroidSentryBreadcrumb> breadcrumbAndroid = MakeShareable(new FAndroidSentryBreadcrumb());
115115
breadcrumbAndroid->SetMessage(Message);

plugin-dev/Source/Sentry/Private/Android/AndroidSentrySubsystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class FAndroidSentrySubsystem : public ISentrySubsystem
1212
virtual bool IsEnabled() override;
1313
virtual ESentryCrashedLastRun IsCrashedLastRun() override;
1414
virtual void AddBreadcrumb(TSharedPtr<ISentryBreadcrumb> breadcrumb) override;
15-
virtual void AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap<FString, FString>& Data, ESentryLevel Level) override;
15+
virtual void AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap<FString, FSentryVariant>& Data, ESentryLevel Level) override;
1616
virtual void ClearBreadcrumbs() override;
1717
virtual TSharedPtr<ISentryId> CaptureMessage(const FString& message, ESentryLevel level) override;
1818
virtual TSharedPtr<ISentryId> CaptureMessageWithScope(const FString& message, ESentryLevel level, const FSentryScopeDelegate& onConfigureScope) override;

plugin-dev/Source/Sentry/Private/Apple/AppleSentryBreadcrumb.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ FString FAppleSentryBreadcrumb::GetCategory() const
5656
return FString(BreadcrumbApple.category);
5757
}
5858

59-
void FAppleSentryBreadcrumb::SetData(const TMap<FString, FString>& data)
59+
void FAppleSentryBreadcrumb::SetData(const TMap<FString, FSentryVariant>& data)
6060
{
61-
BreadcrumbApple.data = FAppleSentryConverters::StringMapToNative(data);
61+
BreadcrumbApple.data = FAppleSentryConverters::VariantMapToNative(data);
6262
}
6363

64-
TMap<FString, FString> FAppleSentryBreadcrumb::GetData() const
64+
TMap<FString, FSentryVariant> FAppleSentryBreadcrumb::GetData() const
6565
{
66-
return FAppleSentryConverters::StringMapToUnreal(BreadcrumbApple.data);
66+
return FAppleSentryConverters::VariantMapToUnreal(BreadcrumbApple.data);
6767
}
6868

6969
void FAppleSentryBreadcrumb::SetLevel(ESentryLevel level)

plugin-dev/Source/Sentry/Private/Apple/AppleSentryBreadcrumb.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class FAppleSentryBreadcrumb : public ISentryBreadcrumb
2121
virtual FString GetType() const override;
2222
virtual void SetCategory(const FString& category) override;
2323
virtual FString GetCategory() const override;
24-
virtual void SetData(const TMap<FString, FString>& data) override;
25-
virtual TMap<FString, FString> GetData() const override;
24+
virtual void SetData(const TMap<FString, FSentryVariant>& data) override;
25+
virtual TMap<FString, FSentryVariant> GetData() const override;
2626
virtual void SetLevel(ESentryLevel level) override;
2727
virtual ESentryLevel GetLevel() const override;
2828

plugin-dev/Source/Sentry/Private/Apple/AppleSentrySubsystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void FAppleSentrySubsystem::AddBreadcrumb(TSharedPtr<ISentryBreadcrumb> breadcru
183183
[SentrySDK addBreadcrumb:breadcrumbIOS->GetNativeObject()];
184184
}
185185

186-
void FAppleSentrySubsystem::AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap<FString, FString>& Data, ESentryLevel Level)
186+
void FAppleSentrySubsystem::AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap<FString, FSentryVariant>& Data, ESentryLevel Level)
187187
{
188188
TSharedPtr<FAppleSentryBreadcrumb> breadcrumbIOS = MakeShareable(new FAppleSentryBreadcrumb());
189189
breadcrumbIOS->SetMessage(Message);

plugin-dev/Source/Sentry/Private/Apple/AppleSentrySubsystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class FAppleSentrySubsystem : public ISentrySubsystem
1212
virtual bool IsEnabled() override;
1313
virtual ESentryCrashedLastRun IsCrashedLastRun() override;
1414
virtual void AddBreadcrumb(TSharedPtr<ISentryBreadcrumb> breadcrumb) override;
15-
virtual void AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap<FString, FString>& Data, ESentryLevel Level) override;
15+
virtual void AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap<FString, FSentryVariant>& Data, ESentryLevel Level) override;
1616
virtual void ClearBreadcrumbs() override;
1717
virtual TSharedPtr<ISentryId> CaptureMessage(const FString& message, ESentryLevel level) override;
1818
virtual TSharedPtr<ISentryId> CaptureMessageWithScope(const FString& message, ESentryLevel level, const FSentryScopeDelegate& onConfigureScope) override;

plugin-dev/Source/Sentry/Private/GenericPlatform/GenericPlatformSentryBreadcrumb.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ FString FGenericPlatformSentryBreadcrumb::GetCategory() const
5454
return FString(sentry_value_as_string(category));
5555
}
5656

57-
void FGenericPlatformSentryBreadcrumb::SetData(const TMap<FString, FString>& data)
57+
void FGenericPlatformSentryBreadcrumb::SetData(const ::TMap<FString, FSentryVariant>& data)
5858
{
59-
sentry_value_set_by_key(Breadcrumb, "data", FGenericPlatformSentryConverters::StringMapToNative(data));
59+
sentry_value_set_by_key(Breadcrumb, "data", FGenericPlatformSentryConverters::VariantMapToNative(data));
6060
}
6161

62-
TMap<FString, FString> FGenericPlatformSentryBreadcrumb::GetData() const
62+
TMap<FString, FSentryVariant> FGenericPlatformSentryBreadcrumb::GetData() const
6363
{
6464
sentry_value_t data = sentry_value_get_by_key(Breadcrumb, "data");
65-
return FGenericPlatformSentryConverters::StringMapToUnreal(data);
65+
return FGenericPlatformSentryConverters::VariantMapToUnreal(data);
6666
}
6767

6868
void FGenericPlatformSentryBreadcrumb::SetLevel(ESentryLevel level)

0 commit comments

Comments
 (0)