diff --git a/plugin-dev/Source/Sentry/Private/Android/Callbacks/SentryScopeCallbackAndroid.cpp b/plugin-dev/Source/Sentry/Private/Android/Callbacks/SentryScopeCallbackAndroid.cpp index 18e21225..c7c59d27 100644 --- a/plugin-dev/Source/Sentry/Private/Android/Callbacks/SentryScopeCallbackAndroid.cpp +++ b/plugin-dev/Source/Sentry/Private/Android/Callbacks/SentryScopeCallbackAndroid.cpp @@ -2,21 +2,33 @@ #include "SentryScopeCallbackAndroid.h" -USentryScopeCallbackAndroid::USentryScopeCallbackAndroid() +#include "HAL/CriticalSection.h" + +int64 SentryScopeCallbackAndroid::NextDelegateID; +TMap SentryScopeCallbackAndroid::ScopeDelegates; + +FCriticalSection CriticalSection; + +int64 SentryScopeCallbackAndroid::SaveDelegate(const FSentryScopeDelegate& onConfigure) { - if (USentryScope::StaticClass()->GetDefaultObject() != this) - { - AddToRoot(); - } + FScopeLock Lock(&CriticalSection); + + int64 delegateId = NextDelegateID++; + ScopeDelegates.Add(delegateId, onConfigure); + + return delegateId; } -void USentryScopeCallbackAndroid::BindDelegate(const FConfigureScopeNativeDelegate& OnConfigure) +void SentryScopeCallbackAndroid::RemoveDelegate(int64 delegateId) { - OnConfigureDelegate = OnConfigure; + FScopeLock Lock(&CriticalSection); + + ScopeDelegates.Remove(delegateId); } -void USentryScopeCallbackAndroid::ExecuteDelegate(USentryScope* Scope) +FSentryScopeDelegate* SentryScopeCallbackAndroid::GetDelegateById(int64 delegateId) { - OnConfigureDelegate.ExecuteIfBound(Scope); - RemoveFromRoot(); + FScopeLock Lock(&CriticalSection); + + return ScopeDelegates.Find(delegateId); } diff --git a/plugin-dev/Source/Sentry/Private/Android/Callbacks/SentryScopeCallbackAndroid.h b/plugin-dev/Source/Sentry/Private/Android/Callbacks/SentryScopeCallbackAndroid.h index 1f87a834..8a07434e 100644 --- a/plugin-dev/Source/Sentry/Private/Android/Callbacks/SentryScopeCallbackAndroid.h +++ b/plugin-dev/Source/Sentry/Private/Android/Callbacks/SentryScopeCallbackAndroid.h @@ -4,21 +4,16 @@ #include "CoreMinimal.h" -#include "SentryScope.h" +#include "Android/SentrySubsystemAndroid.h" -#include "SentryScopeCallbackAndroid.generated.h" - -UCLASS() -class USentryScopeCallbackAndroid : public UObject +class SentryScopeCallbackAndroid { - GENERATED_BODY() - public: - USentryScopeCallbackAndroid(); - - void BindDelegate(const FConfigureScopeNativeDelegate& OnConfigure); - void ExecuteDelegate(USentryScope* Scope); + static int64 SaveDelegate(const FSentryScopeDelegate& onConfigure); + static void RemoveDelegate(int64 delegateId); + static FSentryScopeDelegate* GetDelegateById(int64 delegateId); private: - FConfigureScopeNativeDelegate OnConfigureDelegate; + static int64 NextDelegateID; + static TMap ScopeDelegates; }; diff --git a/plugin-dev/Source/Sentry/Private/Android/Infrastructure/SentryConvertorsAndroid.cpp b/plugin-dev/Source/Sentry/Private/Android/Infrastructure/SentryConvertorsAndroid.cpp index f4356621..b635d54c 100644 --- a/plugin-dev/Source/Sentry/Private/Android/Infrastructure/SentryConvertorsAndroid.cpp +++ b/plugin-dev/Source/Sentry/Private/Android/Infrastructure/SentryConvertorsAndroid.cpp @@ -4,19 +4,8 @@ #include "SentryJavaObjectWrapper.h" #include "SentryJavaClasses.h" -#include "SentryScope.h" -#include "SentryId.h" -#include "SentryTransaction.h" -#include "SentrySpan.h" -#include "SentryTransactionContext.h" #include "SentryDefines.h" -#include "Android/SentryScopeAndroid.h" -#include "Android/SentryIdAndroid.h" -#include "Android/SentryTransactionAndroid.h" -#include "Android/SentrySpanAndroid.h" -#include "Android/SentryTransactionContextAndroid.h" - #include "Android/AndroidApplication.h" #include "Android/AndroidJavaEnv.h" @@ -139,46 +128,6 @@ ESentryLevel SentryConvertorsAndroid::SentryLevelToUnreal(jobject level) return unrealLevel; } -USentryScope* SentryConvertorsAndroid::SentryScopeToUnreal(jobject scope) -{ - TSharedPtr scopeNativeImpl = MakeShareable(new SentryScopeAndroid(scope)); - USentryScope* unrealScope = NewObject(); - unrealScope->InitWithNativeImpl(scopeNativeImpl); - return unrealScope; -} - -USentryId* SentryConvertorsAndroid::SentryIdToUnreal(jobject id) -{ - TSharedPtr idNativeImpl = MakeShareable(new SentryIdAndroid(id)); - USentryId* unrealId = NewObject(); - unrealId->InitWithNativeImpl(idNativeImpl); - return unrealId; -} - -USentryTransaction* SentryConvertorsAndroid::SentryTransactionToUnreal(jobject transaction) -{ - TSharedPtr transactionNativeImpl = MakeShareable(new SentryTransactionAndroid(transaction)); - USentryTransaction* unrealTransaction = NewObject(); - unrealTransaction->InitWithNativeImpl(transactionNativeImpl); - return unrealTransaction; -} - -USentrySpan* SentryConvertorsAndroid::SentrySpanToUnreal(jobject span) -{ - TSharedPtr spanNativeImpl = MakeShareable(new SentrySpanAndroid(span)); - USentrySpan* unrealSpan = NewObject(); - unrealSpan->InitWithNativeImpl(spanNativeImpl); - return unrealSpan; -} - -USentryTransactionContext* SentryConvertorsAndroid::SentryTransactionContextToUnreal(jobject transactionContext) -{ - TSharedPtr transactionContextNativeImpl = MakeShareable(new SentryTransactionContextAndroid(transactionContext)); - USentryTransactionContext* unrealTransactionContext = NewObject(); - unrealTransactionContext->InitWithNativeImpl(transactionContextNativeImpl); - return unrealTransactionContext; -} - TMap SentryConvertorsAndroid::StringMapToUnreal(jobject map) { TMap result; diff --git a/plugin-dev/Source/Sentry/Private/Android/Infrastructure/SentryConvertorsAndroid.h b/plugin-dev/Source/Sentry/Private/Android/Infrastructure/SentryConvertorsAndroid.h index 6aad1ced..6332cf16 100644 --- a/plugin-dev/Source/Sentry/Private/Android/Infrastructure/SentryConvertorsAndroid.h +++ b/plugin-dev/Source/Sentry/Private/Android/Infrastructure/SentryConvertorsAndroid.h @@ -6,11 +6,6 @@ #include "Android/AndroidJNI.h" -class USentryScope; -class USentryId; -class USentryTransaction; -class USentrySpan; -class USentryTransactionContext; class FSentryJavaObjectWrapper; class FJsonValue; @@ -25,11 +20,6 @@ class SentryConvertorsAndroid /** Conversions from native Java types */ static ESentryLevel SentryLevelToUnreal(jobject level); - static USentryScope* SentryScopeToUnreal(jobject scope); - static USentryId* SentryIdToUnreal(jobject id); - static USentryTransaction* SentryTransactionToUnreal(jobject transaction); - static USentrySpan* SentrySpanToUnreal(jobject span); - static USentryTransactionContext* SentryTransactionContextToUnreal(jobject transactionContext); static TMap StringMapToUnreal(jobject stringMap); static TArray StringListToUnreal(jobject stringList); static TArray ByteArrayToUnreal(jbyteArray byteArray); diff --git a/plugin-dev/Source/Sentry/Private/Android/Jni/SentryJniAndroid.cpp b/plugin-dev/Source/Sentry/Private/Android/Jni/SentryJniAndroid.cpp index 5e3adede..72a9590c 100644 --- a/plugin-dev/Source/Sentry/Private/Android/Jni/SentryJniAndroid.cpp +++ b/plugin-dev/Source/Sentry/Private/Android/Jni/SentryJniAndroid.cpp @@ -3,6 +3,8 @@ #include "Android/Callbacks/SentryScopeCallbackAndroid.h" #include "Android/Infrastructure/SentryConvertorsAndroid.h" #include "Android/Infrastructure/SentryJavaClasses.h" +#include "Android/SentrySubsystemAndroid.h" +#include "Android/SentryScopeAndroid.h" #include "Android/SentryEventAndroid.h" #include "Android/SentryHintAndroid.h" #include "Android/SentrySamplingContextAndroid.h" @@ -16,13 +18,14 @@ #include "SentryTraceSampler.h" #include "SentrySamplingContext.h" -JNI_METHOD void Java_io_sentry_unreal_SentryBridgeJava_onConfigureScope(JNIEnv* env, jclass clazz, jlong objAddr, jobject scope) +JNI_METHOD void Java_io_sentry_unreal_SentryBridgeJava_onConfigureScope(JNIEnv* env, jclass clazz, jlong callbackId, jobject scope) { - USentryScopeCallbackAndroid* callback = reinterpret_cast(objAddr); + FSentryScopeDelegate* callback = SentryScopeCallbackAndroid::GetDelegateById(callbackId); - if (IsValid(callback)) + if (callback != nullptr) { - callback->ExecuteDelegate(SentryConvertorsAndroid::SentryScopeToUnreal(scope)); + callback->Execute(MakeShareable(new SentryScopeAndroid(scope))); + SentryScopeCallbackAndroid::RemoveDelegate(callbackId); } } diff --git a/plugin-dev/Source/Sentry/Private/Android/SentryHintAndroid.cpp b/plugin-dev/Source/Sentry/Private/Android/SentryHintAndroid.cpp index 2717798e..749ece04 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentryHintAndroid.cpp +++ b/plugin-dev/Source/Sentry/Private/Android/SentryHintAndroid.cpp @@ -1,3 +1,5 @@ +// Copyright (c) 2023 Sentry. All Rights Reserved. + #include "SentryHintAndroid.h" #include "SentryAttachmentAndroid.h" @@ -23,8 +25,8 @@ void SentryHintAndroid::SetupClassMethods() AddAttachmentMethod = GetMethod("addAttachment", "(Lio/sentry/Attachment;)V"); } -void SentryHintAndroid::AddAttachment(USentryAttachment* attachment) +void SentryHintAndroid::AddAttachment(TSharedPtr attachment) { - TSharedPtr attachmentAndroid = StaticCastSharedPtr(attachment->GetNativeImpl()); + TSharedPtr attachmentAndroid = StaticCastSharedPtr(attachment); CallMethod(AddAttachmentMethod, attachmentAndroid->GetJObject()); } \ No newline at end of file diff --git a/plugin-dev/Source/Sentry/Private/Android/SentryHintAndroid.h b/plugin-dev/Source/Sentry/Private/Android/SentryHintAndroid.h index 1b04f2a2..fb92bd28 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentryHintAndroid.h +++ b/plugin-dev/Source/Sentry/Private/Android/SentryHintAndroid.h @@ -14,7 +14,7 @@ class SentryHintAndroid : public ISentryHint, public FSentryJavaObjectWrapper void SetupClassMethods(); - virtual void AddAttachment(USentryAttachment* attachment) override; + virtual void AddAttachment(TSharedPtr attachment) override; private: FSentryJavaMethod AddAttachmentMethod; diff --git a/plugin-dev/Source/Sentry/Private/Android/SentrySamplingContextAndroid.cpp b/plugin-dev/Source/Sentry/Private/Android/SentrySamplingContextAndroid.cpp index 4f064ae8..6e1936d5 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentrySamplingContextAndroid.cpp +++ b/plugin-dev/Source/Sentry/Private/Android/SentrySamplingContextAndroid.cpp @@ -1,8 +1,7 @@ // Copyright (c) 2024 Sentry. All Rights Reserved. #include "SentrySamplingContextAndroid.h" - -#include "SentryTransactionContext.h" +#include "SentryTransactionContextAndroid.h" #include "Infrastructure/SentryConvertorsAndroid.h" #include "Infrastructure/SentryJavaClasses.h" @@ -19,10 +18,10 @@ void SentrySamplingContextAndroid::SetupClassMethods() GetCustomSamplingContextMethod = GetMethod("getCustomSamplingContext", "()Lio/sentry/CustomSamplingContext;"); } -USentryTransactionContext* SentrySamplingContextAndroid::GetTransactionContext() const +TSharedPtr SentrySamplingContextAndroid::GetTransactionContext() const { auto transactionContext = CallObjectMethod(GetTransactionContextMethod); - return SentryConvertorsAndroid::SentryTransactionContextToUnreal(*transactionContext); + return MakeShareable(new SentryTransactionContextAndroid(*transactionContext)); } TMap SentrySamplingContextAndroid::GetCustomSamplingContext() const diff --git a/plugin-dev/Source/Sentry/Private/Android/SentrySamplingContextAndroid.h b/plugin-dev/Source/Sentry/Private/Android/SentrySamplingContextAndroid.h index abc7b1a5..b32a6e6c 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentrySamplingContextAndroid.h +++ b/plugin-dev/Source/Sentry/Private/Android/SentrySamplingContextAndroid.h @@ -13,7 +13,7 @@ class SentrySamplingContextAndroid : public ISentrySamplingContext, public FSent void SetupClassMethods(); - virtual USentryTransactionContext* GetTransactionContext() const override; + virtual TSharedPtr GetTransactionContext() const override; virtual TMap GetCustomSamplingContext() const override; private: diff --git a/plugin-dev/Source/Sentry/Private/Android/SentryScopeAndroid.cpp b/plugin-dev/Source/Sentry/Private/Android/SentryScopeAndroid.cpp index 823eb1e9..b6e21905 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentryScopeAndroid.cpp +++ b/plugin-dev/Source/Sentry/Private/Android/SentryScopeAndroid.cpp @@ -5,9 +5,6 @@ #include "SentryBreadcrumbAndroid.h" #include "SentryAttachmentAndroid.h" -#include "SentryBreadcrumb.h" -#include "SentryAttachment.h" - #include "Infrastructure/SentryConvertorsAndroid.h" #include "Infrastructure/SentryJavaClasses.h" @@ -45,9 +42,9 @@ void SentryScopeAndroid::SetupClassMethods() ClearMethod = GetMethod("clear", "()V"); } -void SentryScopeAndroid::AddBreadcrumb(USentryBreadcrumb* breadcrumb) +void SentryScopeAndroid::AddBreadcrumb(TSharedPtr breadcrumb) { - TSharedPtr breadcrumbAndroid = StaticCastSharedPtr(breadcrumb->GetNativeImpl()); + TSharedPtr breadcrumbAndroid = StaticCastSharedPtr(breadcrumb); CallMethod(AddBreadcrumbMethod, breadcrumbAndroid->GetJObject()); } @@ -56,9 +53,9 @@ void SentryScopeAndroid::ClearBreadcrumbs() CallMethod(ClearBreadcrumbsMethod); } -void SentryScopeAndroid::AddAttachment(USentryAttachment* attachment) +void SentryScopeAndroid::AddAttachment(TSharedPtr attachment) { - TSharedPtr attachmentAndroid = StaticCastSharedPtr(attachment->GetNativeImpl()); + TSharedPtr attachmentAndroid = StaticCastSharedPtr(attachment); CallMethod(AddAttachmentMethod, attachmentAndroid->GetJObject()); } diff --git a/plugin-dev/Source/Sentry/Private/Android/SentryScopeAndroid.h b/plugin-dev/Source/Sentry/Private/Android/SentryScopeAndroid.h index 3823e88c..0825b980 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentryScopeAndroid.h +++ b/plugin-dev/Source/Sentry/Private/Android/SentryScopeAndroid.h @@ -14,9 +14,9 @@ class SentryScopeAndroid : public ISentryScope, public FSentryJavaObjectWrapper void SetupClassMethods(); - virtual void AddBreadcrumb(USentryBreadcrumb* breadcrumb) override; + virtual void AddBreadcrumb(TSharedPtr breadcrumb) override; virtual void ClearBreadcrumbs() override; - virtual void AddAttachment(USentryAttachment* attachment) override; + virtual void AddAttachment(TSharedPtr attachment) override; virtual void ClearAttachments() override; virtual void SetTagValue(const FString& key, const FString& value) override; virtual FString GetTagValue(const FString& key) const override; diff --git a/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.cpp b/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.cpp index 21a0cbc5..ebce1955 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.cpp +++ b/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.cpp @@ -6,19 +6,17 @@ #include "SentryBreadcrumbAndroid.h" #include "SentryUserFeedbackAndroid.h" #include "SentryUserAndroid.h" +#include "SentryTransactionAndroid.h" #include "SentryTransactionContextAndroid.h" #include "SentryTransactionOptionsAndroid.h" +#include "SentryIdAndroid.h" #include "SentryDefines.h" #include "SentryBeforeSendHandler.h" #include "SentryTraceSampler.h" #include "SentryEvent.h" -#include "SentryBreadcrumb.h" -#include "SentryId.h" + #include "SentrySettings.h" -#include "SentryUserFeedback.h" -#include "SentryUser.h" -#include "SentryTransactionContext.h" #include "Callbacks/SentryScopeCallbackAndroid.h" @@ -102,9 +100,9 @@ ESentryCrashedLastRun SentrySubsystemAndroid::IsCrashedLastRun() return unrealIsCrashed; } -void SentrySubsystemAndroid::AddBreadcrumb(USentryBreadcrumb* breadcrumb) +void SentrySubsystemAndroid::AddBreadcrumb(TSharedPtr breadcrumb) { - TSharedPtr breadcrumbAndroid = StaticCastSharedPtr(breadcrumb->GetNativeImpl()); + TSharedPtr breadcrumbAndroid = StaticCastSharedPtr(breadcrumb); FSentryJavaObjectWrapper::CallStaticMethod(SentryJavaClasses::Sentry, "addBreadcrumb", "(Lio/sentry/Breadcrumb;)V", breadcrumbAndroid->GetJObject()); @@ -128,54 +126,52 @@ void SentrySubsystemAndroid::ClearBreadcrumbs() FSentryJavaObjectWrapper::CallStaticMethod(SentryJavaClasses::Sentry, "clearBreadcrumbs", "()V"); } -USentryId* SentrySubsystemAndroid::CaptureMessage(const FString& message, ESentryLevel level) +TSharedPtr SentrySubsystemAndroid::CaptureMessage(const FString& message, ESentryLevel level) { auto id = FSentryJavaObjectWrapper::CallStaticObjectMethod(SentryJavaClasses::Sentry, "captureMessage", "(Ljava/lang/String;Lio/sentry/SentryLevel;)Lio/sentry/protocol/SentryId;", *FSentryJavaObjectWrapper::GetJString(message), SentryConvertorsAndroid::SentryLevelToNative(level)->GetJObject()); - return SentryConvertorsAndroid::SentryIdToUnreal(*id); + return MakeShareable(new SentryIdAndroid(*id)); } -USentryId* SentrySubsystemAndroid::CaptureMessageWithScope(const FString& message, const FConfigureScopeNativeDelegate& onConfigureScope, ESentryLevel level) +TSharedPtr SentrySubsystemAndroid::CaptureMessageWithScope(const FString& message, const FSentryScopeDelegate& onConfigureScope, ESentryLevel level) { - USentryScopeCallbackAndroid* scopeCallback = NewObject(); - scopeCallback->BindDelegate(onConfigureScope); + int64 scopeCallbackId = SentryScopeCallbackAndroid::SaveDelegate(onConfigureScope); auto id = FSentryJavaObjectWrapper::CallStaticObjectMethod(SentryJavaClasses::SentryBridgeJava, "captureMessageWithScope", "(Ljava/lang/String;Lio/sentry/SentryLevel;J)Lio/sentry/protocol/SentryId;", - *FSentryJavaObjectWrapper::GetJString(message), SentryConvertorsAndroid::SentryLevelToNative(level)->GetJObject(), (jlong)scopeCallback); + *FSentryJavaObjectWrapper::GetJString(message), SentryConvertorsAndroid::SentryLevelToNative(level)->GetJObject(), scopeCallbackId); - return SentryConvertorsAndroid::SentryIdToUnreal(*id); + return MakeShareable(new SentryIdAndroid(*id)); } -USentryId* SentrySubsystemAndroid::CaptureEvent(USentryEvent* event) +TSharedPtr SentrySubsystemAndroid::CaptureEvent(TSharedPtr event) { - TSharedPtr eventAndroid = StaticCastSharedPtr(event->GetNativeImpl()); + TSharedPtr eventAndroid = StaticCastSharedPtr(event); auto id = FSentryJavaObjectWrapper::CallStaticObjectMethod(SentryJavaClasses::Sentry, "captureEvent", "(Lio/sentry/SentryEvent;)Lio/sentry/protocol/SentryId;", eventAndroid->GetJObject()); - return SentryConvertorsAndroid::SentryIdToUnreal(*id); + return MakeShareable(new SentryIdAndroid(*id)); } -USentryId* SentrySubsystemAndroid::CaptureEventWithScope(USentryEvent* event, const FConfigureScopeNativeDelegate& onConfigureScope) +TSharedPtr SentrySubsystemAndroid::CaptureEventWithScope(TSharedPtr event, const FSentryScopeDelegate& onConfigureScope) { - TSharedPtr eventAndroid = StaticCastSharedPtr(event->GetNativeImpl()); + TSharedPtr eventAndroid = StaticCastSharedPtr(event); - USentryScopeCallbackAndroid* scopeCallback = NewObject(); - scopeCallback->BindDelegate(onConfigureScope); + int64 scopeCallbackId = SentryScopeCallbackAndroid::SaveDelegate(onConfigureScope); auto id = FSentryJavaObjectWrapper::CallStaticObjectMethod(SentryJavaClasses::SentryBridgeJava, "captureEventWithScope", "(Lio/sentry/SentryEvent;J)Lio/sentry/protocol/SentryId;", - eventAndroid->GetJObject(), (jlong)scopeCallback); + eventAndroid->GetJObject(), scopeCallbackId); - return SentryConvertorsAndroid::SentryIdToUnreal(*id); + return MakeShareable(new SentryIdAndroid(*id)); } -USentryId* SentrySubsystemAndroid::CaptureException(const FString& type, const FString& message, int32 framesToSkip) +TSharedPtr SentrySubsystemAndroid::CaptureException(const FString& type, const FString& message, int32 framesToSkip) { return nullptr; } -USentryId* SentrySubsystemAndroid::CaptureAssertion(const FString& type, const FString& message) +TSharedPtr SentrySubsystemAndroid::CaptureAssertion(const FString& type, const FString& message) { const int32 framesToSkip = 8; @@ -190,25 +186,25 @@ USentryId* SentrySubsystemAndroid::CaptureAssertion(const FString& type, const F return nullptr; } -USentryId* SentrySubsystemAndroid::CaptureEnsure(const FString& type, const FString& message) +TSharedPtr SentrySubsystemAndroid::CaptureEnsure(const FString& type, const FString& message) { auto id = FSentryJavaObjectWrapper::CallStaticObjectMethod(SentryJavaClasses::SentryBridgeJava, "captureException", "(Ljava/lang/String;Ljava/lang/String;)Lio/sentry/protocol/SentryId;", *FSentryJavaObjectWrapper::GetJString(type), *FSentryJavaObjectWrapper::GetJString(message)); - return SentryConvertorsAndroid::SentryIdToUnreal(*id); + return MakeShareable(new SentryIdAndroid(*id)); } -void SentrySubsystemAndroid::CaptureUserFeedback(USentryUserFeedback* userFeedback) +void SentrySubsystemAndroid::CaptureUserFeedback(TSharedPtr userFeedback) { - TSharedPtr userFeedbackAndroid = StaticCastSharedPtr(userFeedback->GetNativeImpl()); + TSharedPtr userFeedbackAndroid = StaticCastSharedPtr(userFeedback); FSentryJavaObjectWrapper::CallStaticMethod(SentryJavaClasses::Sentry, "captureUserFeedback", "(Lio/sentry/UserFeedback;)V", userFeedbackAndroid->GetJObject()); } -void SentrySubsystemAndroid::SetUser(USentryUser* user) +void SentrySubsystemAndroid::SetUser(TSharedPtr user) { - TSharedPtr userAndroid = StaticCastSharedPtr(user->GetNativeImpl()); + TSharedPtr userAndroid = StaticCastSharedPtr(user); FSentryJavaObjectWrapper::CallStaticMethod(SentryJavaClasses::Sentry, "setUser", "(Lio/sentry/protocol/User;)V", userAndroid->GetJObject()); @@ -219,13 +215,11 @@ void SentrySubsystemAndroid::RemoveUser() FSentryJavaObjectWrapper::CallStaticMethod(SentryJavaClasses::Sentry, "setUser", "(Lio/sentry/protocol/User;)V", nullptr); } -void SentrySubsystemAndroid::ConfigureScope(const FConfigureScopeNativeDelegate& onConfigureScope) +void SentrySubsystemAndroid::ConfigureScope(const FSentryScopeDelegate& onConfigureScope) { - USentryScopeCallbackAndroid* scopeCallback = NewObject(); - scopeCallback->BindDelegate(onConfigureScope); + int64 scopeCallbackId = SentryScopeCallbackAndroid::SaveDelegate(onConfigureScope); - FSentryJavaObjectWrapper::CallStaticMethod(SentryJavaClasses::SentryBridgeJava, "configureScope", "(J)V", - (jlong)scopeCallback); + FSentryJavaObjectWrapper::CallStaticMethod(SentryJavaClasses::SentryBridgeJava, "configureScope", "(J)V", scopeCallbackId); } void SentrySubsystemAndroid::SetContext(const FString& key, const TMap& values) @@ -262,27 +256,27 @@ void SentrySubsystemAndroid::EndSession() FSentryJavaObjectWrapper::CallStaticMethod(SentryJavaClasses::SentryBridgeJava, "endSession", "()V", nullptr); } -USentryTransaction* SentrySubsystemAndroid::StartTransaction(const FString& name, const FString& operation) +TSharedPtr SentrySubsystemAndroid::StartTransaction(const FString& name, const FString& operation) { auto transaction = FSentryJavaObjectWrapper::CallStaticObjectMethod(SentryJavaClasses::Sentry, "startTransaction", "(Ljava/lang/String;Ljava/lang/String;)Lio/sentry/ITransaction;", *FSentryJavaObjectWrapper::GetJString(name), *FSentryJavaObjectWrapper::GetJString(operation)); - return SentryConvertorsAndroid::SentryTransactionToUnreal(*transaction); + return MakeShareable(new SentryTransactionAndroid(*transaction)); } -USentryTransaction* SentrySubsystemAndroid::StartTransactionWithContext(USentryTransactionContext* context) +TSharedPtr SentrySubsystemAndroid::StartTransactionWithContext(TSharedPtr context) { - TSharedPtr transactionContextAndroid = StaticCastSharedPtr(context->GetNativeImpl()); + TSharedPtr transactionContextAndroid = StaticCastSharedPtr(context); auto transaction = FSentryJavaObjectWrapper::CallStaticObjectMethod(SentryJavaClasses::Sentry, "startTransaction", "(Lio/sentry/TransactionContext;)Lio/sentry/ITransaction;", transactionContextAndroid->GetJObject()); - return SentryConvertorsAndroid::SentryTransactionToUnreal(*transaction); + return MakeShareable(new SentryTransactionAndroid(*transaction)); } -USentryTransaction* SentrySubsystemAndroid::StartTransactionWithContextAndOptions(USentryTransactionContext* context, const TMap& options) +TSharedPtr SentrySubsystemAndroid::StartTransactionWithContextAndOptions(TSharedPtr context, const TMap& options) { - TSharedPtr transactionContextAndroid = StaticCastSharedPtr(context->GetNativeImpl()); + TSharedPtr transactionContextAndroid = StaticCastSharedPtr(context); TSharedPtr transactionOptionsAndroid = MakeShareable(new SentryTransactionOptionsAndroid()); transactionOptionsAndroid->SetCustomSamplingContext(options); @@ -290,13 +284,13 @@ USentryTransaction* SentrySubsystemAndroid::StartTransactionWithContextAndOption auto transaction = FSentryJavaObjectWrapper::CallStaticObjectMethod(SentryJavaClasses::Sentry, "startTransaction", "(Lio/sentry/TransactionContext;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction;", transactionContextAndroid->GetJObject(), transactionOptionsAndroid->GetJObject()); - return SentryConvertorsAndroid::SentryTransactionToUnreal(*transaction); + return MakeShareable(new SentryTransactionAndroid(*transaction)); } -USentryTransactionContext* SentrySubsystemAndroid::ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) +TSharedPtr SentrySubsystemAndroid::ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) { auto transactionContext = FSentryJavaObjectWrapper::CallStaticObjectMethod(SentryJavaClasses::Sentry, "continueTrace", "(Ljava/lang/String;Ljava/util/List;)Lio/sentry/TransactionContext;", *FSentryJavaObjectWrapper::GetJString(sentryTrace), SentryConvertorsAndroid::StringArrayToNative(baggageHeaders)->GetJObject()); - return SentryConvertorsAndroid::SentryTransactionContextToUnreal(*transactionContext); + return MakeShareable(new SentryTransactionContextAndroid(*transactionContext)); } diff --git a/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.h b/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.h index 3c3f1d51..f2ea9773 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.h +++ b/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.h @@ -11,28 +11,28 @@ class SentrySubsystemAndroid : public ISentrySubsystem virtual void Close() override; virtual bool IsEnabled() override; virtual ESentryCrashedLastRun IsCrashedLastRun() override; - virtual void AddBreadcrumb(USentryBreadcrumb* breadcrumb) override; + virtual void AddBreadcrumb(TSharedPtr breadcrumb) override; virtual void AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap& Data, ESentryLevel Level) override; virtual void ClearBreadcrumbs() override; - virtual USentryId* CaptureMessage(const FString& message, ESentryLevel level) override; - virtual USentryId* CaptureMessageWithScope(const FString& message, const FConfigureScopeNativeDelegate& onConfigureScope, ESentryLevel level) override; - virtual USentryId* CaptureEvent(USentryEvent* event) override; - virtual USentryId* CaptureEventWithScope(USentryEvent* event, const FConfigureScopeNativeDelegate& onConfigureScope) override; - virtual USentryId* CaptureException(const FString& type, const FString& message, int32 framesToSkip) override; - virtual USentryId* CaptureAssertion(const FString& type, const FString& message) override; - virtual USentryId* CaptureEnsure(const FString& type, const FString& message) override; - virtual void CaptureUserFeedback(USentryUserFeedback* userFeedback) override; - virtual void SetUser(USentryUser* user) override; + virtual TSharedPtr CaptureMessage(const FString& message, ESentryLevel level) override; + virtual TSharedPtr CaptureMessageWithScope(const FString& message, const FSentryScopeDelegate& onConfigureScope, ESentryLevel level) override; + virtual TSharedPtr CaptureEvent(TSharedPtr event) override; + virtual TSharedPtr CaptureEventWithScope(TSharedPtr event, const FSentryScopeDelegate& onConfigureScope) override; + virtual TSharedPtr CaptureException(const FString& type, const FString& message, int32 framesToSkip) override; + virtual TSharedPtr CaptureAssertion(const FString& type, const FString& message) override; + virtual TSharedPtr CaptureEnsure(const FString& type, const FString& message) override; + virtual void CaptureUserFeedback(TSharedPtr userFeedback) override; + virtual void SetUser(TSharedPtr user) override; virtual void RemoveUser() override; - virtual void ConfigureScope(const FConfigureScopeNativeDelegate& onConfigureScope) override; + virtual void ConfigureScope(const FSentryScopeDelegate& onConfigureScope) override; virtual void SetContext(const FString& key, const TMap& values) override; virtual void SetTag(const FString& key, const FString& value) override; virtual void RemoveTag(const FString& key) override; virtual void SetLevel(ESentryLevel level) override; virtual void StartSession() override; virtual void EndSession() override; - virtual USentryTransaction* StartTransaction(const FString& name, const FString& operation) override; - virtual USentryTransaction* StartTransactionWithContext(USentryTransactionContext* context) override; - virtual USentryTransaction* StartTransactionWithContextAndOptions(USentryTransactionContext* context, const TMap& options) override; - virtual USentryTransactionContext* ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) override; + virtual TSharedPtr StartTransaction(const FString& name, const FString& operation) override; + virtual TSharedPtr StartTransactionWithContext(TSharedPtr context) override; + virtual TSharedPtr StartTransactionWithContextAndOptions(TSharedPtr context, const TMap& options) override; + virtual TSharedPtr ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) override; }; diff --git a/plugin-dev/Source/Sentry/Private/Android/SentryTransactionAndroid.cpp b/plugin-dev/Source/Sentry/Private/Android/SentryTransactionAndroid.cpp index ca82510a..f3323b58 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentryTransactionAndroid.cpp +++ b/plugin-dev/Source/Sentry/Private/Android/SentryTransactionAndroid.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2023 Sentry. All Rights Reserved. #include "SentryTransactionAndroid.h" +#include "SentrySpanAndroid.h" #include "Infrastructure/SentryConvertorsAndroid.h" #include "Infrastructure/SentryJavaClasses.h" @@ -22,10 +23,10 @@ void SentryTransactionAndroid::SetupClassMethods() ToSentryTraceMethod = GetMethod("toSentryTrace", "()Lio/sentry/SentryTraceHeader;"); } -USentrySpan* SentryTransactionAndroid::StartChild(const FString& operation, const FString& desctiption) +TSharedPtr SentryTransactionAndroid::StartChild(const FString& operation, const FString& desctiption) { auto span = CallObjectMethod(StartChildMethod, *GetJString(operation), *GetJString(desctiption)); - return SentryConvertorsAndroid::SentrySpanToUnreal(*span); + return MakeShareable(new SentrySpanAndroid(*span)); } void SentryTransactionAndroid::Finish() diff --git a/plugin-dev/Source/Sentry/Private/Android/SentryTransactionAndroid.h b/plugin-dev/Source/Sentry/Private/Android/SentryTransactionAndroid.h index 9f114e9f..284651b0 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentryTransactionAndroid.h +++ b/plugin-dev/Source/Sentry/Private/Android/SentryTransactionAndroid.h @@ -13,7 +13,7 @@ class SentryTransactionAndroid : public ISentryTransaction, public FSentryJavaOb void SetupClassMethods(); - virtual USentrySpan* StartChild(const FString& operation, const FString& desctiption) override; + virtual TSharedPtr StartChild(const FString& operation, const FString& desctiption) override; virtual void Finish() override; virtual bool IsFinished() const override; virtual void SetName(const FString& name) override; diff --git a/plugin-dev/Source/Sentry/Private/Android/SentryUserFeedbackAndroid.cpp b/plugin-dev/Source/Sentry/Private/Android/SentryUserFeedbackAndroid.cpp index 638954d3..9d5c4219 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentryUserFeedbackAndroid.cpp +++ b/plugin-dev/Source/Sentry/Private/Android/SentryUserFeedbackAndroid.cpp @@ -2,14 +2,13 @@ #include "SentryUserFeedbackAndroid.h" -#include "SentryId.h" #include "SentryIdAndroid.h" #include "Infrastructure/SentryJavaClasses.h" -SentryUserFeedbackAndroid::SentryUserFeedbackAndroid(USentryId* eventId) +SentryUserFeedbackAndroid::SentryUserFeedbackAndroid(TSharedPtr eventId) : FSentryJavaObjectWrapper(SentryJavaClasses::UserFeedback, "(Lio/sentry/protocol/SentryId;)V", - StaticCastSharedPtr(eventId->GetNativeImpl())->GetJObject()) + StaticCastSharedPtr(eventId)->GetJObject()) { SetupClassMethods(); } diff --git a/plugin-dev/Source/Sentry/Private/Android/SentryUserFeedbackAndroid.h b/plugin-dev/Source/Sentry/Private/Android/SentryUserFeedbackAndroid.h index bf72bf6c..93615f78 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentryUserFeedbackAndroid.h +++ b/plugin-dev/Source/Sentry/Private/Android/SentryUserFeedbackAndroid.h @@ -6,12 +6,12 @@ #include "Infrastructure/SentryJavaObjectWrapper.h" -class USentryId; +class ISentryId; class SentryUserFeedbackAndroid : public ISentryUserFeedback, public FSentryJavaObjectWrapper { public: - SentryUserFeedbackAndroid(USentryId* eventId); + SentryUserFeedbackAndroid(TSharedPtr eventId); void SetupClassMethods(); diff --git a/plugin-dev/Source/Sentry/Private/Apple/Infrastructure/SentryConvertorsApple.cpp b/plugin-dev/Source/Sentry/Private/Apple/Infrastructure/SentryConvertorsApple.cpp index 3a2f8034..e2404362 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/Infrastructure/SentryConvertorsApple.cpp +++ b/plugin-dev/Source/Sentry/Private/Apple/Infrastructure/SentryConvertorsApple.cpp @@ -2,18 +2,9 @@ #include "SentryConvertorsApple.h" -#include "SentryScope.h" -#include "SentryId.h" -#include "SentryTransaction.h" -#include "SentrySpan.h" #include "SentryDefines.h" -#include "SentryTransactionContext.h" -#include "Apple/SentryTransactionContextApple.h" #include "Apple/SentryScopeApple.h" -#include "Apple/SentryIdApple.h" -#include "Apple/SentryTransactionApple.h" -#include "Apple/SentrySpanApple.h" #include "Convenience/SentryMacro.h" @@ -158,46 +149,6 @@ TArray SentryConvertorsApple::ByteDataToUnreal(NSData* data) return ByteData; } -USentryScope* SentryConvertorsApple::SentryScopeToUnreal(SentryScope* scope) -{ - TSharedPtr scopeNativeImpl = MakeShareable(new SentryScopeApple(scope)); - USentryScope* unrealScope = NewObject(); - unrealScope->InitWithNativeImpl(scopeNativeImpl); - return unrealScope; -} - -USentryId* SentryConvertorsApple::SentryIdToUnreal(SentryId* id) -{ - TSharedPtr idNativeImpl = MakeShareable(new SentryIdApple(id)); - USentryId* unrealId = NewObject(); - unrealId->InitWithNativeImpl(idNativeImpl); - return unrealId; -} - -USentryTransaction* SentryConvertorsApple::SentryTransactionToUnreal(id transaction) -{ - TSharedPtr transactionNativeImpl = MakeShareable(new SentryTransactionApple(transaction)); - USentryTransaction* unrealTransaction = NewObject(); - unrealTransaction->InitWithNativeImpl(transactionNativeImpl); - return unrealTransaction; -} - -USentrySpan* SentryConvertorsApple::SentrySpanToUnreal(id span) -{ - TSharedPtr spanNativeImpl = MakeShareable(new SentrySpanApple(span)); - USentrySpan* unrealSpan = NewObject(); - unrealSpan->InitWithNativeImpl(spanNativeImpl); - return unrealSpan; -} - -USentryTransactionContext* SentryConvertorsApple::SentryTransactionContextToUnreal(SentryTransactionContext* transactionContext) -{ - TSharedPtr transactionContextNativeImpl = MakeShareable(new SentryTransactionContextApple(transactionContext)); - USentryTransactionContext* unrealTransactionContext = NewObject(); - unrealTransactionContext->InitWithNativeImpl(transactionContextNativeImpl); - return unrealTransactionContext; -} - SentryLevel SentryConvertorsApple::StringToSentryLevel(NSString* string) { SentryLevel nativeLevel = kSentryLevelDebug; diff --git a/plugin-dev/Source/Sentry/Private/Apple/Infrastructure/SentryConvertorsApple.h b/plugin-dev/Source/Sentry/Private/Apple/Infrastructure/SentryConvertorsApple.h index 4b20b697..36ffe29b 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/Infrastructure/SentryConvertorsApple.h +++ b/plugin-dev/Source/Sentry/Private/Apple/Infrastructure/SentryConvertorsApple.h @@ -8,12 +8,6 @@ #include "GenericPlatform/GenericPlatformStackWalk.h" -class USentryTransactionContext; -class USentryScope; -class USentryId; -class USentryTransaction; -class USentrySpan; - class SentryConvertorsApple { public: @@ -29,11 +23,6 @@ class SentryConvertorsApple static TMap StringMapToUnreal(NSDictionary* dict); static TArray StringArrayToUnreal(NSArray* array); static TArray ByteDataToUnreal(NSData* data); - static USentryScope* SentryScopeToUnreal(SentryScope* scope); - static USentryId* SentryIdToUnreal(SentryId* id); - static USentryTransaction* SentryTransactionToUnreal(id transaction); - static USentrySpan* SentrySpanToUnreal(id span); - static USentryTransactionContext* SentryTransactionContextToUnreal(SentryTransactionContext* transactionContext); /** Other conversions */ static SentryLevel StringToSentryLevel(NSString* string); diff --git a/plugin-dev/Source/Sentry/Private/Apple/SentrySamplingContextApple.cpp b/plugin-dev/Source/Sentry/Private/Apple/SentrySamplingContextApple.cpp index 6b24f826..e2d1abbe 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/SentrySamplingContextApple.cpp +++ b/plugin-dev/Source/Sentry/Private/Apple/SentrySamplingContextApple.cpp @@ -3,8 +3,6 @@ #include "SentrySamplingContextApple.h" #include "SentryTransactionContextApple.h" -#include "SentryTransactionContext.h" - #include "Infrastructure/SentryConvertorsApple.h" #include "Convenience/SentryInclude.h" @@ -20,9 +18,9 @@ SentrySamplingContextApple::~SentrySamplingContextApple() // Put custom destructor logic here if needed } -USentryTransactionContext* SentrySamplingContextApple::GetTransactionContext() const +TSharedPtr SentrySamplingContextApple::GetTransactionContext() const { - return SentryConvertorsApple::SentryTransactionContextToUnreal(SamplingContext.transactionContext); + return MakeShareable(new SentryTransactionContextApple(SamplingContext.transactionContext)); } TMap SentrySamplingContextApple::GetCustomSamplingContext() const diff --git a/plugin-dev/Source/Sentry/Private/Apple/SentrySamplingContextApple.h b/plugin-dev/Source/Sentry/Private/Apple/SentrySamplingContextApple.h index 2a911ac0..f799d90f 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/SentrySamplingContextApple.h +++ b/plugin-dev/Source/Sentry/Private/Apple/SentrySamplingContextApple.h @@ -12,7 +12,7 @@ class SentrySamplingContextApple : public ISentrySamplingContext SentrySamplingContextApple(SentrySamplingContext* context); virtual ~SentrySamplingContextApple() override; - virtual USentryTransactionContext* GetTransactionContext() const override; + virtual TSharedPtr GetTransactionContext() const override; virtual TMap GetCustomSamplingContext() const override; SentrySamplingContext* GetNativeObject(); diff --git a/plugin-dev/Source/Sentry/Private/Apple/SentryScopeApple.cpp b/plugin-dev/Source/Sentry/Private/Apple/SentryScopeApple.cpp index ac67b16a..b3d8dda6 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/SentryScopeApple.cpp +++ b/plugin-dev/Source/Sentry/Private/Apple/SentryScopeApple.cpp @@ -5,9 +5,6 @@ #include "SentryBreadcrumbApple.h" #include "SentryAttachmentApple.h" -#include "SentryBreadcrumb.h" -#include "SentryAttachment.h" - #include "Infrastructure/SentryConvertorsApple.h" #include "Convenience/SentryInclude.h" @@ -33,9 +30,9 @@ SentryScope* SentryScopeApple::GetNativeObject() return ScopeApple; } -void SentryScopeApple::AddBreadcrumb(USentryBreadcrumb* breadcrumb) +void SentryScopeApple::AddBreadcrumb(TSharedPtr breadcrumb) { - TSharedPtr breadcrumbIOS = StaticCastSharedPtr(breadcrumb->GetNativeImpl()); + TSharedPtr breadcrumbIOS = StaticCastSharedPtr(breadcrumb); [ScopeApple addBreadcrumb:breadcrumbIOS->GetNativeObject()]; } @@ -45,9 +42,9 @@ void SentryScopeApple::ClearBreadcrumbs() [ScopeApple clearBreadcrumbs]; } -void SentryScopeApple::AddAttachment(USentryAttachment* attachment) +void SentryScopeApple::AddAttachment(TSharedPtr attachment) { - TSharedPtr attachmentIOS = StaticCastSharedPtr(attachment->GetNativeImpl()); + TSharedPtr attachmentIOS = StaticCastSharedPtr(attachment); [ScopeApple addAttachment:attachmentIOS->GetNativeObject()]; } diff --git a/plugin-dev/Source/Sentry/Private/Apple/SentryScopeApple.h b/plugin-dev/Source/Sentry/Private/Apple/SentryScopeApple.h index e009bbb5..5c8b780c 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/SentryScopeApple.h +++ b/plugin-dev/Source/Sentry/Private/Apple/SentryScopeApple.h @@ -15,9 +15,9 @@ class SentryScopeApple : public ISentryScope SentryScope* GetNativeObject(); - virtual void AddBreadcrumb(USentryBreadcrumb* breadcrumb) override; + virtual void AddBreadcrumb(TSharedPtr breadcrumb) override; virtual void ClearBreadcrumbs() override; - virtual void AddAttachment(USentryAttachment* attachment) override; + virtual void AddAttachment(TSharedPtr attachment) override; virtual void ClearAttachments() override; virtual void SetTagValue(const FString& key, const FString& value) override; virtual FString GetTagValue(const FString& key) const override; diff --git a/plugin-dev/Source/Sentry/Private/Apple/SentrySpanApple.cpp b/plugin-dev/Source/Sentry/Private/Apple/SentrySpanApple.cpp index 24d086e6..ee513c8a 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/SentrySpanApple.cpp +++ b/plugin-dev/Source/Sentry/Private/Apple/SentrySpanApple.cpp @@ -12,11 +12,12 @@ SentrySpanApple::SentrySpanApple(id span) { SpanApple = span; + [SpanApple retain]; } SentrySpanApple::~SentrySpanApple() { - // Put custom destructor logic here if needed + [SpanApple release]; } id SentrySpanApple::GetNativeObject() diff --git a/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.cpp b/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.cpp index c7d04eee..a5c16653 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.cpp +++ b/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.cpp @@ -8,21 +8,16 @@ #include "SentryUserApple.h" #include "SentryUserFeedbackApple.h" #include "SentryTransactionApple.h" -#include "SentrySamplingContextApple.h" #include "SentryTransactionContextApple.h" +#include "SentrySamplingContextApple.h" +#include "SentryIdApple.h" #include "SentryEvent.h" -#include "SentryBreadcrumb.h" -#include "SentryId.h" #include "SentrySettings.h" -#include "SentryUserFeedback.h" -#include "SentryUser.h" -#include "SentryTransaction.h" #include "SentryBeforeSendHandler.h" #include "SentryDefines.h" #include "SentrySamplingContext.h" #include "SentryTraceSampler.h" -#include "SentryTransactionContext.h" #include "Infrastructure/SentryConvertorsApple.h" @@ -119,9 +114,9 @@ ESentryCrashedLastRun SentrySubsystemApple::IsCrashedLastRun() return [SENTRY_APPLE_CLASS(SentrySDK) crashedLastRun] ? ESentryCrashedLastRun::Crashed : ESentryCrashedLastRun::NotCrashed; } -void SentrySubsystemApple::AddBreadcrumb(USentryBreadcrumb* breadcrumb) +void SentrySubsystemApple::AddBreadcrumb(TSharedPtr breadcrumb) { - TSharedPtr breadcrumbIOS = StaticCastSharedPtr(breadcrumb->GetNativeImpl()); + TSharedPtr breadcrumbIOS = StaticCastSharedPtr(breadcrumb); [SENTRY_APPLE_CLASS(SentrySDK) addBreadcrumb:breadcrumbIOS->GetNativeObject()]; } @@ -145,45 +140,45 @@ void SentrySubsystemApple::ClearBreadcrumbs() }]; } -USentryId* SentrySubsystemApple::CaptureMessage(const FString& message, ESentryLevel level) +TSharedPtr SentrySubsystemApple::CaptureMessage(const FString& message, ESentryLevel level) { SentryId* id = [SENTRY_APPLE_CLASS(SentrySDK) captureMessage:message.GetNSString() withScopeBlock:^(SentryScope* scope){ [scope setLevel:SentryConvertorsApple::SentryLevelToNative(level)]; }]; - return SentryConvertorsApple::SentryIdToUnreal(id); + return MakeShareable(new SentryIdApple(id)); } -USentryId* SentrySubsystemApple::CaptureMessageWithScope(const FString& message, const FConfigureScopeNativeDelegate& onConfigureScope, ESentryLevel level) +TSharedPtr SentrySubsystemApple::CaptureMessageWithScope(const FString& message, const FSentryScopeDelegate& onConfigureScope, ESentryLevel level) { SentryId* id = [SENTRY_APPLE_CLASS(SentrySDK) captureMessage:message.GetNSString() withScopeBlock:^(SentryScope* scope){ [scope setLevel:SentryConvertorsApple::SentryLevelToNative(level)]; - onConfigureScope.ExecuteIfBound(SentryConvertorsApple::SentryScopeToUnreal(scope)); + onConfigureScope.ExecuteIfBound(MakeShareable(new SentryScopeApple(scope))); }]; - return SentryConvertorsApple::SentryIdToUnreal(id); + return MakeShareable(new SentryIdApple(id)); } -USentryId* SentrySubsystemApple::CaptureEvent(USentryEvent* event) +TSharedPtr SentrySubsystemApple::CaptureEvent(TSharedPtr event) { - TSharedPtr eventIOS = StaticCastSharedPtr(event->GetNativeImpl()); + TSharedPtr eventIOS = StaticCastSharedPtr(event); SentryId* id = [SENTRY_APPLE_CLASS(SentrySDK) captureEvent:eventIOS->GetNativeObject()]; - return SentryConvertorsApple::SentryIdToUnreal(id); + return MakeShareable(new SentryIdApple(id)); } -USentryId* SentrySubsystemApple::CaptureEventWithScope(USentryEvent* event, const FConfigureScopeNativeDelegate& onConfigureScope) +TSharedPtr SentrySubsystemApple::CaptureEventWithScope(TSharedPtr event, const FSentryScopeDelegate& onConfigureScope) { - TSharedPtr eventIOS = StaticCastSharedPtr(event->GetNativeImpl()); + TSharedPtr eventIOS = StaticCastSharedPtr(event); SentryId* id = [SENTRY_APPLE_CLASS(SentrySDK) captureEvent:eventIOS->GetNativeObject() withScopeBlock:^(SentryScope* scope) { - onConfigureScope.ExecuteIfBound(SentryConvertorsApple::SentryScopeToUnreal(scope)); + onConfigureScope.ExecuteIfBound(MakeShareable(new SentryScopeApple(scope))); }]; - return SentryConvertorsApple::SentryIdToUnreal(id); + return MakeShareable(new SentryIdApple(id)); } -USentryId* SentrySubsystemApple::CaptureException(const FString& type, const FString& message, int32 framesToSkip) +TSharedPtr SentrySubsystemApple::CaptureException(const FString& type, const FString& message, int32 framesToSkip) { auto StackFrames = FGenericPlatformStackWalk::GetStack(framesToSkip); @@ -196,10 +191,10 @@ USentryId* SentrySubsystemApple::CaptureException(const FString& type, const FSt exceptionEvent.stacktrace = SentryConvertorsApple::CallstackToNative(StackFrames); SentryId* id = [SENTRY_APPLE_CLASS(SentrySDK) captureEvent:exceptionEvent]; - return SentryConvertorsApple::SentryIdToUnreal(id); + return MakeShareable(new SentryIdApple(id)); } -USentryId* SentrySubsystemApple::CaptureAssertion(const FString& type, const FString& message) +TSharedPtr SentrySubsystemApple::CaptureAssertion(const FString& type, const FString& message) { #if PLATFORM_MAC int32 framesToSkip = 6; @@ -212,7 +207,7 @@ USentryId* SentrySubsystemApple::CaptureAssertion(const FString& type, const FSt return CaptureException(type, message, framesToSkip); } -USentryId* SentrySubsystemApple::CaptureEnsure(const FString& type, const FString& message) +TSharedPtr SentrySubsystemApple::CaptureEnsure(const FString& type, const FString& message) { int32 framesToSkip = 6; @@ -221,16 +216,16 @@ USentryId* SentrySubsystemApple::CaptureEnsure(const FString& type, const FStrin return CaptureException(type, message, framesToSkip); } -void SentrySubsystemApple::CaptureUserFeedback(USentryUserFeedback* userFeedback) +void SentrySubsystemApple::CaptureUserFeedback(TSharedPtr userFeedback) { - TSharedPtr userFeedbackIOS = StaticCastSharedPtr(userFeedback->GetNativeImpl()); + TSharedPtr userFeedbackIOS = StaticCastSharedPtr(userFeedback); [SENTRY_APPLE_CLASS(SentrySDK) captureUserFeedback:userFeedbackIOS->GetNativeObject()]; } -void SentrySubsystemApple::SetUser(USentryUser* user) +void SentrySubsystemApple::SetUser(TSharedPtr user) { - TSharedPtr userIOS = StaticCastSharedPtr(user->GetNativeImpl()); + TSharedPtr userIOS = StaticCastSharedPtr(user); [SENTRY_APPLE_CLASS(SentrySDK) setUser:userIOS->GetNativeObject()]; } @@ -240,10 +235,10 @@ void SentrySubsystemApple::RemoveUser() [SENTRY_APPLE_CLASS(SentrySDK) setUser:nil]; } -void SentrySubsystemApple::ConfigureScope(const FConfigureScopeNativeDelegate& onConfigureScope) +void SentrySubsystemApple::ConfigureScope(const FSentryScopeDelegate& onConfigureScope) { [SENTRY_APPLE_CLASS(SentrySDK) configureScope:^(SentryScope* scope) { - onConfigureScope.ExecuteIfBound(SentryConvertorsApple::SentryScopeToUnreal(scope)); + onConfigureScope.ExecuteIfBound(MakeShareable(new SentryScopeApple(scope))); }]; } @@ -285,33 +280,33 @@ void SentrySubsystemApple::EndSession() [SENTRY_APPLE_CLASS(SentrySDK) endSession]; } -USentryTransaction* SentrySubsystemApple::StartTransaction(const FString& name, const FString& operation) +TSharedPtr SentrySubsystemApple::StartTransaction(const FString& name, const FString& operation) { id transaction = [SENTRY_APPLE_CLASS(SentrySDK) startTransactionWithName:name.GetNSString() operation:operation.GetNSString()]; - return SentryConvertorsApple::SentryTransactionToUnreal(transaction); + return MakeShareable(new SentryTransactionApple(transaction)); } -USentryTransaction* SentrySubsystemApple::StartTransactionWithContext(USentryTransactionContext* context) +TSharedPtr SentrySubsystemApple::StartTransactionWithContext(TSharedPtr context) { - TSharedPtr transactionContextIOS = StaticCastSharedPtr(context->GetNativeImpl()); + TSharedPtr transactionContextIOS = StaticCastSharedPtr(context); id transaction = [SENTRY_APPLE_CLASS(SentrySDK) startTransactionWithContext:transactionContextIOS->GetNativeObject()]; - return SentryConvertorsApple::SentryTransactionToUnreal(transaction); + return MakeShareable(new SentryTransactionApple(transaction)); } -USentryTransaction* SentrySubsystemApple::StartTransactionWithContextAndOptions(USentryTransactionContext* context, const TMap& options) +TSharedPtr SentrySubsystemApple::StartTransactionWithContextAndOptions(TSharedPtr context, const TMap& options) { - TSharedPtr transactionContextIOS = StaticCastSharedPtr(context->GetNativeImpl()); + TSharedPtr transactionContextIOS = StaticCastSharedPtr(context); id transaction = [SENTRY_APPLE_CLASS(SentrySDK) startTransactionWithContext:transactionContextIOS->GetNativeObject() customSamplingContext:SentryConvertorsApple::StringMapToNative(options)]; - return SentryConvertorsApple::SentryTransactionToUnreal(transaction); + return MakeShareable(new SentryTransactionApple(transaction)); } -USentryTransactionContext* SentrySubsystemApple::ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) +TSharedPtr SentrySubsystemApple::ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) { TArray traceParts; sentryTrace.ParseIntoArray(traceParts, TEXT("-")); @@ -343,5 +338,5 @@ USentryTransactionContext* SentrySubsystemApple::ContinueTrace(const FString& se // currently `sentry-cocoa` doesn't have API for `SentryTransactionContext` to set `baggageHeaders` - return SentryConvertorsApple::SentryTransactionContextToUnreal(transactionContext); + return MakeShareable(new SentryTransactionContextApple(transactionContext)); } diff --git a/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.h b/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.h index c858c277..c57a0c2c 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.h +++ b/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.h @@ -11,28 +11,28 @@ class SentrySubsystemApple : public ISentrySubsystem virtual void Close() override; virtual bool IsEnabled() override; virtual ESentryCrashedLastRun IsCrashedLastRun() override; - virtual void AddBreadcrumb(USentryBreadcrumb* breadcrumb) override; + virtual void AddBreadcrumb(TSharedPtr breadcrumb) override; virtual void AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap& Data, ESentryLevel Level) override; virtual void ClearBreadcrumbs() override; - virtual USentryId* CaptureMessage(const FString& message, ESentryLevel level) override; - virtual USentryId* CaptureMessageWithScope(const FString& message, const FConfigureScopeNativeDelegate& onConfigureScope, ESentryLevel level) override; - virtual USentryId* CaptureEvent(USentryEvent* event) override; - virtual USentryId* CaptureEventWithScope(USentryEvent* event, const FConfigureScopeNativeDelegate& onConfigureScope) override; - virtual USentryId* CaptureException(const FString& type, const FString& message, int32 framesToSkip) override; - virtual USentryId* CaptureAssertion(const FString& type, const FString& message) override; - virtual USentryId* CaptureEnsure(const FString& type, const FString& message) override; - virtual void CaptureUserFeedback(USentryUserFeedback* userFeedback) override; - virtual void SetUser(USentryUser* user) override; + virtual TSharedPtr CaptureMessage(const FString& message, ESentryLevel level) override; + virtual TSharedPtr CaptureMessageWithScope(const FString& message, const FSentryScopeDelegate& onConfigureScope, ESentryLevel level) override; + virtual TSharedPtr CaptureEvent(TSharedPtr event) override; + virtual TSharedPtr CaptureEventWithScope(TSharedPtr event, const FSentryScopeDelegate& onConfigureScope) override; + virtual TSharedPtr CaptureException(const FString& type, const FString& message, int32 framesToSkip) override; + virtual TSharedPtr CaptureAssertion(const FString& type, const FString& message) override; + virtual TSharedPtr CaptureEnsure(const FString& type, const FString& message) override; + virtual void CaptureUserFeedback(TSharedPtr userFeedback) override; + virtual void SetUser(TSharedPtr user) override; virtual void RemoveUser() override; - virtual void ConfigureScope(const FConfigureScopeNativeDelegate& onConfigureScope) override; + virtual void ConfigureScope(const FSentryScopeDelegate& onConfigureScope) override; virtual void SetContext(const FString& key, const TMap& values) override; virtual void SetTag(const FString& key, const FString& value) override; virtual void RemoveTag(const FString& key) override; virtual void SetLevel(ESentryLevel level) override; virtual void StartSession() override; virtual void EndSession() override; - virtual USentryTransaction* StartTransaction(const FString& name, const FString& operation) override; - virtual USentryTransaction* StartTransactionWithContext(USentryTransactionContext* context) override; - virtual USentryTransaction* StartTransactionWithContextAndOptions(USentryTransactionContext* context, const TMap& options) override; - virtual USentryTransactionContext* ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) override; + virtual TSharedPtr StartTransaction(const FString& name, const FString& operation) override; + virtual TSharedPtr StartTransactionWithContext(TSharedPtr context) override; + virtual TSharedPtr StartTransactionWithContextAndOptions(TSharedPtr context, const TMap& options) override; + virtual TSharedPtr ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) override; }; diff --git a/plugin-dev/Source/Sentry/Private/Apple/SentryTransactionApple.cpp b/plugin-dev/Source/Sentry/Private/Apple/SentryTransactionApple.cpp index 9245ce7b..46770df0 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/SentryTransactionApple.cpp +++ b/plugin-dev/Source/Sentry/Private/Apple/SentryTransactionApple.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2023 Sentry. All Rights Reserved. #include "SentryTransactionApple.h" +#include "SentrySpanApple.h" #include "Infrastructure/SentryConvertorsApple.h" @@ -12,11 +13,12 @@ SentryTransactionApple::SentryTransactionApple(id transaction) { TransactionApple = transaction; + [TransactionApple retain]; } SentryTransactionApple::~SentryTransactionApple() { - // Put custom destructor logic here if needed + [TransactionApple release]; } id SentryTransactionApple::GetNativeObject() @@ -24,10 +26,10 @@ id SentryTransactionApple::GetNativeObject() return TransactionApple; } -USentrySpan* SentryTransactionApple::StartChild(const FString& operation, const FString& desctiption) +TSharedPtr SentryTransactionApple::StartChild(const FString& operation, const FString& desctiption) { id span = [TransactionApple startChildWithOperation:operation.GetNSString() description:desctiption.GetNSString()]; - return SentryConvertorsApple::SentrySpanToUnreal(span); + return MakeShareable(new SentrySpanApple(span)); } void SentryTransactionApple::Finish() diff --git a/plugin-dev/Source/Sentry/Private/Apple/SentryTransactionApple.h b/plugin-dev/Source/Sentry/Private/Apple/SentryTransactionApple.h index 844f5292..74d3aacc 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/SentryTransactionApple.h +++ b/plugin-dev/Source/Sentry/Private/Apple/SentryTransactionApple.h @@ -14,7 +14,7 @@ class SentryTransactionApple : public ISentryTransaction id GetNativeObject(); - virtual USentrySpan* StartChild(const FString& operation, const FString& desctiption) override; + virtual TSharedPtr StartChild(const FString& operation, const FString& desctiption) override; virtual void Finish() override; virtual bool IsFinished() const override; virtual void SetName(const FString& name) override; diff --git a/plugin-dev/Source/Sentry/Private/Apple/SentryUserFeedbackApple.cpp b/plugin-dev/Source/Sentry/Private/Apple/SentryUserFeedbackApple.cpp index 23a627ec..5a606b57 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/SentryUserFeedbackApple.cpp +++ b/plugin-dev/Source/Sentry/Private/Apple/SentryUserFeedbackApple.cpp @@ -2,15 +2,14 @@ #include "SentryUserFeedbackApple.h" -#include "SentryId.h" #include "SentryIdApple.h" #include "Convenience/SentryInclude.h" #include "Convenience/SentryMacro.h" -SentryUserFeedbackApple::SentryUserFeedbackApple(USentryId* eventId) +SentryUserFeedbackApple::SentryUserFeedbackApple(TSharedPtr eventId) { - TSharedPtr idIOS = StaticCastSharedPtr(eventId->GetNativeImpl()); + TSharedPtr idIOS = StaticCastSharedPtr(eventId); SentryId* id = idIOS->GetNativeObject(); UserFeedbackApple = [[SENTRY_APPLE_CLASS(SentryUserFeedback) alloc] initWithEventId:id]; } diff --git a/plugin-dev/Source/Sentry/Private/Apple/SentryUserFeedbackApple.h b/plugin-dev/Source/Sentry/Private/Apple/SentryUserFeedbackApple.h index da5404da..96d7ad9b 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/SentryUserFeedbackApple.h +++ b/plugin-dev/Source/Sentry/Private/Apple/SentryUserFeedbackApple.h @@ -4,13 +4,14 @@ #include "Interface/SentryUserFeedbackInterface.h" -class USentryId; +class ISentryId; + @class SentryUserFeedback; class SentryUserFeedbackApple : public ISentryUserFeedback { public: - SentryUserFeedbackApple(USentryId* eventId); + SentryUserFeedbackApple(TSharedPtr eventId); virtual ~SentryUserFeedbackApple() override; SentryUserFeedback* GetNativeObject(); diff --git a/plugin-dev/Source/Sentry/Private/Desktop/CrashReporter/SentryCrashReporter.cpp b/plugin-dev/Source/Sentry/Private/Desktop/CrashReporter/SentryCrashReporter.cpp index d471e603..d2fccd1f 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/CrashReporter/SentryCrashReporter.cpp +++ b/plugin-dev/Source/Sentry/Private/Desktop/CrashReporter/SentryCrashReporter.cpp @@ -3,7 +3,8 @@ #include "SentryCrashReporter.h" #include "SentryCrashContext.h" -#include "SentryUser.h" +#include "Desktop/SentryUserDesktop.h" + #include "SentryDefines.h" #include "Dom/JsonObject.h" @@ -44,7 +45,7 @@ void SentryCrashReporter::SetEnvironment(const FString& environment) UpdateCrashReporterConfig(); } -void SentryCrashReporter::SetUser(USentryUser* user) +void SentryCrashReporter::SetUser(TSharedPtr user) { TSharedPtr userConfig = MakeShareable(new FJsonObject); userConfig->SetStringField(TEXT("email"), user->GetEmail()); diff --git a/plugin-dev/Source/Sentry/Private/Desktop/CrashReporter/SentryCrashReporter.h b/plugin-dev/Source/Sentry/Private/Desktop/CrashReporter/SentryCrashReporter.h index bbccf93b..e68c5ea0 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/CrashReporter/SentryCrashReporter.h +++ b/plugin-dev/Source/Sentry/Private/Desktop/CrashReporter/SentryCrashReporter.h @@ -6,7 +6,8 @@ #if USE_SENTRY_NATIVE -class USentryUser; +class SentryUserDesktop; + class FJsonObject; class SentryCrashReporter @@ -16,7 +17,7 @@ class SentryCrashReporter void SetRelease(const FString& release); void SetEnvironment(const FString& environment); - void SetUser(USentryUser* user); + void SetUser(TSharedPtr user); void RemoveUser(); void SetContext(const FString& key, const TMap& values); void SetTag(const FString& key, const FString& value); diff --git a/plugin-dev/Source/Sentry/Private/Desktop/Infrastructure/SentryConvertorsDesktop.cpp b/plugin-dev/Source/Sentry/Private/Desktop/Infrastructure/SentryConvertorsDesktop.cpp index a615fc9f..59196383 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/Infrastructure/SentryConvertorsDesktop.cpp +++ b/plugin-dev/Source/Sentry/Private/Desktop/Infrastructure/SentryConvertorsDesktop.cpp @@ -1,15 +1,10 @@ // Copyright (c) 2022 Sentry. All Rights Reserved. #include "SentryConvertorsDesktop.h" -#include "SentryId.h" -#include "SentryTransaction.h" -#include "SentrySpan.h" -#include "SentryDefines.h" -#include "Desktop/SentryIdDesktop.h" -#include "Desktop/SentryTransactionDesktop.h" -#include "Desktop/SentrySpanDesktop.h" +#include "SentryDefines.h" +#include "UObject/Class.h" #include "UObject/Package.h" #include "UObject/UObjectGlobals.h" #include "Dom/JsonObject.h" @@ -142,30 +137,6 @@ ESentryLevel SentryConvertorsDesktop::SentryLevelToUnreal(sentry_level_t level) return Level; } -USentryId* SentryConvertorsDesktop::SentryIdToUnreal(sentry_uuid_t id) -{ - TSharedPtr idNativeImpl = MakeShareable(new SentryIdDesktop(id)); - USentryId* unrealId = NewObject(); - unrealId->InitWithNativeImpl(idNativeImpl); - return unrealId; -} - -USentryTransaction* SentryConvertorsDesktop::SentryTransactionToUnreal(sentry_transaction_t* transaction) -{ - TSharedPtr transactionNativeImpl = MakeShareable(new SentryTransactionDesktop(transaction)); - USentryTransaction* unrealTransaction = NewObject(); - unrealTransaction->InitWithNativeImpl(transactionNativeImpl); - return unrealTransaction; -} - -USentrySpan* SentryConvertorsDesktop::SentrySpanToUnreal(sentry_span_t* span) -{ - TSharedPtr spanNativeImpl = MakeShareable(new SentrySpanDesktop(span)); - USentrySpan* unrealSpan = NewObject(); - unrealSpan->InitWithNativeImpl(spanNativeImpl); - return unrealSpan; -} - TMap SentryConvertorsDesktop::StringMapToUnreal(sentry_value_t map) { TMap unrealMap; diff --git a/plugin-dev/Source/Sentry/Private/Desktop/Infrastructure/SentryConvertorsDesktop.h b/plugin-dev/Source/Sentry/Private/Desktop/Infrastructure/SentryConvertorsDesktop.h index a70a908e..726e90d0 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/Infrastructure/SentryConvertorsDesktop.h +++ b/plugin-dev/Source/Sentry/Private/Desktop/Infrastructure/SentryConvertorsDesktop.h @@ -10,10 +10,6 @@ #if USE_SENTRY_NATIVE -class USentryId; -class USentryTransaction; -class USentrySpan; - class SentryConvertorsDesktop { public: @@ -27,9 +23,6 @@ class SentryConvertorsDesktop /** Conversions from native desktop (Windows/Mac) types */ static ESentryLevel SentryLevelToUnreal(sentry_value_t level); static ESentryLevel SentryLevelToUnreal(sentry_level_t level); - static USentryId* SentryIdToUnreal(sentry_uuid_t id); - static USentryTransaction* SentryTransactionToUnreal(sentry_transaction_t* transaction); - static USentrySpan* SentrySpanToUnreal(sentry_span_t* span); static TMap StringMapToUnreal(sentry_value_t map); static TArray StringArrayToUnreal(sentry_value_t array); diff --git a/plugin-dev/Source/Sentry/Private/Desktop/SentryBreadcrumbDesktop.cpp b/plugin-dev/Source/Sentry/Private/Desktop/SentryBreadcrumbDesktop.cpp index 7173f2f4..b4ab6746 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/SentryBreadcrumbDesktop.cpp +++ b/plugin-dev/Source/Sentry/Private/Desktop/SentryBreadcrumbDesktop.cpp @@ -8,17 +8,17 @@ SentryBreadcrumbDesktop::SentryBreadcrumbDesktop() { - BreadcrumbDesktop = sentry_value_new_breadcrumb("", ""); + BreadcrumbDesktop = sentry_value_new_breadcrumb("", ""); } SentryBreadcrumbDesktop::SentryBreadcrumbDesktop(sentry_value_t breadcrumb) { - BreadcrumbDesktop = breadcrumb; + BreadcrumbDesktop = breadcrumb; } SentryBreadcrumbDesktop::~SentryBreadcrumbDesktop() { - // Put custom destructor logic here if needed + // Put custom destructor logic here if needed } sentry_value_t SentryBreadcrumbDesktop::GetNativeObject() @@ -61,12 +61,12 @@ FString SentryBreadcrumbDesktop::GetCategory() const void SentryBreadcrumbDesktop::SetData(const TMap& data) { - sentry_value_set_by_key(BreadcrumbDesktop, "data", SentryConvertorsDesktop::StringMapToNative(data)); + sentry_value_set_by_key(BreadcrumbDesktop, "data", SentryConvertorsDesktop::StringMapToNative(data)); } TMap SentryBreadcrumbDesktop::GetData() const { - sentry_value_t data = sentry_value_get_by_key(BreadcrumbDesktop, "data"); + sentry_value_t data = sentry_value_get_by_key(BreadcrumbDesktop, "data"); return SentryConvertorsDesktop::StringMapToUnreal(data); } diff --git a/plugin-dev/Source/Sentry/Private/Desktop/SentryScopeDesktop.cpp b/plugin-dev/Source/Sentry/Private/Desktop/SentryScopeDesktop.cpp index 2b4cc5d4..8f2408cb 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/SentryScopeDesktop.cpp +++ b/plugin-dev/Source/Sentry/Private/Desktop/SentryScopeDesktop.cpp @@ -4,9 +4,8 @@ #include "SentryBreadcrumbDesktop.h" #include "SentryEventDesktop.h" -#include "SentryBreadcrumb.h" -#include "SentryAttachment.h" -#include "SentryEvent.h" +#include "Interface/SentryAttachmentInterface.h" + #include "SentryModule.h" #include "SentrySettings.h" @@ -35,9 +34,16 @@ SentryScopeDesktop::~SentryScopeDesktop() { } -void SentryScopeDesktop::AddBreadcrumb(USentryBreadcrumb* breadcrumb) +void SentryScopeDesktop::AddBreadcrumb(TSharedPtr breadcrumb) { - AddBreadcrumb(StaticCastSharedPtr(breadcrumb->GetNativeImpl())); + FScopeLock Lock(&CriticalSection); + + if(BreadcrumbsDesktop.Num() >= FSentryModule::Get().GetSettings()->MaxBreadcrumbs) + { + BreadcrumbsDesktop.PopFront(); + } + + BreadcrumbsDesktop.Add(StaticCastSharedPtr(breadcrumb)); } void SentryScopeDesktop::ClearBreadcrumbs() @@ -47,7 +53,7 @@ void SentryScopeDesktop::ClearBreadcrumbs() BreadcrumbsDesktop.Empty(); } -void SentryScopeDesktop::AddAttachment(USentryAttachment* attachment) +void SentryScopeDesktop::AddAttachment(TSharedPtr attachment) { // Not available for desktop } @@ -293,16 +299,4 @@ void SentryScopeDesktop::Apply(TSharedPtr event) } } -void SentryScopeDesktop::AddBreadcrumb(TSharedPtr breadcrumb) -{ - FScopeLock Lock(&CriticalSection); - - if(BreadcrumbsDesktop.Num() >= FSentryModule::Get().GetSettings()->MaxBreadcrumbs) - { - BreadcrumbsDesktop.PopFront(); - } - - BreadcrumbsDesktop.Add(breadcrumb); -} - #endif diff --git a/plugin-dev/Source/Sentry/Private/Desktop/SentryScopeDesktop.h b/plugin-dev/Source/Sentry/Private/Desktop/SentryScopeDesktop.h index 24994c2e..1769ebf4 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/SentryScopeDesktop.h +++ b/plugin-dev/Source/Sentry/Private/Desktop/SentryScopeDesktop.h @@ -9,10 +9,6 @@ #if USE_SENTRY_NATIVE -class USentryEvent; -class USentryBreadcrumb; -class USentryAttachment; - class SentryBreadcrumbDesktop; class SentryEventDesktop; @@ -23,9 +19,9 @@ class SentryScopeDesktop : public ISentryScope SentryScopeDesktop(const SentryScopeDesktop& Scope); virtual ~SentryScopeDesktop() override; - virtual void AddBreadcrumb(USentryBreadcrumb* breadcrumb) override; + virtual void AddBreadcrumb(TSharedPtr breadcrumb) override; virtual void ClearBreadcrumbs() override; - virtual void AddAttachment(USentryAttachment* attachment) override; + virtual void AddAttachment(TSharedPtr attachment) override; virtual void ClearAttachments() override; virtual void SetTagValue(const FString& key, const FString& value) override; virtual FString GetTagValue(const FString& key) const override; @@ -50,7 +46,6 @@ class SentryScopeDesktop : public ISentryScope virtual void Clear() override; void Apply(TSharedPtr event); - void AddBreadcrumb(TSharedPtr breadcrumb); private: FString Dist; diff --git a/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.cpp b/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.cpp index a461d070..37367d21 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.cpp +++ b/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.cpp @@ -4,22 +4,19 @@ #include "SentryEventDesktop.h" #include "SentryBreadcrumbDesktop.h" #include "SentryUserDesktop.h" +#include "SentryUserFeedbackDesktop.h" #include "SentryScopeDesktop.h" #include "SentryTransactionDesktop.h" #include "SentryTransactionContextDesktop.h" +#include "SentryIdDesktop.h" #include "SentryDefines.h" #include "SentrySettings.h" #include "SentryEvent.h" -#include "SentryBreadcrumb.h" -#include "SentryUserFeedback.h" -#include "SentryUser.h" -#include "SentryTransaction.h" #include "SentryModule.h" #include "SentryBeforeSendHandler.h" + #include "SentryTraceSampler.h" -#include "SentryTransactionContext.h" -#include "SentryUserFeedbackDesktop.h" #include "Utils/SentryLogUtils.h" #include "Utils/SentryScreenshotUtils.h" @@ -332,7 +329,7 @@ ESentryCrashedLastRun SentrySubsystemDesktop::IsCrashedLastRun() return unrealIsCrashed; } -void SentrySubsystemDesktop::AddBreadcrumb(USentryBreadcrumb* breadcrumb) +void SentrySubsystemDesktop::AddBreadcrumb(TSharedPtr breadcrumb) { GetCurrentScope()->AddBreadcrumb(breadcrumb); } @@ -354,7 +351,7 @@ void SentrySubsystemDesktop::ClearBreadcrumbs() GetCurrentScope()->ClearBreadcrumbs(); } -USentryId* SentrySubsystemDesktop::CaptureMessage(const FString& message, ESentryLevel level) +TSharedPtr SentrySubsystemDesktop::CaptureMessage(const FString& message, ESentryLevel level) { sentry_value_t sentryEvent = sentry_value_new_message_event(SentryConvertorsDesktop::SentryLevelToNative(level), nullptr, TCHAR_TO_UTF8(*message)); @@ -364,30 +361,27 @@ USentryId* SentrySubsystemDesktop::CaptureMessage(const FString& message, ESentr } sentry_uuid_t id = sentry_capture_event(sentryEvent); - return SentryConvertorsDesktop::SentryIdToUnreal(id); + return MakeShareable(new SentryIdDesktop(id)); } -USentryId* SentrySubsystemDesktop::CaptureMessageWithScope(const FString& message, const FConfigureScopeNativeDelegate& onScopeConfigure, ESentryLevel level) +TSharedPtr SentrySubsystemDesktop::CaptureMessageWithScope(const FString& message, const FSentryScopeDelegate& onScopeConfigure, ESentryLevel level) { FScopeLock Lock(&CriticalSection); TSharedPtr NewLocalScope = MakeShareable(new SentryScopeDesktop(*GetCurrentScope())); - USentryScope* Scope = NewObject(); - Scope->InitWithNativeImpl(NewLocalScope); - - onScopeConfigure.ExecuteIfBound(Scope); + onScopeConfigure.ExecuteIfBound(NewLocalScope); scopeStack.Push(NewLocalScope); - USentryId* Id = CaptureMessage(message, level); + TSharedPtr Id = CaptureMessage(message, level); scopeStack.Pop(); return Id; } -USentryId* SentrySubsystemDesktop::CaptureEvent(USentryEvent* event) +TSharedPtr SentrySubsystemDesktop::CaptureEvent(TSharedPtr event) { - TSharedPtr eventDesktop = StaticCastSharedPtr(event->GetNativeImpl()); + TSharedPtr eventDesktop = StaticCastSharedPtr(event); sentry_value_t nativeEvent = eventDesktop->GetNativeObject(); @@ -397,28 +391,25 @@ USentryId* SentrySubsystemDesktop::CaptureEvent(USentryEvent* event) } sentry_uuid_t id = sentry_capture_event(nativeEvent); - return SentryConvertorsDesktop::SentryIdToUnreal(id); + return MakeShareable(new SentryIdDesktop(id)); } -USentryId* SentrySubsystemDesktop::CaptureEventWithScope(USentryEvent* event, const FConfigureScopeNativeDelegate& onScopeConfigure) +TSharedPtr SentrySubsystemDesktop::CaptureEventWithScope(TSharedPtr event, const FSentryScopeDelegate& onScopeConfigure) { FScopeLock Lock(&CriticalSection); TSharedPtr NewLocalScope = MakeShareable(new SentryScopeDesktop(*GetCurrentScope())); - USentryScope* Scope = NewObject(); - Scope->InitWithNativeImpl(NewLocalScope); - - onScopeConfigure.ExecuteIfBound(Scope); + onScopeConfigure.ExecuteIfBound(NewLocalScope); scopeStack.Push(NewLocalScope); - USentryId* Id = CaptureEvent(event); + TSharedPtr Id = CaptureEvent(event); scopeStack.Pop(); return Id; } -USentryId* SentrySubsystemDesktop::CaptureException(const FString& type, const FString& message, int32 framesToSkip) +TSharedPtr SentrySubsystemDesktop::CaptureException(const FString& type, const FString& message, int32 framesToSkip) { sentry_value_t exceptionEvent = sentry_value_new_event(); @@ -429,10 +420,10 @@ USentryId* SentrySubsystemDesktop::CaptureException(const FString& type, const F sentry_event_add_exception(exceptionEvent, nativeException); sentry_uuid_t id = sentry_capture_event(exceptionEvent); - return SentryConvertorsDesktop::SentryIdToUnreal(id); + return MakeShareable(new SentryIdDesktop(id)); } -USentryId* SentrySubsystemDesktop::CaptureAssertion(const FString& type, const FString& message) +TSharedPtr SentrySubsystemDesktop::CaptureAssertion(const FString& type, const FString& message) { #if PLATFORM_WINDOWS int32 framesToSkip = 7; @@ -445,7 +436,7 @@ USentryId* SentrySubsystemDesktop::CaptureAssertion(const FString& type, const F return CaptureException(type, message, framesToSkip); } -USentryId* SentrySubsystemDesktop::CaptureEnsure(const FString& type, const FString& message) +TSharedPtr SentrySubsystemDesktop::CaptureEnsure(const FString& type, const FString& message) { #if PLATFORM_WINDOWS && ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 3 int32 framesToSkip = 8; @@ -455,18 +446,18 @@ USentryId* SentrySubsystemDesktop::CaptureEnsure(const FString& type, const FStr return CaptureException(type, message, framesToSkip); } -void SentrySubsystemDesktop::CaptureUserFeedback(USentryUserFeedback* userFeedback) +void SentrySubsystemDesktop::CaptureUserFeedback(TSharedPtr userFeedback) { - TSharedPtr userFeedbackDesktop = StaticCastSharedPtr(userFeedback->GetNativeImpl()); + TSharedPtr userFeedbackDesktop = StaticCastSharedPtr(userFeedback); sentry_capture_user_feedback(userFeedbackDesktop->GetNativeObject()); } -void SentrySubsystemDesktop::SetUser(USentryUser* user) +void SentrySubsystemDesktop::SetUser(TSharedPtr user) { - TSharedPtr userDesktop = StaticCastSharedPtr(user->GetNativeImpl()); + TSharedPtr userDesktop = StaticCastSharedPtr(user); sentry_set_user(userDesktop->GetNativeObject()); - crashReporter->SetUser(user); + crashReporter->SetUser(userDesktop); } void SentrySubsystemDesktop::RemoveUser() @@ -476,12 +467,9 @@ void SentrySubsystemDesktop::RemoveUser() crashReporter->RemoveUser(); } -void SentrySubsystemDesktop::ConfigureScope(const FConfigureScopeNativeDelegate& onConfigureScope) +void SentrySubsystemDesktop::ConfigureScope(const FSentryScopeDelegate& onConfigureScope) { - USentryScope* Scope = NewObject(); - Scope->InitWithNativeImpl(GetCurrentScope()); - - onConfigureScope.ExecuteIfBound(Scope); + onConfigureScope.ExecuteIfBound(GetCurrentScope()); } void SentrySubsystemDesktop::SetContext(const FString& key, const TMap& values) @@ -520,31 +508,31 @@ void SentrySubsystemDesktop::EndSession() sentry_end_session(); } -USentryTransaction* SentrySubsystemDesktop::StartTransaction(const FString& name, const FString& operation) +TSharedPtr SentrySubsystemDesktop::StartTransaction(const FString& name, const FString& operation) { sentry_transaction_context_t* transactionContext = sentry_transaction_context_new(TCHAR_TO_ANSI(*name), TCHAR_TO_ANSI(*operation)); sentry_transaction_t* nativeTransaction = sentry_transaction_start(transactionContext, sentry_value_new_null()); - return SentryConvertorsDesktop::SentryTransactionToUnreal(nativeTransaction); + return MakeShareable(new SentryTransactionDesktop(nativeTransaction)); } -USentryTransaction* SentrySubsystemDesktop::StartTransactionWithContext(USentryTransactionContext* context) +TSharedPtr SentrySubsystemDesktop::StartTransactionWithContext(TSharedPtr context) { - TSharedPtr transactionContextDesktop = StaticCastSharedPtr(context->GetNativeImpl()); + TSharedPtr transactionContextDesktop = StaticCastSharedPtr(context); sentry_transaction_t* nativeTransaction = sentry_transaction_start(transactionContextDesktop->GetNativeObject(), sentry_value_new_null()); - return SentryConvertorsDesktop::SentryTransactionToUnreal(nativeTransaction); + return MakeShareable(new SentryTransactionDesktop(nativeTransaction)); } -USentryTransaction* SentrySubsystemDesktop::StartTransactionWithContextAndOptions(USentryTransactionContext* context, const TMap& options) +TSharedPtr SentrySubsystemDesktop::StartTransactionWithContextAndOptions(TSharedPtr context, const TMap& options) { UE_LOG(LogSentrySdk, Log, TEXT("Transaction options currently not supported on desktop.")); return StartTransactionWithContext(context); } -USentryTransactionContext* SentrySubsystemDesktop::ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) +TSharedPtr SentrySubsystemDesktop::ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) { sentry_transaction_context_t* nativeTransactionContext = sentry_transaction_context_new("", "default"); sentry_transaction_context_update_from_header(nativeTransactionContext, "sentry-trace", TCHAR_TO_ANSI(*sentryTrace)); @@ -553,10 +541,7 @@ USentryTransactionContext* SentrySubsystemDesktop::ContinueTrace(const FString& TSharedPtr transactionContextDesktop = MakeShareable(new SentryTransactionContextDesktop(nativeTransactionContext)); - USentryTransactionContext* TransactionContext = NewObject(); - TransactionContext->InitWithNativeImpl(transactionContextDesktop); - - return TransactionContext; + return transactionContextDesktop; } USentryBeforeSendHandler* SentrySubsystemDesktop::GetBeforeSendHandler() diff --git a/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.h b/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.h index 51c6bbd4..d2269c99 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.h +++ b/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.h @@ -20,30 +20,30 @@ class SentrySubsystemDesktop : public ISentrySubsystem virtual void Close() override; virtual bool IsEnabled() override; virtual ESentryCrashedLastRun IsCrashedLastRun() override; - virtual void AddBreadcrumb(USentryBreadcrumb* breadcrumb) override; + virtual void AddBreadcrumb(TSharedPtr breadcrumb) override; virtual void AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap& Data, ESentryLevel Level) override; virtual void ClearBreadcrumbs() override; - virtual USentryId* CaptureMessage(const FString& message, ESentryLevel level) override; - virtual USentryId* CaptureMessageWithScope(const FString& message, const FConfigureScopeNativeDelegate& onScopeConfigure, ESentryLevel level) override; - virtual USentryId* CaptureEvent(USentryEvent* event) override; - virtual USentryId* CaptureEventWithScope(USentryEvent* event, const FConfigureScopeNativeDelegate& onScopeConfigure) override; - virtual USentryId* CaptureException(const FString& type, const FString& message, int32 framesToSkip) override; - virtual USentryId* CaptureAssertion(const FString& type, const FString& message) override; - virtual USentryId* CaptureEnsure(const FString& type, const FString& message) override; - virtual void CaptureUserFeedback(USentryUserFeedback* userFeedback) override; - virtual void SetUser(USentryUser* user) override; + virtual TSharedPtr CaptureMessage(const FString& message, ESentryLevel level) override; + virtual TSharedPtr CaptureMessageWithScope(const FString& message, const FSentryScopeDelegate& onScopeConfigure, ESentryLevel level) override; + virtual TSharedPtr CaptureEvent(TSharedPtr event) override; + virtual TSharedPtr CaptureEventWithScope(TSharedPtr event, const FSentryScopeDelegate& onScopeConfigure) override; + virtual TSharedPtr CaptureException(const FString& type, const FString& message, int32 framesToSkip) override; + virtual TSharedPtr CaptureAssertion(const FString& type, const FString& message) override; + virtual TSharedPtr CaptureEnsure(const FString& type, const FString& message) override; + virtual void CaptureUserFeedback(TSharedPtr userFeedback) override; + virtual void SetUser(TSharedPtr user) override; virtual void RemoveUser() override; - virtual void ConfigureScope(const FConfigureScopeNativeDelegate& onConfigureScope) override; + virtual void ConfigureScope(const FSentryScopeDelegate& onConfigureScope) override; virtual void SetContext(const FString& key, const TMap& values) override; virtual void SetTag(const FString& key, const FString& value) override; virtual void RemoveTag(const FString& key) override; virtual void SetLevel(ESentryLevel level) override; virtual void StartSession() override; virtual void EndSession() override; - virtual USentryTransaction* StartTransaction(const FString& name, const FString& operation) override; - virtual USentryTransaction* StartTransactionWithContext(USentryTransactionContext* context) override; - virtual USentryTransaction* StartTransactionWithContextAndOptions(USentryTransactionContext* context, const TMap& options) override; - virtual USentryTransactionContext* ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) override; + virtual TSharedPtr StartTransaction(const FString& name, const FString& operation) override; + virtual TSharedPtr StartTransactionWithContext(TSharedPtr context) override; + virtual TSharedPtr StartTransactionWithContextAndOptions(TSharedPtr context, const TMap& options) override; + virtual TSharedPtr ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) override; USentryBeforeSendHandler* GetBeforeSendHandler(); diff --git a/plugin-dev/Source/Sentry/Private/Desktop/SentryTransactionDesktop.cpp b/plugin-dev/Source/Sentry/Private/Desktop/SentryTransactionDesktop.cpp index 4168864a..1e5c6924 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/SentryTransactionDesktop.cpp +++ b/plugin-dev/Source/Sentry/Private/Desktop/SentryTransactionDesktop.cpp @@ -3,8 +3,6 @@ #include "SentryTransactionDesktop.h" #include "SentrySpanDesktop.h" -#include "SentrySpan.h" - #include "Infrastructure/SentryConvertorsDesktop.h" #if USE_SENTRY_NATIVE @@ -30,10 +28,10 @@ sentry_transaction_t* SentryTransactionDesktop::GetNativeObject() return TransactionDesktop; } -USentrySpan* SentryTransactionDesktop::StartChild(const FString& operation, const FString& desctiption) +TSharedPtr SentryTransactionDesktop::StartChild(const FString& operation, const FString& desctiption) { sentry_span_t* nativeSpan = sentry_transaction_start_child(TransactionDesktop, TCHAR_TO_ANSI(*operation), TCHAR_TO_ANSI(*desctiption)); - return SentryConvertorsDesktop::SentrySpanToUnreal(nativeSpan); + return MakeShareable(new SentrySpanDesktop(nativeSpan)); } void SentryTransactionDesktop::Finish() diff --git a/plugin-dev/Source/Sentry/Private/Desktop/SentryTransactionDesktop.h b/plugin-dev/Source/Sentry/Private/Desktop/SentryTransactionDesktop.h index a1bafef9..f226742f 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/SentryTransactionDesktop.h +++ b/plugin-dev/Source/Sentry/Private/Desktop/SentryTransactionDesktop.h @@ -18,7 +18,7 @@ class SentryTransactionDesktop : public ISentryTransaction sentry_transaction_t* GetNativeObject(); - virtual USentrySpan* StartChild(const FString& operation, const FString& desctiption) override; + virtual TSharedPtr StartChild(const FString& operation, const FString& desctiption) override; virtual void Finish() override; virtual bool IsFinished() const override; virtual void SetName(const FString& name) override; diff --git a/plugin-dev/Source/Sentry/Private/Desktop/SentryUserFeedbackDesktop.cpp b/plugin-dev/Source/Sentry/Private/Desktop/SentryUserFeedbackDesktop.cpp index e2b345b6..2046d1f0 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/SentryUserFeedbackDesktop.cpp +++ b/plugin-dev/Source/Sentry/Private/Desktop/SentryUserFeedbackDesktop.cpp @@ -2,7 +2,7 @@ #include "SentryUserFeedbackDesktop.h" -#include "SentryId.h" +#include "SentryIdDesktop.h" #include "Infrastructure/SentryConvertorsDesktop.h" @@ -13,7 +13,7 @@ SentryUserFeedbackDesktop::SentryUserFeedbackDesktop() UserFeedbackDesktop = sentry_value_new_object(); } -SentryUserFeedbackDesktop::SentryUserFeedbackDesktop(USentryId* eventId) +SentryUserFeedbackDesktop::SentryUserFeedbackDesktop(TSharedPtr eventId) { UserFeedbackDesktop = sentry_value_new_object(); sentry_value_set_by_key(UserFeedbackDesktop, "event_id", sentry_value_new_string(TCHAR_TO_ANSI(*eventId->ToString()))); diff --git a/plugin-dev/Source/Sentry/Private/Desktop/SentryUserFeedbackDesktop.h b/plugin-dev/Source/Sentry/Private/Desktop/SentryUserFeedbackDesktop.h index a76bc750..8064806b 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/SentryUserFeedbackDesktop.h +++ b/plugin-dev/Source/Sentry/Private/Desktop/SentryUserFeedbackDesktop.h @@ -8,13 +8,13 @@ #if USE_SENTRY_NATIVE -class USentryId; +class ISentryId; class SentryUserFeedbackDesktop : public ISentryUserFeedback { public: SentryUserFeedbackDesktop(); - SentryUserFeedbackDesktop(USentryId* eventId); + SentryUserFeedbackDesktop(TSharedPtr eventId); virtual ~SentryUserFeedbackDesktop() override; sentry_value_t GetNativeObject(); diff --git a/plugin-dev/Source/Sentry/Private/Interface/SentryHintInterface.h b/plugin-dev/Source/Sentry/Private/Interface/SentryHintInterface.h index 03d67181..f88507da 100644 --- a/plugin-dev/Source/Sentry/Private/Interface/SentryHintInterface.h +++ b/plugin-dev/Source/Sentry/Private/Interface/SentryHintInterface.h @@ -4,12 +4,12 @@ #include "CoreMinimal.h" -class USentryAttachment; +class ISentryAttachment; class ISentryHint { public: virtual ~ISentryHint() = default; - virtual void AddAttachment(USentryAttachment* attachment) = 0; + virtual void AddAttachment(TSharedPtr attachment) = 0; }; \ No newline at end of file diff --git a/plugin-dev/Source/Sentry/Private/Interface/SentrySamplingContextInterface.h b/plugin-dev/Source/Sentry/Private/Interface/SentrySamplingContextInterface.h index 36ee1cbc..4c17253e 100644 --- a/plugin-dev/Source/Sentry/Private/Interface/SentrySamplingContextInterface.h +++ b/plugin-dev/Source/Sentry/Private/Interface/SentrySamplingContextInterface.h @@ -4,13 +4,13 @@ #include "CoreMinimal.h" -class USentryTransactionContext; +class ISentryTransactionContext; class ISentrySamplingContext { public: virtual ~ISentrySamplingContext() = default; - virtual USentryTransactionContext* GetTransactionContext() const = 0; + virtual TSharedPtr GetTransactionContext() const = 0; virtual TMap GetCustomSamplingContext() const = 0; }; \ No newline at end of file diff --git a/plugin-dev/Source/Sentry/Private/Interface/SentryScopeInterface.h b/plugin-dev/Source/Sentry/Private/Interface/SentryScopeInterface.h index 5ee73ec5..0e88ce88 100644 --- a/plugin-dev/Source/Sentry/Private/Interface/SentryScopeInterface.h +++ b/plugin-dev/Source/Sentry/Private/Interface/SentryScopeInterface.h @@ -6,17 +6,17 @@ #include "SentryDataTypes.h" -class USentryBreadcrumb; -class USentryAttachment; +class ISentryBreadcrumb; +class ISentryAttachment; class ISentryScope { public: virtual ~ISentryScope() = default; - virtual void AddBreadcrumb(USentryBreadcrumb* breadcrumb) = 0; + virtual void AddBreadcrumb(TSharedPtr breadcrumb) = 0; virtual void ClearBreadcrumbs() = 0; - virtual void AddAttachment(USentryAttachment* attachment) = 0; + virtual void AddAttachment(TSharedPtr attachment) = 0; virtual void ClearAttachments() = 0; virtual void SetTagValue(const FString& key, const FString& value) = 0; virtual FString GetTagValue(const FString& key) const = 0; diff --git a/plugin-dev/Source/Sentry/Private/Interface/SentrySubsystemInterface.h b/plugin-dev/Source/Sentry/Private/Interface/SentrySubsystemInterface.h index a64641f5..8b471458 100644 --- a/plugin-dev/Source/Sentry/Private/Interface/SentrySubsystemInterface.h +++ b/plugin-dev/Source/Sentry/Private/Interface/SentrySubsystemInterface.h @@ -5,18 +5,21 @@ #include "CoreMinimal.h" #include "SentryDataTypes.h" -#include "SentryScope.h" + +class ISentryBreadcrumb; +class ISentryEvent; +class ISentryUserFeedback; +class ISentryUser; +class ISentryTransaction; +class ISentryTransactionContext; +class ISentryId; +class ISentryScope; class USentrySettings; -class USentryBreadcrumb; -class USentryEvent; -class USentryId; -class USentryUserFeedback; -class USentryUser; class USentryBeforeSendHandler; -class USentryTransaction; class USentryTraceSampler; -class USentryTransactionContext; + +DECLARE_DELEGATE_OneParam(FSentryScopeDelegate, TSharedPtr); class ISentrySubsystem { @@ -27,28 +30,28 @@ class ISentrySubsystem virtual void Close() = 0; virtual bool IsEnabled() = 0; virtual ESentryCrashedLastRun IsCrashedLastRun() = 0; - virtual void AddBreadcrumb(USentryBreadcrumb* breadcrumb) = 0; + virtual void AddBreadcrumb(TSharedPtr breadcrumb) = 0; virtual void AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap& Data, ESentryLevel Level) = 0; virtual void ClearBreadcrumbs() = 0; - virtual USentryId* CaptureMessage(const FString& message, ESentryLevel level) = 0; - virtual USentryId* CaptureMessageWithScope(const FString& message, const FConfigureScopeNativeDelegate& onConfigureScope, ESentryLevel level) = 0; - virtual USentryId* CaptureEvent(USentryEvent* event) = 0; - virtual USentryId* CaptureEventWithScope(USentryEvent* event, const FConfigureScopeNativeDelegate& onConfigureScope) = 0; - virtual USentryId* CaptureException(const FString& type, const FString& message, int32 framesToSkip = 0) = 0; - virtual USentryId* CaptureAssertion(const FString& type, const FString& message) = 0; - virtual USentryId* CaptureEnsure(const FString& type, const FString& message) = 0; - virtual void CaptureUserFeedback(USentryUserFeedback* userFeedback) = 0; - virtual void SetUser(USentryUser* user) = 0; + virtual TSharedPtr CaptureMessage(const FString& message, ESentryLevel level) = 0; + virtual TSharedPtr CaptureMessageWithScope(const FString& message, const FSentryScopeDelegate& onConfigureScope, ESentryLevel level) = 0; + virtual TSharedPtr CaptureEvent(TSharedPtr event) = 0; + virtual TSharedPtr CaptureEventWithScope(TSharedPtr event, const FSentryScopeDelegate& onConfigureScope) = 0; + virtual TSharedPtr CaptureException(const FString& type, const FString& message, int32 framesToSkip = 0) = 0; + virtual TSharedPtr CaptureAssertion(const FString& type, const FString& message) = 0; + virtual TSharedPtr CaptureEnsure(const FString& type, const FString& message) = 0; + virtual void CaptureUserFeedback(TSharedPtr userFeedback) = 0; + virtual void SetUser(TSharedPtr user) = 0; virtual void RemoveUser() = 0; - virtual void ConfigureScope(const FConfigureScopeNativeDelegate& onConfigureScope) = 0; + virtual void ConfigureScope(const FSentryScopeDelegate& onConfigureScope) = 0; virtual void SetContext(const FString& key, const TMap& values) = 0; virtual void SetTag(const FString& key, const FString& value) = 0; virtual void RemoveTag(const FString& key) = 0; virtual void SetLevel(ESentryLevel level) = 0; virtual void StartSession() = 0; virtual void EndSession() = 0; - virtual USentryTransaction* StartTransaction(const FString& name, const FString& operation) = 0; - virtual USentryTransaction* StartTransactionWithContext(USentryTransactionContext* context) = 0; - virtual USentryTransaction* StartTransactionWithContextAndOptions(USentryTransactionContext* context, const TMap& options) = 0; - virtual USentryTransactionContext* ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) = 0; + virtual TSharedPtr StartTransaction(const FString& name, const FString& operation) = 0; + virtual TSharedPtr StartTransactionWithContext(TSharedPtr context) = 0; + virtual TSharedPtr StartTransactionWithContextAndOptions(TSharedPtr context, const TMap& options) = 0; + virtual TSharedPtr ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) = 0; }; \ No newline at end of file diff --git a/plugin-dev/Source/Sentry/Private/Interface/SentryTransactionInterface.h b/plugin-dev/Source/Sentry/Private/Interface/SentryTransactionInterface.h index fd57e194..5de43d8b 100644 --- a/plugin-dev/Source/Sentry/Private/Interface/SentryTransactionInterface.h +++ b/plugin-dev/Source/Sentry/Private/Interface/SentryTransactionInterface.h @@ -4,14 +4,14 @@ #include "CoreMinimal.h" -class USentrySpan; +class ISentrySpan; class ISentryTransaction { public: virtual ~ISentryTransaction() = default; - virtual USentrySpan* StartChild(const FString& operation, const FString& desctiption) = 0; + virtual TSharedPtr StartChild(const FString& operation, const FString& desctiption) = 0; virtual void Finish() = 0; virtual bool IsFinished() const = 0; virtual void SetName(const FString& name) = 0; diff --git a/plugin-dev/Source/Sentry/Private/SentryHint.cpp b/plugin-dev/Source/Sentry/Private/SentryHint.cpp index c6e97c08..b4d98a76 100644 --- a/plugin-dev/Source/Sentry/Private/SentryHint.cpp +++ b/plugin-dev/Source/Sentry/Private/SentryHint.cpp @@ -2,6 +2,7 @@ #include "SentryHint.h" +#include "SentryAttachment.h" #include "Interface/SentryHintInterface.h" #if PLATFORM_ANDROID @@ -23,7 +24,7 @@ void USentryHint::AddAttachment(USentryAttachment* Attachment) if(!SentryHintNativeImpl) return; - SentryHintNativeImpl->AddAttachment(Attachment); + SentryHintNativeImpl->AddAttachment(Attachment->GetNativeImpl()); } void USentryHint::InitWithNativeImpl(TSharedPtr hintImpl) diff --git a/plugin-dev/Source/Sentry/Private/SentryOutputDevice.cpp b/plugin-dev/Source/Sentry/Private/SentryOutputDevice.cpp index d77f59f1..c90db6ab 100644 --- a/plugin-dev/Source/Sentry/Private/SentryOutputDevice.cpp +++ b/plugin-dev/Source/Sentry/Private/SentryOutputDevice.cpp @@ -2,7 +2,6 @@ #include "SentryOutputDevice.h" -#include "SentryBreadcrumb.h" #include "SentryModule.h" #include "SentrySettings.h" #include "SentrySubsystem.h" diff --git a/plugin-dev/Source/Sentry/Private/SentrySamplingContext.cpp b/plugin-dev/Source/Sentry/Private/SentrySamplingContext.cpp index 067778d6..70d9861f 100644 --- a/plugin-dev/Source/Sentry/Private/SentrySamplingContext.cpp +++ b/plugin-dev/Source/Sentry/Private/SentrySamplingContext.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2024 Sentry. All Rights Reserved. #include "SentrySamplingContext.h" +#include "SentryTransactionContext.h" #include "Interface/SentrySamplingContextInterface.h" @@ -19,7 +20,12 @@ USentryTransactionContext* USentrySamplingContext::GetTransactionContext() const if (!SentrySamplingContextNativeImpl) return nullptr; - return SentrySamplingContextNativeImpl->GetTransactionContext(); + TSharedPtr transactionContextNativeImpl = SentrySamplingContextNativeImpl->GetTransactionContext(); + + USentryTransactionContext* unrealTransactionContext = NewObject(); + unrealTransactionContext->InitWithNativeImpl(transactionContextNativeImpl); + + return unrealTransactionContext; } TMap USentrySamplingContext::GetCustomSamplingContext() const diff --git a/plugin-dev/Source/Sentry/Private/SentryScope.cpp b/plugin-dev/Source/Sentry/Private/SentryScope.cpp index 95374813..65db7513 100644 --- a/plugin-dev/Source/Sentry/Private/SentryScope.cpp +++ b/plugin-dev/Source/Sentry/Private/SentryScope.cpp @@ -33,7 +33,7 @@ void USentryScope::AddBreadcrumb(USentryBreadcrumb* Breadcrumb) if (!ScopeNativeImpl) return; - ScopeNativeImpl->AddBreadcrumb(Breadcrumb); + ScopeNativeImpl->AddBreadcrumb(Breadcrumb->GetNativeImpl()); } void USentryScope::ClearBreadcrumbs() @@ -49,7 +49,7 @@ void USentryScope::AddAttachment(USentryAttachment* Attachment) if (!ScopeNativeImpl) return; - ScopeNativeImpl->AddAttachment(Attachment); + ScopeNativeImpl->AddAttachment(Attachment->GetNativeImpl()); } void USentryScope::ClearAttachments() diff --git a/plugin-dev/Source/Sentry/Private/SentrySubsystem.cpp b/plugin-dev/Source/Sentry/Private/SentrySubsystem.cpp index c5b392a0..ce2f0d0d 100644 --- a/plugin-dev/Source/Sentry/Private/SentrySubsystem.cpp +++ b/plugin-dev/Source/Sentry/Private/SentrySubsystem.cpp @@ -8,14 +8,16 @@ #include "SentryDefines.h" #include "SentryEvent.h" #include "SentryId.h" +#include "SentryUser.h" #include "SentryUserFeedback.h" #include "SentryBeforeSendHandler.h" #include "SentryTraceSampler.h" +#include "SentryTransaction.h" #include "SentryTransactionContext.h" #include "SentryOutputDevice.h" +#include "SentryOutputDeviceError.h" #include "CoreGlobals.h" -#include "SentryOutputDeviceError.h" #include "Engine/World.h" #include "Misc/EngineVersion.h" #include "Misc/CoreDelegates.h" @@ -212,7 +214,7 @@ void USentrySubsystem::AddBreadcrumb(USentryBreadcrumb* Breadcrumb) if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) return; - SubsystemNativeImpl->AddBreadcrumb(Breadcrumb); + SubsystemNativeImpl->AddBreadcrumb(Breadcrumb->GetNativeImpl()); } void USentrySubsystem::AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap& Data, ESentryLevel Level) @@ -236,7 +238,12 @@ USentryId* USentrySubsystem::CaptureMessage(const FString& Message, ESentryLevel if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) return nullptr; - return SubsystemNativeImpl->CaptureMessage(Message, Level); + TSharedPtr idNativeImpl = SubsystemNativeImpl->CaptureMessage(Message, Level); + + USentryId* unrealId = NewObject(); + unrealId->InitWithNativeImpl(idNativeImpl); + + return unrealId; } USentryId* USentrySubsystem::CaptureMessageWithScope(const FString& Message, const FConfigureScopeDelegate& OnConfigureScope, ESentryLevel Level) @@ -249,7 +256,17 @@ USentryId* USentrySubsystem::CaptureMessageWithScope(const FString& Message, con if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) return nullptr; - return SubsystemNativeImpl->CaptureMessageWithScope(Message, OnConfigureScope, Level); + TSharedPtr idNativeImpl = SubsystemNativeImpl->CaptureMessageWithScope(Message, FSentryScopeDelegate::CreateLambda([&](TSharedPtr nativeScope) + { + USentryScope* unrealScope = NewObject(); + unrealScope->InitWithNativeImpl(nativeScope); + OnConfigureScope.ExecuteIfBound(unrealScope); + }), Level); + + USentryId* unrealId = NewObject(); + unrealId->InitWithNativeImpl(idNativeImpl); + + return unrealId; } USentryId* USentrySubsystem::CaptureEvent(USentryEvent* Event) @@ -257,7 +274,12 @@ USentryId* USentrySubsystem::CaptureEvent(USentryEvent* Event) if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) return nullptr; - return SubsystemNativeImpl->CaptureEvent(Event); + TSharedPtr idNativeImpl = SubsystemNativeImpl->CaptureEvent(Event->GetNativeImpl()); + + USentryId* unrealId = NewObject(); + unrealId->InitWithNativeImpl(idNativeImpl); + + return unrealId; } USentryId* USentrySubsystem::CaptureEventWithScope(USentryEvent* Event, const FConfigureScopeDelegate& OnConfigureScope) @@ -270,7 +292,17 @@ USentryId* USentrySubsystem::CaptureEventWithScope(USentryEvent* Event, const FC if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) return nullptr; - return SubsystemNativeImpl->CaptureEventWithScope(Event, OnConfigureScope); + TSharedPtr idNativeImpl = SubsystemNativeImpl->CaptureEventWithScope(Event->GetNativeImpl(), FSentryScopeDelegate::CreateLambda([&](TSharedPtr nativeScope) + { + USentryScope* unrealScope = NewObject(); + unrealScope->InitWithNativeImpl(nativeScope); + OnConfigureScope.ExecuteIfBound(unrealScope); + })); + + USentryId* unrealId = NewObject(); + unrealId->InitWithNativeImpl(idNativeImpl); + + return unrealId; } void USentrySubsystem::CaptureUserFeedback(USentryUserFeedback* UserFeedback) @@ -278,7 +310,7 @@ void USentrySubsystem::CaptureUserFeedback(USentryUserFeedback* UserFeedback) if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) return; - SubsystemNativeImpl->CaptureUserFeedback(UserFeedback); + SubsystemNativeImpl->CaptureUserFeedback(UserFeedback->GetNativeImpl()); } void USentrySubsystem::CaptureUserFeedbackWithParams(USentryId* EventId, const FString& Email, const FString& Comments, const FString& Name) @@ -297,7 +329,7 @@ void USentrySubsystem::SetUser(USentryUser* User) if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) return; - SubsystemNativeImpl->SetUser(User); + SubsystemNativeImpl->SetUser(User->GetNativeImpl()); } void USentrySubsystem::RemoveUser() @@ -318,7 +350,12 @@ void USentrySubsystem::ConfigureScope(const FConfigureScopeNativeDelegate& OnCon if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) return; - SubsystemNativeImpl->ConfigureScope(OnConfigureScope); + SubsystemNativeImpl->ConfigureScope(FSentryScopeDelegate::CreateLambda([&](TSharedPtr nativeScope) + { + USentryScope* unrealScope = NewObject(); + unrealScope->InitWithNativeImpl(nativeScope); + OnConfigureScope.ExecuteIfBound(unrealScope); + })); } void USentrySubsystem::SetContext(const FString& Key, const TMap& Values) @@ -374,7 +411,12 @@ USentryTransaction* USentrySubsystem::StartTransaction(const FString& Name, cons if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) return nullptr; - return SubsystemNativeImpl->StartTransaction(Name, Operation); + TSharedPtr transactionNativeImpl = SubsystemNativeImpl->StartTransaction(Name, Operation); + + USentryTransaction* unrealTransaction = NewObject(); + unrealTransaction->InitWithNativeImpl(transactionNativeImpl); + + return unrealTransaction; } USentryTransaction* USentrySubsystem::StartTransactionWithContext(USentryTransactionContext* Context) @@ -382,7 +424,12 @@ USentryTransaction* USentrySubsystem::StartTransactionWithContext(USentryTransac if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) return nullptr; - return SubsystemNativeImpl->StartTransactionWithContext(Context); + TSharedPtr transactionNativeImpl = SubsystemNativeImpl->StartTransactionWithContext(Context->GetNativeImpl()); + + USentryTransaction* unrealTransaction = NewObject(); + unrealTransaction->InitWithNativeImpl(transactionNativeImpl); + + return unrealTransaction; } USentryTransaction* USentrySubsystem::StartTransactionWithContextAndOptions(USentryTransactionContext* Context, const TMap& Options) @@ -390,7 +437,12 @@ USentryTransaction* USentrySubsystem::StartTransactionWithContextAndOptions(USen if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) return nullptr; - return SubsystemNativeImpl->StartTransactionWithContextAndOptions(Context, Options); + TSharedPtr transactionNativeImpl = SubsystemNativeImpl->StartTransactionWithContextAndOptions(Context->GetNativeImpl(), Options); + + USentryTransaction* unrealTransaction = NewObject(); + unrealTransaction->InitWithNativeImpl(transactionNativeImpl); + + return unrealTransaction; } USentryTransactionContext* USentrySubsystem::ContinueTrace(const FString& SentryTrace, const TArray& BaggageHeaders) @@ -398,7 +450,12 @@ USentryTransactionContext* USentrySubsystem::ContinueTrace(const FString& Sentry if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) return nullptr; - return SubsystemNativeImpl->ContinueTrace(SentryTrace, BaggageHeaders); + TSharedPtr transactionContextNativeImpl = SubsystemNativeImpl->ContinueTrace(SentryTrace, BaggageHeaders); + + USentryTransactionContext* unrealTransactionContext = NewObject(); + unrealTransactionContext->InitWithNativeImpl(transactionContextNativeImpl); + + return unrealTransactionContext; } bool USentrySubsystem::IsSupportedForCurrentSettings() diff --git a/plugin-dev/Source/Sentry/Private/SentryTransaction.cpp b/plugin-dev/Source/Sentry/Private/SentryTransaction.cpp index fe8b2e9c..4d4f9db4 100644 --- a/plugin-dev/Source/Sentry/Private/SentryTransaction.cpp +++ b/plugin-dev/Source/Sentry/Private/SentryTransaction.cpp @@ -22,7 +22,12 @@ USentrySpan* USentryTransaction::StartChild(const FString& Operation, const FStr if (!SentryTransactionNativeImpl || SentryTransactionNativeImpl->IsFinished()) return nullptr; - return SentryTransactionNativeImpl->StartChild(Operation, Description); + TSharedPtr spanNativeImpl = SentryTransactionNativeImpl->StartChild(Operation, Description); + + USentrySpan* unrealSpan = NewObject(); + unrealSpan->InitWithNativeImpl(spanNativeImpl); + + return unrealSpan; } void USentryTransaction::Finish() diff --git a/plugin-dev/Source/Sentry/Private/SentryUserFeedback.cpp b/plugin-dev/Source/Sentry/Private/SentryUserFeedback.cpp index e6db9d35..fe91208e 100644 --- a/plugin-dev/Source/Sentry/Private/SentryUserFeedback.cpp +++ b/plugin-dev/Source/Sentry/Private/SentryUserFeedback.cpp @@ -16,11 +16,11 @@ void USentryUserFeedback::Initialize(USentryId* EventId) { #if PLATFORM_ANDROID - UserFeedbackNativeImpl = MakeShareable(new SentryUserFeedbackAndroid(EventId)); + UserFeedbackNativeImpl = MakeShareable(new SentryUserFeedbackAndroid(EventId->GetNativeImpl())); #elif PLATFORM_IOS || PLATFORM_MAC - UserFeedbackNativeImpl = MakeShareable(new SentryUserFeedbackApple(EventId)); + UserFeedbackNativeImpl = MakeShareable(new SentryUserFeedbackApple(EventId->GetNativeImpl())); #elif PLATFORM_WINDOWS || PLATFORM_LINUX - UserFeedbackNativeImpl = MakeShareable(new SentryUserFeedbackDesktop(EventId)); + UserFeedbackNativeImpl = MakeShareable(new SentryUserFeedbackDesktop(EventId->GetNativeImpl())); #endif } diff --git a/plugin-dev/Source/Sentry/Public/SentrySubsystem.h b/plugin-dev/Source/Sentry/Public/SentrySubsystem.h index 7840c36a..4a11dc8c 100644 --- a/plugin-dev/Source/Sentry/Public/SentrySubsystem.h +++ b/plugin-dev/Source/Sentry/Public/SentrySubsystem.h @@ -121,19 +121,19 @@ class SENTRY_API USentrySubsystem : public UEngineSubsystem * * @note: Not supported for Windows/Linux. */ - UFUNCTION(BlueprintCallable, Category = "Sentry", meta = (AutoCreateRefTerm = "OnConfigureScope")) - USentryId* CaptureMessageWithScope(const FString& Message, const FConfigureScopeDelegate& OnConfigureScope, ESentryLevel Level = ESentryLevel::Info); - USentryId* CaptureMessageWithScope(const FString& Message, const FConfigureScopeNativeDelegate& OnConfigureScope, ESentryLevel Level = ESentryLevel::Info); - - /** - * Captures a manually created event and sends it to Sentry. - * - * @param Event The event to send to Sentry. - */ - UFUNCTION(BlueprintCallable, Category = "Sentry") - USentryId* CaptureEvent(USentryEvent* Event); - - /** + UFUNCTION(BlueprintCallable, Category = "Sentry", meta = (AutoCreateRefTerm = "OnConfigureScope")) + USentryId* CaptureMessageWithScope(const FString& Message, const FConfigureScopeDelegate& OnConfigureScope, ESentryLevel Level = ESentryLevel::Info); + USentryId* CaptureMessageWithScope(const FString& Message, const FConfigureScopeNativeDelegate& OnConfigureScope, ESentryLevel Level = ESentryLevel::Info); + + /** + * Captures a manually created event and sends it to Sentry. + * + * @param Event The event to send to Sentry. + */ + UFUNCTION(BlueprintCallable, Category = "Sentry") + USentryId* CaptureEvent(USentryEvent* Event); + + /** * Captures a manually created event and sends it to Sentry. * * @param Event The event to send to Sentry. @@ -142,20 +142,20 @@ class SENTRY_API USentrySubsystem : public UEngineSubsystem * @note: Not supported for Windows/Linux. */ UFUNCTION(BlueprintCallable, Category = "Sentry") - USentryId* CaptureEventWithScope(USentryEvent* Event, const FConfigureScopeDelegate& OnConfigureScope); - USentryId* CaptureEventWithScope(USentryEvent* Event, const FConfigureScopeNativeDelegate& OnConfigureScope); - - /** - * Captures a user feedback. - * - * @param UserFeedback The user feedback to send to Sentry. - * - * @note: Not supported for Windows/Linux. - */ - UFUNCTION(BlueprintCallable, Category = "Sentry") - void CaptureUserFeedback(USentryUserFeedback* UserFeedback); - - /** + USentryId* CaptureEventWithScope(USentryEvent* Event, const FConfigureScopeDelegate& OnConfigureScope); + USentryId* CaptureEventWithScope(USentryEvent* Event, const FConfigureScopeNativeDelegate& OnConfigureScope); + + /** + * Captures a user feedback. + * + * @param UserFeedback The user feedback to send to Sentry. + * + * @note: Not supported for Windows/Linux. + */ + UFUNCTION(BlueprintCallable, Category = "Sentry") + void CaptureUserFeedback(USentryUserFeedback* UserFeedback); + + /** * Captures a user feedback. * * @param EventId The event Id. @@ -189,17 +189,17 @@ class SENTRY_API USentrySubsystem : public UEngineSubsystem * @note: Not supported for Windows/Linux. */ UFUNCTION(BlueprintCallable, Category = "Sentry", meta = (AutoCreateRefTerm = "OnCofigureScope")) - void ConfigureScope(const FConfigureScopeDelegate& OnConfigureScope); - void ConfigureScope(const FConfigureScopeNativeDelegate& OnConfigureScope); - - /** - * Sets context values which will be used for enriching events. - * - * @param Key Context key. - * @param Values Context values. - */ - UFUNCTION(BlueprintCallable, Category = "Sentry") - void SetContext(const FString& Key, const TMap& Values); + void ConfigureScope(const FConfigureScopeDelegate& OnConfigureScope); + void ConfigureScope(const FConfigureScopeNativeDelegate& OnConfigureScope); + + /** + * Sets context values which will be used for enriching events. + * + * @param Key Context key. + * @param Values Context values. + */ + UFUNCTION(BlueprintCallable, Category = "Sentry") + void SetContext(const FString& Key, const TMap& Values); /** * Sets global tag - key/value string pair which will be attached to every event.