Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Changed Result in ApplyURL from UVaRestJsonObject to UVaRestRequestJSON #351

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions Source/VaRest/Private/VaRestRequestJSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ void UVaRestRequestJSON::ProcessURL(const FString& Url)
ProcessRequest();
}

void UVaRestRequestJSON::ApplyURL(const FString& Url, UVaRestJsonObject*& Result, UObject* WorldContextObject, FLatentActionInfo LatentInfo)
void UVaRestRequestJSON::ApplyURL(const FString& Url, UVaRestRequestJSON*& Result, UObject* WorldContextObject, FLatentActionInfo LatentInfo)
{
// Be sure to trim URL because it can break links on iOS
FString TrimmedUrl = Url;
Expand All @@ -262,15 +262,15 @@ void UVaRestRequestJSON::ApplyURL(const FString& Url, UVaRestJsonObject*& Result
if (UWorld* World = GEngine->GetWorldFromContextObjectChecked(WorldContextObject))
{
FLatentActionManager& LatentActionManager = World->GetLatentActionManager();
FVaRestLatentAction<UVaRestJsonObject*>* Kont = LatentActionManager.FindExistingAction<FVaRestLatentAction<UVaRestJsonObject*>>(LatentInfo.CallbackTarget, LatentInfo.UUID);
FVaRestLatentAction<UVaRestRequestJSON*>* Kont = LatentActionManager.FindExistingAction<FVaRestLatentAction<UVaRestRequestJSON*>>(LatentInfo.CallbackTarget, LatentInfo.UUID);

if (Kont != nullptr)
{
Kont->Cancel();
LatentActionManager.RemoveActionsForObject(LatentInfo.CallbackTarget);
}

LatentActionManager.AddNewAction(LatentInfo.CallbackTarget, LatentInfo.UUID, ContinueAction = new FVaRestLatentAction<UVaRestJsonObject*>(this, Result, LatentInfo));
LatentActionManager.AddNewAction(LatentInfo.CallbackTarget, LatentInfo.UUID, ContinueAction = new FVaRestLatentAction<UVaRestRequestJSON*>(this, Result, LatentInfo));
}

ProcessRequest();
Expand Down Expand Up @@ -548,10 +548,10 @@ void UVaRestRequestJSON::OnProcessRequestComplete(FHttpRequestPtr Request, FHttp
// Finish the latent action
if (ContinueAction)
{
FVaRestLatentAction<UVaRestJsonObject*>* K = ContinueAction;
FVaRestLatentAction<UVaRestRequestJSON*>* K = ContinueAction;
ContinueAction = nullptr;

K->Call(ResponseJsonObj);
K->Call(this);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Source/VaRest/Public/VaRestRequestJSON.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class VAREST_API UVaRestRequestJSON : public UObject

/** Open URL in latent mode */
UFUNCTION(BlueprintCallable, Category = "VaRest|Request", meta = (Latent, LatentInfo = "LatentInfo", HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject"))
virtual void ApplyURL(const FString& Url, UVaRestJsonObject*& Result, UObject* WorldContextObject, struct FLatentActionInfo LatentInfo);
virtual void ApplyURL(const FString& Url, UVaRestRequestJSON*& Result, UObject* WorldContextObject, struct FLatentActionInfo LatentInfo);

/** Check URL and execute process request */
UFUNCTION(BlueprintCallable, Category = "VaRest|Request")
Expand Down Expand Up @@ -289,7 +289,7 @@ class VAREST_API UVaRestRequestJSON : public UObject

protected:
/** Latent action helper */
FVaRestLatentAction<UVaRestJsonObject*>* ContinueAction;
FVaRestLatentAction<UVaRestRequestJSON*>* ContinueAction;

/** Internal request data stored as JSON */
UPROPERTY()
Expand Down