Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 849a4a37 authored by g4m4's avatar g4m4
Browse files

[CODE] Move file as it was alone in its dedicated subfolder

parent 19e710d2
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@
#include "Blueprint/FixItBlueprintLibrary.h"
#include "Backend/FixItBackend.h"
#include "FixItBackend.h"
#include "FixItSettings.h"
#include "FixItSubsystem.h"
......
......@@ -8,7 +8,7 @@
#include "Blueprint/FixItCreateNewBugAsyncAction.h"
#include "Backend/FixItBackend.h"
#include "FixItBackend.h"
#include "FixItSubsystem.h"
UFixItCreateNewBugAsyncAction* UFixItCreateNewBugAsyncAction::CreateNewBug(const FFixItBugRequestData& data)
......
......@@ -8,7 +8,7 @@
#include "Blueprint/FixItLoginAsyncAction.h"
#include "Backend/FixItBackend.h"
#include "FixItBackend.h"
#include "FixItSettings.h"
#include "FixItSubsystem.h"
......
......@@ -8,7 +8,7 @@
#include "FixItSubsystem.h"
#include "Backend/FixItBackend.h"
#include "FixItBackend.h"
#include "FixItSettings.h"
DEFINE_LOG_CATEGORY(LogFixItGame);
......
......@@ -6,7 +6,7 @@
* Copyright 2024 MachinMachines
*/
#include "Backend/FixItBackend.h"
#include "FixItBackend.h"
#include <string>
......@@ -26,109 +26,109 @@ THIRD_PARTY_INCLUDES_END
#include "Misc/FileHelper.h"
#include "Misc/Paths.h"
#if PLATFORM_WINDOWS
namespace {
const FString& GetPlatformDataFilePath()
{
static const FString FixItPlatformDataFilePath = FPaths::ProjectSavedDir() / TEXT("FixIt") / TEXT("fixit_platformdata.txt");
return FixItPlatformDataFilePath;
}
const FString& GetPlatformDataFilePath()
{
static const FString FixItPlatformDataFilePath = FPaths::ProjectSavedDir() / TEXT("FixIt") / TEXT("fixit_platformdata.txt");
return FixItPlatformDataFilePath;
}
}
#if PLATFORM_WINDOWS
FFixItBackend::FFixItBackend(EFixItBackendType BackendType)
{
BackendImpl_ = MakeUnique<fixit::Backend>(
GetMatchingBackendType(BackendType),
FFixItTranslationLayer::ToStd(GetPlatformDataFilePath())
);
// Sync settings from the Unreal project to the internal format
UFixItSettings* Settings = GetMutableDefault<UFixItSettings>();
if (!Settings) {
UE_LOG(LogFixItCore, Error, TEXT("Could not load mutable settings"));
}
else {
Settings->SetInternal(BackendImpl_->GrabSettings());
}
BackendImpl_ = MakeUnique<fixit::Backend>(
GetMatchingBackendType(BackendType),
FFixItTranslationLayer::ToStd(GetPlatformDataFilePath())
);
// Sync settings from the Unreal project to the internal format
UFixItSettings* Settings = GetMutableDefault<UFixItSettings>();
if (!Settings) {
UE_LOG(LogFixItCore, Error, TEXT("Could not load mutable settings"));
}
else {
Settings->SetInternal(BackendImpl_->GrabSettings());
}
}
FFixItBackend::~FFixItBackend() = default;
bool FFixItBackend::Login(
const FString& Login,
const FString& Token,
FFixItRequestCompleted& OnRequestCompleted)
const FString& Login,
const FString& Token,
FFixItRequestCompleted& OnRequestCompleted)
{
if (!BackendImpl_.IsValid())
{
UE_LOG(LogFixItCore, Error, TEXT("No available backend"));
return false;
}
const UFixItSettings* Settings = GetDefault<UFixItSettings>();
return BackendImpl_->Login(
FFixItTranslationLayer::ToStd(Settings->URL),
FFixItTranslationLayer::ToStd(Settings->ProjectName),
FFixItTranslationLayer::ToStd(Login),
FFixItTranslationLayer::ToStd(Token),
[OnRequestCompleted](bool bResult, const std::string& ErrorMessage) {
OnRequestCompleted(bResult, FFixItTranslationLayer::FromStd(ErrorMessage));
});
if (!BackendImpl_.IsValid())
{
UE_LOG(LogFixItCore, Error, TEXT("No available backend"));
return false;
}
const UFixItSettings* Settings = GetDefault<UFixItSettings>();
return BackendImpl_->Login(
FFixItTranslationLayer::ToStd(Settings->URL),
FFixItTranslationLayer::ToStd(Settings->ProjectName),
FFixItTranslationLayer::ToStd(Login),
FFixItTranslationLayer::ToStd(Token),
[OnRequestCompleted](bool bResult, const std::string& ErrorMessage) {
OnRequestCompleted(bResult, FFixItTranslationLayer::FromStd(ErrorMessage));
});
}
bool FFixItBackend::CreateNewBug(
const FFixItBugRequestData& Data,
FFixItRequestCompleted& OnRequestCompleted,
FFixItRequestProgress& OnRequestProgress)
const FFixItBugRequestData& Data,
FFixItRequestCompleted& OnRequestCompleted,
FFixItRequestProgress& OnRequestProgress)
{
return BackendImpl_->CreateNewBug(
Data.ConvertTo(),
[OnRequestCompleted](bool bResult, const std::string& ErrorMessage) {
OnRequestCompleted(bResult, FFixItTranslationLayer::FromStd(ErrorMessage));
},
[OnRequestProgress](bool bResult, const std::string& ErrorMessage) {
OnRequestProgress(bResult, FFixItTranslationLayer::FromStd(ErrorMessage));
});
return BackendImpl_->CreateNewBug(
Data.ConvertTo(),
[OnRequestCompleted](bool bResult, const std::string& ErrorMessage) {
OnRequestCompleted(bResult, FFixItTranslationLayer::FromStd(ErrorMessage));
},
[OnRequestProgress](bool bResult, const std::string& ErrorMessage) {
OnRequestProgress(bResult, FFixItTranslationLayer::FromStd(ErrorMessage));
});
}
FString FFixItBackend::GetLoggedUserName() const
{
return FString(BackendImpl_->GetLoggedUserName().c_str());
return FString(BackendImpl_->GetLoggedUserName().c_str());
}
bool FFixItBackend::IsUsingDefaultCredentials() const
{
return BackendImpl_->IsUsingDefaultCredentials();
return BackendImpl_->IsUsingDefaultCredentials();
}
FString FFixItBackend::GetCreatedBugUrl(const FString& BugId) const
{
return FFixItTranslationLayer::FromStd(BackendImpl_->GetCreatedBugURL(FFixItTranslationLayer::ToStd(BugId)));
return FFixItTranslationLayer::FromStd(BackendImpl_->GetCreatedBugURL(FFixItTranslationLayer::ToStd(BugId)));
}
const FFixItPlatformData* FFixItBackend::GetPlatformData() const
{
// Platform data collection might be done here
const fixit::DataHostBase* Data = BackendImpl_->GetDataHost();
if (Data != nullptr)
{
const FFixItDataHost* UnrealData = (const FFixItDataHost*)(Data);
if (UnrealData != nullptr) {
return &UnrealData->PlatformData;
}
}
return nullptr;
// Platform data collection might be done here
const fixit::DataHostBase* Data = BackendImpl_->GetDataHost();
if (Data != nullptr)
{
const FFixItDataHost* UnrealData = (const FFixItDataHost*)(Data);
if (UnrealData != nullptr) {
return &UnrealData->PlatformData;
}
}
return nullptr;
}
#endif // PLATFORM_WINDOWS
fixit::BackendType FFixItBackend::GetMatchingBackendType(EFixItBackendType BackendType) {
switch (BackendType) {
case(EFixItBackendType::EFixItBackendType_JIRA): {
return fixit::BackendType::BackendType_JIRA;
}
default:
{
UE_LOG(LogFixItCore, Error, TEXT("Case not handled: %d"), BackendType);
}
}
return fixit::BackendType::BackendType_JIRA;
switch (BackendType) {
case(EFixItBackendType::EFixItBackendType_JIRA): {
return fixit::BackendType::BackendType_JIRA;
}
default:
{
UE_LOG(LogFixItCore, Error, TEXT("Case not handled: %d"), BackendType);
}
}
return fixit::BackendType::BackendType_JIRA;
}
#endif
......@@ -14,7 +14,6 @@
#include "FixItBackend.generated.h"
class FFixItBackendImpl;
class UFixItPlayerDataBase;
class UFixItPlayerDataFileItem;
struct FFixItPlatformData;
......@@ -35,12 +34,12 @@ enum class EFixItBackendType : uint8
EFixItBackendType_JIRA UMETA(DisplayName = "JIRA")
};
#if PLATFORM_WINDOWS
// Entry point for lower level issues tracking operations
// Also performs data collection pre-bug creation
class FIXITCORE_API FFixItBackend
{
public:
#if PLATFORM_WINDOWS
FFixItBackend(EFixItBackendType BackendType);
// As we use a TUniquePtr<FForwardDeclaredType> in this class,
// we need to explicitly declare and define the following
......@@ -60,11 +59,12 @@ public:
// Returns true if the login session is being done with the default identifier
bool IsUsingDefaultCredentials() const;
FString GetCreatedBugUrl(const FString& BugId) const;
// Might be null, check for it
const FFixItPlatformData* GetPlatformData() const;
#endif // PLATFORM_WINDOWS
static fixit::BackendType GetMatchingBackendType(EFixItBackendType BackendType);
private:
TUniquePtr<fixit::Backend> BackendImpl_;
};
#endif
......@@ -10,7 +10,8 @@
#include "Engine/DeveloperSettings.h"
#include "Backend/FixItBackend.h"
// EFixItBackendType
#include "FixItBackend.h"
#include "FixItSettings.generated.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment