diff --git a/CHANGELOG.md b/CHANGELOG.md index be428116..4bf2474e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Features - Add performance monitoring API ([#470](https://github.com/getsentry/sentry-unreal/pull/470)) +- Add `IsCrashedLastRun` allowing to check whether the app crashed during its last run ([#483](https://github.com/getsentry/sentry-unreal/pull/483)) ### Fixes @@ -18,6 +19,18 @@ - Bump Java SDK (Android) from v7.0.0 to v7.1.0 ([#469](https://github.com/getsentry/sentry-unreal/pull/469)) - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#710) - [diff](https://github.com/getsentry/sentry-java/compare/7.0.0...7.1.0) +- Bump CLI from v2.23.0 to v2.25.0 ([#471](https://github.com/getsentry/sentry-unreal/pull/471), [#472](https://github.com/getsentry/sentry-unreal/pull/472), [#475](https://github.com/getsentry/sentry-unreal/pull/475), [#477](https://github.com/getsentry/sentry-unreal/pull/477)) + - [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2250) + - [diff](https://github.com/getsentry/sentry-cli/compare/2.23.0...2.25.0) +- Bump Cocoa SDK (iOS) from v8.17.2 to v8.18.0 ([#474](https://github.com/getsentry/sentry-unreal/pull/474)) + - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8180) + - [diff](https://github.com/getsentry/sentry-cocoa/compare/8.17.2...8.18.0) +- Bump Native SDK from v0.6.7 to v0.7.0 ([#478](https://github.com/getsentry/sentry-unreal/pull/478)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#070) + - [diff](https://github.com/getsentry/sentry-native/compare/0.6.7...0.7.0) +- Bump Java SDK (Android) from v7.1.0 to v7.2.0 ([#481](https://github.com/getsentry/sentry-unreal/pull/481)) + - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#720) + - [diff](https://github.com/getsentry/sentry-java/compare/7.1.0...7.2.0) ## 0.15.1 diff --git a/modules/sentry-cocoa b/modules/sentry-cocoa index f5dafd74..3b9a8e69 160000 --- a/modules/sentry-cocoa +++ b/modules/sentry-cocoa @@ -1 +1 @@ -Subproject commit f5dafd7449be2f1778f2ddb87d57347b96461003 +Subproject commit 3b9a8e69ca296bd8cd0e317ad7a448e5daf4a342 diff --git a/modules/sentry-java b/modules/sentry-java index e0ea6985..f7abca1c 160000 --- a/modules/sentry-java +++ b/modules/sentry-java @@ -1 +1 @@ -Subproject commit e0ea6985006a31c01bb92fa18de01fb4b9491c82 +Subproject commit f7abca1cfb968b08b91a88fd835fc98839b43ba7 diff --git a/modules/sentry-native b/modules/sentry-native index a3d58622..4ec95c07 160000 --- a/modules/sentry-native +++ b/modules/sentry-native @@ -1 +1 @@ -Subproject commit a3d58622a807b9dda174cb9fc18fa0f98c89d043 +Subproject commit 4ec95c0725df5f34440db8fa8d37b4c519fce74e diff --git a/plugin-dev/Source/Sentry/Private/Android/Java/SentryBridgeJava.java b/plugin-dev/Source/Sentry/Private/Android/Java/SentryBridgeJava.java index bc91d101..118ffb20 100644 --- a/plugin-dev/Source/Sentry/Private/Android/Java/SentryBridgeJava.java +++ b/plugin-dev/Source/Sentry/Private/Android/Java/SentryBridgeJava.java @@ -167,4 +167,12 @@ public static SentryOptions getOptions() { IHub hub = Sentry.getCurrentHub(); return hub.getOptions(); } + + public static int isCrashedLastRun() { + Boolean isCrashed = Sentry.isCrashedLastRun(); + if(isCrashed == null) { + return -1; + } + return isCrashed ? 1 : 0; + } } \ No newline at end of file diff --git a/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.cpp b/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.cpp index 56dccfb0..08141e75 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.cpp +++ b/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.cpp @@ -76,6 +76,28 @@ bool SentrySubsystemAndroid::IsEnabled() return FSentryJavaObjectWrapper::CallStaticMethod(SentryJavaClasses::Sentry, "isEnabled", "()Z"); } +ESentryCrashedLastRun SentrySubsystemAndroid::IsCrashedLastRun() +{ + ESentryCrashedLastRun unrealIsCrashed = ESentryCrashedLastRun::NotEvaluated; + + switch (FSentryJavaObjectWrapper::CallStaticMethod(SentryJavaClasses::SentryBridgeJava, "isCrashedLastRun", "()I")) + { + case -1: + unrealIsCrashed = ESentryCrashedLastRun::NotEvaluated; + break; + case 0: + unrealIsCrashed = ESentryCrashedLastRun::NotCrashed; + break; + case 1: + unrealIsCrashed = ESentryCrashedLastRun::Crashed; + break; + default: + UE_LOG(LogSentrySdk, Warning, TEXT("Unknown IsCrashedLastRun result. NotEvaluated will be returned.")); + } + + return unrealIsCrashed; +} + void SentrySubsystemAndroid::AddBreadcrumb(USentryBreadcrumb* breadcrumb) { TSharedPtr breadcrumbAndroid = StaticCastSharedPtr(breadcrumb->GetNativeImpl()); diff --git a/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.h b/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.h index b3dd7a8b..d8cda9ec 100644 --- a/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.h +++ b/plugin-dev/Source/Sentry/Private/Android/SentrySubsystemAndroid.h @@ -10,6 +10,7 @@ class SentrySubsystemAndroid : public ISentrySubsystem virtual void InitWithSettings(const USentrySettings* settings, USentryBeforeSendHandler* beforeSendHandler) override; virtual void Close() override; virtual bool IsEnabled() override; + virtual ESentryCrashedLastRun IsCrashedLastRun() override; virtual void AddBreadcrumb(USentryBreadcrumb* breadcrumb) override; virtual void ClearBreadcrumbs() override; virtual USentryId* CaptureMessage(const FString& message, ESentryLevel level) override; diff --git a/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.cpp b/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.cpp index 50fb55df..8c990a89 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.cpp +++ b/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.cpp @@ -47,7 +47,7 @@ void SentrySubsystemApple::InitWithSettings(const USentrySettings* settings, USe #if PLATFORM_IOS options.attachScreenshot = settings->AttachScreenshot; #endif - options.initialScope = ^(SentryScope *scope) { + options.initialScope = ^(SentryScope* scope) { if(settings->EnableAutoLogAttachment) { const FString logFilePath = IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*FGenericPlatformOutputDevices::GetAbsoluteLogFilename()); SentryAttachment* logAttachment = [[SENTRY_APPLE_CLASS(SentryAttachment) alloc] initWithPath:logFilePath.GetNSString()]; @@ -91,6 +91,11 @@ bool SentrySubsystemApple::IsEnabled() return [SENTRY_APPLE_CLASS(SentrySDK) isEnabled]; } +ESentryCrashedLastRun SentrySubsystemApple::IsCrashedLastRun() +{ + return [SENTRY_APPLE_CLASS(SentrySDK) crashedLastRun] ? ESentryCrashedLastRun::Crashed : ESentryCrashedLastRun::NotCrashed; +} + void SentrySubsystemApple::AddBreadcrumb(USentryBreadcrumb* breadcrumb) { TSharedPtr breadcrumbIOS = StaticCastSharedPtr(breadcrumb->GetNativeImpl()); diff --git a/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.h b/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.h index 90a69a38..f8158d7f 100644 --- a/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.h +++ b/plugin-dev/Source/Sentry/Private/Apple/SentrySubsystemApple.h @@ -10,6 +10,7 @@ class SentrySubsystemApple : public ISentrySubsystem virtual void InitWithSettings(const USentrySettings* settings, USentryBeforeSendHandler* beforeSendHandler) override; virtual void Close() override; virtual bool IsEnabled() override; + virtual ESentryCrashedLastRun IsCrashedLastRun() override; virtual void AddBreadcrumb(USentryBreadcrumb* breadcrumb) override; virtual void ClearBreadcrumbs() override; virtual USentryId* CaptureMessage(const FString& message, ESentryLevel level) override; diff --git a/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.cpp b/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.cpp index 96a94c5f..323e3375 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.cpp +++ b/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.cpp @@ -148,6 +148,8 @@ void SentrySubsystemDesktop::InitWithSettings(const USentrySettings* settings, U isEnabled = initResult == 0 ? true : false; + sentry_clear_crashed_last_run(); + #if PLATFORM_WINDOWS && ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 2 if(settings->EnableAutoCrashCapturing) { @@ -175,6 +177,28 @@ bool SentrySubsystemDesktop::IsEnabled() return isEnabled; } +ESentryCrashedLastRun SentrySubsystemDesktop::IsCrashedLastRun() +{ + ESentryCrashedLastRun unrealIsCrashed = ESentryCrashedLastRun::NotEvaluated; + + switch (sentry_get_crashed_last_run()) + { + case -1: + unrealIsCrashed = ESentryCrashedLastRun::NotEvaluated; + break; + case 0: + unrealIsCrashed = ESentryCrashedLastRun::NotCrashed; + break; + case 1: + unrealIsCrashed = ESentryCrashedLastRun::Crashed; + break; + default: + UE_LOG(LogSentrySdk, Warning, TEXT("Unknown IsCrashedLastRun result. NotEvaluated will be returned.")); + } + + return unrealIsCrashed; +} + void SentrySubsystemDesktop::AddBreadcrumb(USentryBreadcrumb* breadcrumb) { GetCurrentScope()->AddBreadcrumb(breadcrumb); diff --git a/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.h b/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.h index c1b3deff..e0899679 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.h +++ b/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.h @@ -19,6 +19,7 @@ class SentrySubsystemDesktop : public ISentrySubsystem virtual void InitWithSettings(const USentrySettings* settings, USentryBeforeSendHandler* beforeSendHandler) override; virtual void Close() override; virtual bool IsEnabled() override; + virtual ESentryCrashedLastRun IsCrashedLastRun() override; virtual void AddBreadcrumb(USentryBreadcrumb* breadcrumb) override; virtual void ClearBreadcrumbs() override; virtual USentryId* CaptureMessage(const FString& message, ESentryLevel level) override; diff --git a/plugin-dev/Source/Sentry/Private/Interface/SentrySubsystemInterface.h b/plugin-dev/Source/Sentry/Private/Interface/SentrySubsystemInterface.h index c1d6e112..69e5759c 100644 --- a/plugin-dev/Source/Sentry/Private/Interface/SentrySubsystemInterface.h +++ b/plugin-dev/Source/Sentry/Private/Interface/SentrySubsystemInterface.h @@ -24,6 +24,7 @@ class ISentrySubsystem virtual void InitWithSettings(const USentrySettings* settings, USentryBeforeSendHandler* beforeSendHandler) = 0; virtual void Close() = 0; virtual bool IsEnabled() = 0; + virtual ESentryCrashedLastRun IsCrashedLastRun() = 0; virtual void AddBreadcrumb(USentryBreadcrumb* breadcrumb) = 0; virtual void ClearBreadcrumbs() = 0; virtual USentryId* CaptureMessage(const FString& message, ESentryLevel level) = 0; diff --git a/plugin-dev/Source/Sentry/Private/SentrySubsystem.cpp b/plugin-dev/Source/Sentry/Private/SentrySubsystem.cpp index c1cf7a3f..3a6df879 100644 --- a/plugin-dev/Source/Sentry/Private/SentrySubsystem.cpp +++ b/plugin-dev/Source/Sentry/Private/SentrySubsystem.cpp @@ -134,6 +134,14 @@ bool USentrySubsystem::IsEnabled() return SubsystemNativeImpl->IsEnabled(); } +ESentryCrashedLastRun USentrySubsystem::IsCrashedLastRun() +{ + if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) + return ESentryCrashedLastRun::NotEvaluated; + + return SubsystemNativeImpl->IsCrashedLastRun(); +} + void USentrySubsystem::AddBreadcrumb(USentryBreadcrumb* Breadcrumb) { if (!SubsystemNativeImpl || !SubsystemNativeImpl->IsEnabled()) diff --git a/plugin-dev/Source/Sentry/Public/SentryDataTypes.h b/plugin-dev/Source/Sentry/Public/SentryDataTypes.h index be4cd592..8ab0e620 100644 --- a/plugin-dev/Source/Sentry/Public/SentryDataTypes.h +++ b/plugin-dev/Source/Sentry/Public/SentryDataTypes.h @@ -14,4 +14,12 @@ enum class ESentryLevel : uint8 Warning, Error, Fatal +}; + +UENUM(BlueprintType) +enum class ESentryCrashedLastRun : uint8 +{ + NotEvaluated, + NotCrashed, + Crashed }; \ No newline at end of file diff --git a/plugin-dev/Source/Sentry/Public/SentrySubsystem.h b/plugin-dev/Source/Sentry/Public/SentrySubsystem.h index ce39a167..677e66e7 100644 --- a/plugin-dev/Source/Sentry/Public/SentrySubsystem.h +++ b/plugin-dev/Source/Sentry/Public/SentrySubsystem.h @@ -53,6 +53,10 @@ class SENTRY_API USentrySubsystem : public UEngineSubsystem UFUNCTION(BlueprintPure, Category = "Sentry") bool IsEnabled(); + /** Checks whether the app crashed during the last run. */ + UFUNCTION(BlueprintPure, Category = "Sentry") + ESentryCrashedLastRun IsCrashedLastRun(); + /** * Adds a breadcrumb to the current Scope. * diff --git a/plugin-dev/sentry-cli.properties b/plugin-dev/sentry-cli.properties index 941db22d..0b11b943 100644 --- a/plugin-dev/sentry-cli.properties +++ b/plugin-dev/sentry-cli.properties @@ -1,2 +1,2 @@ -version=2.23.0 +version=2.25.0 repo=https://github.com/getsentry/sentry-cli