Remote Lease Implementation

Remote Sessions

Start Remote Session

As this function requires three separate callbacks, it is easier to manage them as following:

public void RemoteLease()
{
    LootLockerSDKManager.StartRemoteSession(leaseAction, pollingAction, onComplete);
}

Action<LootLockerLeaseRemoteSessionResponse> leaseAction = (info) => 
{
    if (!info.success)
    {
        Debug.Log("Couldnt start Remote leasing");
        return;
    }
};
Action<LootLockerRemoteSessionStatusPollingResponse> pollingAction = (polling) => 
{
    if(!polling.success)
    {
        Debug.Log("Couldnt poll Remote leasing");
        return;
    }
};
Action<LootLockerStartRemoteSessionResponse> onComplete = (onComplete) =>
{
    if (!onComplete.success)
    {
        Debug.Log("Couldnt start Remote leasing");
        return;
    }
};

Cancel a Lease Process

LootLockerSDKManager.StartRemoteSession returns a Guid which you can later use to cancel the remote session start process.

public void RemoteLease()
{
    var leasedGuid =  LootLockerSDKManager.StartRemoteSession(leaseAction, pollingAction, onComplete);
    LootLockerSDKManager.CancelRemoteSessionProcess(leasedGuid);
}

Refresh Lease Session

LootLockerSDKManager.RefreshRemoteSession((onComplete) => 
{ 
    if(!onComplete.success)
    {
        Debug.Log("Couldnt refresh remote session!");
        return;
    }
});

With manually stored refresh token:

string refreshToken = "";
LootLockerSDKManager.RefreshRemoteSession(refreshToken, (onComplete) => 
{ 
    if(!onComplete.success)
    {
        Debug.Log("Couldnt refresh remote session!");
        return;
    }
});

Last updated