Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added method to check whether Start has been called #229

Open
wants to merge 7 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
## TBD

* Removed the bugsnag android gradle plugin due to incompatibility with UE 5.1+. Symbols can now be uploaded via the [BugSnag CLI](https://docs.bugsnag.com/platforms/unreal-engine/showing-full-stacktraces/#android-proguard-and-ndk-mappings)[#220](https://github.com/bugsnag/bugsnag-unreal/pull/220)
* Added a method to check whether the Start() method has been called.

## TBD

Expand Down
17 changes: 17 additions & 0 deletions Plugins/Bugsnag/Source/Bugsnag/Private/BugsnagFunctionLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
TEXT("UBugsnagFunctionLibrary::%s(): Bugsnag is not supported on platform %s"), \
*FString(__func__), *FString(FPlatformProperties::PlatformName()))

static bool Started = false;

void UBugsnagFunctionLibrary::Start(const FString& ApiKey)
{
TSharedPtr<FBugsnagConfiguration> Configuration = FBugsnagConfiguration::Load();
Expand Down Expand Up @@ -79,6 +81,7 @@ void UBugsnagFunctionLibrary::Start(const TSharedRef<FBugsnagConfiguration>& Con

GPlatformBugsnag.Start(Configuration);

Started = true;
static FString MapUrl;

FCoreUObjectDelegates::PreLoadMap.AddLambda([](const FString& InMapUrl)
Expand Down Expand Up @@ -353,6 +356,20 @@ TArray<TSharedRef<const IBugsnagBreadcrumb>> UBugsnagFunctionLibrary::GetBreadcr
#endif
}

bool UBugsnagFunctionLibrary::IsStarted()
{
if (Started)
{
UE_LOG(LogBugsnag, Log, TEXT("Bugsnag has started"));
return true;
}
else
{
UE_LOG(LogBugsnag, Log, TEXT("Bugsnag has not started"));
return false;
}
}

void UBugsnagFunctionLibrary::MarkLaunchCompleted()
{
#if PLATFORM_IMPLEMENTS_BUGSNAG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ class BUGSNAG_API UBugsnagFunctionLibrary : public UBlueprintFunctionLibrary
*/
static void Start(const TSharedRef<FBugsnagConfiguration>& Configuration);

/**
* Return true is Start method has been called, False otherwise.
*
*/
UFUNCTION(BlueprintCallable, Category = "Bugsnag")
static bool IsStarted();

// Notify

/**
Expand Down