Files
UnrealEngineUWP/Engine/Source/Editor/PluginWarden/Private/PluginWardenModule.h
ryan durand 627baf970a Updating copyright for Engine Editor.
#rnx
#rb none


#ROBOMERGE-SOURCE: CL 10869241 via CL 10869527 via CL 10869904
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870586 by ryan durand in Main branch]
2019-12-26 15:33:43 -05:00

55 lines
2.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "IPluginWardenModule.h"
DECLARE_LOG_CATEGORY_EXTERN(PluginWarden, Log, All);
/**
* The Plugin Warden is a simple module used to verify a user has purchased a plug-in. This
* module won't prevent a determined user from avoiding paying for a plug-in, it is merely to
* prevent accidental violation of a per-seat license on a plug-in, and to direct those users
* to the marketplace page where they may purchase the plug-in.
*/
class FPluginWardenModule : public IPluginWardenModule
{
public:
/**
* Called right after the module DLL has been loaded and the module object has been created
*/
virtual void StartupModule();
/**
* Called before the module is unloaded, right before the module object is destroyed.
*/
virtual void ShutdownModule();
/**
* Ask the launcher if the user has authorization to use the given plug-in. The authorized
* callback will only be called if the user is authorized to use the plug-in.
*
* FPluginWardenModule& PluginWarden = FModuleManager::LoadModuleChecked<FPluginWardenModule>("PluginWarden");
* PluginWarden.CheckEntitlementForPlugin(LOCTEXT("AwesomePluginName", "My Awesome Plugin"), TEXT("PLUGIN_MARKETPLACE_GUID"), [&] () {
* // Authorized Code Here
* });
*
* @param PluginFriendlyName The localized friendly name of the plug-in.
* @param PluginItemId The unique identifier of the item plug-in on the marketplace.
* @param PluginOfferId The unique identifier of the offer for the plug-in on the marketplace.
* @param CacheLevel Where to check for the entitlements. Defaults to memory.
* @param UnauthorizedMessageOverride The error message to display for unauthorized plugins, overriding the default message if not empty.
* @param UnauthorizedErrorHandling How to handle the unauthorized error.
* @param AuthorizedCallback This function will be called after the user has been given entitlement.
*/
virtual void CheckEntitlementForPlugin(const FText& PluginFriendlyName, const FString& PluginItemId, const FString& PluginOfferId, const EEntitlementCacheLevelRequest CacheLevel,
const FText& UnauthorizedMessageOverride, EUnauthorizedErrorHandling UnauthorizedErrorHandling, TFunction<void()> AuthorizedCallback) override;
virtual void CheckEntitlementForPlugin(const FText& PluginFriendlyName, const FString& PluginItemId, const FString& PluginOfferId,
const FText& UnauthorizedMessageOverride, EUnauthorizedErrorHandling UnauthorizedErrorHandling, TFunction<void()> AuthorizedCallback) override;
private:
bool RunAuthorizationPipeline(const FText& PluginFriendlyName, const FString& PluginItemId, const FString& PluginOfferId, const EEntitlementCacheLevelRequest CacheLevel);
};