Skip to content

Commit

Permalink
Updated from pipeline, Version : 6.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AccelByte-Build committed Sep 27, 2021
1 parent 2437329 commit 845c884
Show file tree
Hide file tree
Showing 25 changed files with 1,268 additions and 97 deletions.
Binary file modified AccelByteUe4Sdk.uplugin
Binary file not shown.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [6.1.0](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/branches/compare/6.1.0%0D6.0.1) (2021-09-27)


### Features

* **ecommerce:** add epicgames entitlement on SyncPlatformPurchase ([b78d9a5](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/b78d9a59e6c79c6d8b334b7e966457bfd647e481))
* **ecommerce:** add Media Item type ([f17b815](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/f17b815e8ee7312cf67168c0dc46b4b808ed0b0e))
* **lobby:** add lobby ws request error handler and error message ([0eabf1d](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/0eabf1d2d77004789d6b83e93c274ff73449dca0))
* **misc:** add GetServerCurrentTime ([c3afc90](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/c3afc9072a27e2ffaac704f06159a13e23a7de35))
* **shadowban:** Add refresh token when token revoked. Pause task and resume after new token retrieved ([e16d45a](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/e16d45a62971b8a8fcf8c3401a455f31de51202d))
* **Version:** Ensure version is compatible ([41b9b73](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/41b9b73d53bf6899a9be1822276f9b9c0e913894))


### Tests

* **agreement:** revision ([e481ab0](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/e481ab0d3d1c35e056500c815317f265bca6b4f3))

### [6.0.1](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/branches/compare/6.0.1%0D6.0.0) (2021-09-16)


Expand Down
Binary file added Content/CompatibilityMap.json
Binary file not shown.
9 changes: 7 additions & 2 deletions Source/AccelByteUe4Sdk/AccelByteUe4Sdk.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ public AccelByteUe4Sdk(ReadOnlyTargetRules Target) : base(Target)
"WebSockets",
"Networking",
"SSL",
"Icmp"
"Icmp",
});

PrivateDependencyModuleNames.AddRange(new []
{
"Projects"
});

if (Target.bBuildEditor)
{
PrivateDependencyModuleNames.AddRange(new string[]
PrivateDependencyModuleNames.AddRange(new[]
{
"Settings"
});
Expand Down
78 changes: 77 additions & 1 deletion Source/AccelByteUe4Sdk/Private/AccelByteUe4SdkModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#include "CoreUObject.h"
#include "Api/AccelByteGameTelemetryApi.h"
#include "Core/AccelByteReport.h"
#include "Runtime/Core/Public/Containers/Ticker.h"
#include "Core/Version.h"
#include "Interfaces/IPluginManager.h"

#if WITH_EDITOR
#include "ISettingsModule.h"
Expand Down Expand Up @@ -47,6 +48,9 @@ class FAccelByteUe4SdkModule : public IAccelByteUe4SdkModuleInterface
bool LoadSettingsFromConfigUobject();
bool LoadServerSettingsFromConfigUobject();
void NullCheckConfig(FString value, FString configField);
static FVersion GetPluginVersion();
void GetVersionInfo(FString const& Url, TFunction<void(FVersionInfo)> Callback) const;
void CheckServicesCompatibility() const;
};

void FAccelByteUe4SdkModule::StartupModule()
Expand All @@ -58,10 +62,12 @@ void FAccelByteUe4SdkModule::StartupModule()
FModuleManager::Get().LoadModuleChecked("Websockets");
FModuleManager::Get().LoadModuleChecked("Json");
FModuleManager::Get().LoadModuleChecked("JsonUtilities");
FModuleManager::Get().LoadModuleChecked("Projects");

RegisterSettings();
LoadSettingsFromConfigUobject();
LoadServerSettingsFromConfigUobject();
CheckServicesCompatibility();

FRegistry::HttpRetryScheduler.Startup();
FRegistry::Credentials.Startup();
Expand Down Expand Up @@ -197,4 +203,74 @@ void FAccelByteUe4SdkModule::NullCheckConfig(FString value, FString configField)
}
}

FVersion FAccelByteUe4SdkModule::GetPluginVersion()
{
FString const PluginName = "AccelByteUe4Sdk";

TSharedPtr<IPlugin> const Plugin = IPluginManager::Get().FindPlugin("AccelByteUe4Sdk");
const FPluginDescriptor& Descriptor = Plugin->GetDescriptor();

return Descriptor.VersionName;
}

void FAccelByteUe4SdkModule::GetVersionInfo(FString const& Url, TFunction<void(FVersionInfo)> Callback) const
{
FHttpRequestPtr const Request = FHttpModule::Get().CreateRequest();
Request->SetVerb("GET");
Request->SetURL(FString::Printf(TEXT("%s/version"), *Url));
Request->OnProcessRequestComplete().BindLambda(
[Callback](FHttpRequestPtr const RequestPtr, FHttpResponsePtr const ResponsePtr, bool const bFinished)
{
if (!bFinished || !ResponsePtr.IsValid())
{
UE_LOG(LogAccelByte, Warning, TEXT("Getting version info failed:%s"), *RequestPtr->GetURL());
return;
}

FString const Content = ResponsePtr->GetContentAsString();

ensureAlwaysMsgf(!Content.IsEmpty(), TEXT("Version info empty: %s"), *RequestPtr->GetURL());

FVersionInfo VersionInfo;
FJsonObjectConverter::JsonObjectStringToUStruct(Content, &VersionInfo, 0, 0);

if (Callback)
{
Callback(VersionInfo);
}
});

Request->ProcessRequest();

}

void FAccelByteUe4SdkModule::CheckServicesCompatibility() const
{
if (GetPluginVersion().Compare(FVersion{TEXT("4.0.0")}) <= 0)
{
return;
}

FString const Path = FPaths::ProjectPluginsDir() / "AccelByteUe4Sdk/Content/CompatibilityMap.json";
FString String;
FFileHelper::LoadFileToString(String, *Path);
auto CompatibilityMapPtr = MakeShared<FServiceCompatibilityMap>(FServiceCompatibilityMap::FromJson(String));

for (auto const& ServiceName : CompatibilityMapPtr->GetServices())
{
if (ServiceName.IsEmpty())
{
return;
}

GetVersionInfo(
FRegistry::Settings.BaseUrl / ServiceName,
[CompatibilityMapPtr, ServiceName](FVersionInfo const VersionInfo)
{
FResult const Result = CompatibilityMapPtr->Check(ServiceName, VersionInfo.Version);
ensureAlwaysMsgf(!Result.bIsError, TEXT("%s"), *Result.Message);
});
}
}

IMPLEMENT_MODULE(FAccelByteUe4SdkModule, AccelByteUe4Sdk)
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,14 @@ void Entitlement::SyncPlatformPurchase(EAccelBytePlatformSync PlatformType, FVoi
case EAccelBytePlatformSync::PLAYSTATION:
PlatformText = TEXT("psn");
break;
case EAccelBytePlatformSync::EPIC_GAMES:
PlatformText = TEXT("epicgames");
if (platformUserId.IsEmpty())
{
OnError.ExecuteIfBound(static_cast<int32>(ErrorCodes::IsNotLoggedIn), TEXT("User not logged in with 3rd Party Platform"));
return;
}
break;
default:
OnError.ExecuteIfBound(static_cast<int32>(ErrorCodes::InvalidRequest), TEXT("Platform Sync Type is not found"));
return;
Expand Down
Loading

0 comments on commit 845c884

Please sign in to comment.