Skip to content

Commit cea68b4

Browse files
committed
fix: Make remote session leasing use title id and environment id instead of game key
1 parent 7873cf3 commit cea68b4

File tree

2 files changed

+76
-19
lines changed

2 files changed

+76
-19
lines changed

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,43 +1454,81 @@ public static void TransferIdentityProvidersBetweenAccounts(string FromPlayerWit
14541454
/// While the process is ongoing, the remoteSessionLeaseStatusUpdate action (if one is provided) will be invoked intermittently (about once a second) to update you on the status of the process.
14551455
/// When the process has come to an end (whether successfully or not), the onComplete action will be invoked with the updated information.
14561456
/// </summary>
1457+
/// <param name="titleId">The Title ID of the game</param>
1458+
/// <param name="environmentId">The Environment ID of the game and environment</param>
14571459
/// <param name="remoteSessionLeaseInformation">Will be invoked once to provide the lease information that the secondary device can use to authenticate</param>
14581460
/// <param name="remoteSessionLeaseStatusUpdate">Will be invoked intermittently to update the status lease process</param>
14591461
/// <param name="onComplete">Invoked when the remote session process has run to completion containing either a valid session or information on why the process failed</param>
14601462
/// <param name="pollingIntervalSeconds">Optional: How often to poll the status of the remote session process</param>
1461-
/// <param name="timeOutAfterMinutes">Optional: How long to allow the process to take in it's entirety</param>
1462-
public static Guid StartRemoteSession(Action<LootLockerLeaseRemoteSessionResponse> remoteSessionLeaseInformation, Action<LootLockerRemoteSessionStatusPollingResponse> remoteSessionLeaseStatusUpdate, Action<LootLockerStartRemoteSessionResponse> onComplete, float pollingIntervalSeconds = 1.0f, float timeOutAfterMinutes = 5.0f)
1463+
/// <param name="timeOutAfterMinutes">Optional: How long to allow the process to take in its entirety</param>
1464+
public static Guid StartRemoteSession(
1465+
string titleId,
1466+
string environmentId,
1467+
Action<LootLockerLeaseRemoteSessionResponse> remoteSessionLeaseInformation,
1468+
Action<LootLockerRemoteSessionStatusPollingResponse> remoteSessionLeaseStatusUpdate,
1469+
Action<LootLockerStartRemoteSessionResponse> onComplete,
1470+
float pollingIntervalSeconds = 1.0f,
1471+
float timeOutAfterMinutes = 5.0f)
14631472
{
14641473
if (!CheckInitialized(true))
14651474
{
14661475
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerStartRemoteSessionResponse>(null));
14671476
return Guid.Empty;
14681477
}
14691478

1470-
return LootLockerAPIManager.RemoteSessionPoller.StartRemoteSessionWithContinualPolling(LootLockerRemoteSessionLeaseIntent.login, remoteSessionLeaseInformation, remoteSessionLeaseStatusUpdate, onComplete, pollingIntervalSeconds, timeOutAfterMinutes);
1479+
return LootLockerAPIManager.RemoteSessionPoller.StartRemoteSessionWithContinualPolling(
1480+
LootLockerRemoteSessionLeaseIntent.login,
1481+
titleId,
1482+
environmentId,
1483+
remoteSessionLeaseInformation,
1484+
remoteSessionLeaseStatusUpdate,
1485+
onComplete,
1486+
pollingIntervalSeconds,
1487+
timeOutAfterMinutes
1488+
);
14711489
}
14721490

14731491
/// <summary>
1474-
/// Start a remote session
1475-
/// If you want to let your local user sign in using another device then you use this method.First you will get the lease information needed to allow a secondary device to authenticate.
1492+
/// Start a remote session for linking
1493+
/// If you want to let your local user sign in using another device then you use this method. First you will get the lease information needed to allow a secondary device to authenticate.
14761494
/// While the process is ongoing, the remoteSessionLeaseStatusUpdate action (if one is provided) will be invoked intermittently (about once a second) to update you on the status of the process.
1477-
/// When the process has come to an end(whether successfully or not), the onComplete action will be invoked with the updated information.
1495+
/// When the process has come to an end (whether successfully or not), the onComplete action will be invoked with the updated information.
14781496
/// </summary>
1479-
/// <param name="forPlayerWithUlid">Execute the request for the specified player (the player that you intend to link the remote account into</param>
1497+
/// <param name="titleId">The Title ID of the game</param>
1498+
/// <param name="environmentId">The Environment ID of the game and environment</param>
1499+
/// <param name="forPlayerWithUlid">Execute the request for the specified player (the player that you intend to link the remote account into)</param>
14801500
/// <param name="remoteSessionLeaseInformation">Will be invoked once to provide the lease information that the secondary device can use to authenticate</param>
14811501
/// <param name="remoteSessionLeaseStatusUpdate">Will be invoked intermittently to update the status lease process</param>
14821502
/// <param name="onComplete">Invoked when the remote session process has run to completion containing either a valid session or information on why the process failed</param>
14831503
/// <param name="pollingIntervalSeconds">Optional: How often to poll the status of the remote session process</param>
14841504
/// <param name="timeOutAfterMinutes">Optional: How long to allow the process to take in its entirety</param>
1485-
public static Guid StartRemoteSessionForLinking(string forPlayerWithUlid, Action<LootLockerLeaseRemoteSessionResponse> remoteSessionLeaseInformation, Action<LootLockerRemoteSessionStatusPollingResponse> remoteSessionLeaseStatusUpdate, Action<LootLockerStartRemoteSessionResponse> onComplete, float pollingIntervalSeconds = 1.0f, float timeOutAfterMinutes = 5.0f)
1505+
public static Guid StartRemoteSessionForLinking(
1506+
string titleId,
1507+
string environmentId,
1508+
string forPlayerWithUlid,
1509+
Action<LootLockerLeaseRemoteSessionResponse> remoteSessionLeaseInformation,
1510+
Action<LootLockerRemoteSessionStatusPollingResponse> remoteSessionLeaseStatusUpdate,
1511+
Action<LootLockerStartRemoteSessionResponse> onComplete,
1512+
float pollingIntervalSeconds = 1.0f,
1513+
float timeOutAfterMinutes = 5.0f)
14861514
{
14871515
if (!CheckInitialized())
14881516
{
14891517
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerStartRemoteSessionResponse>(forPlayerWithUlid));
14901518
return Guid.Empty;
14911519
}
14921520

1493-
return LootLockerAPIManager.RemoteSessionPoller.StartRemoteSessionWithContinualPolling(LootLockerRemoteSessionLeaseIntent.link, remoteSessionLeaseInformation, remoteSessionLeaseStatusUpdate, onComplete, pollingIntervalSeconds, timeOutAfterMinutes, forPlayerWithUlid);
1521+
return LootLockerAPIManager.RemoteSessionPoller.StartRemoteSessionWithContinualPolling(
1522+
LootLockerRemoteSessionLeaseIntent.link,
1523+
titleId,
1524+
environmentId,
1525+
remoteSessionLeaseInformation,
1526+
remoteSessionLeaseStatusUpdate,
1527+
onComplete,
1528+
pollingIntervalSeconds,
1529+
timeOutAfterMinutes,
1530+
forPlayerWithUlid
1531+
);
14941532
}
14951533

14961534
/// <summary>
@@ -1543,7 +1581,7 @@ public static void RefreshRemoteSession(string refreshToken, Action<LootLockerRe
15431581

15441582
LootLockerServerRequest.CallAPI(null,
15451583
LootLockerEndPoints.startRemoteSession.endPoint, LootLockerEndPoints.startRemoteSession.httpMethod,
1546-
LootLockerJson.SerializeObject(new LootLockerRefreshRemoteSessionRequest( refreshToken)),
1584+
LootLockerJson.SerializeObject(new LootLockerRefreshRemoteSessionRequest(refreshToken)),
15471585
(LootLockerResponse serverResponse) =>
15481586
{
15491587
var response = LootLockerResponse.Deserialize<LootLockerRefreshRemoteSessionResponse>(serverResponse);

Runtime/Game/Requests/RemoteSessionRequest.cs

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,24 @@ namespace LootLocker.Requests
4444
public class LootLockerLeaseRemoteSessionRequest
4545
{
4646
/// <summary>
47-
/// The Game Key configured for the game
47+
/// The Title ID of the game
4848
/// </summary>
49-
public string game_key { get; set; } = LootLockerConfig.current.apiKey;
49+
public string title_id { get; set; }
50+
/// <summary>
51+
/// The Environment ID of the game and environment
52+
/// </summary>
53+
public string environment_id { get; set; }
5054
/// <summary>
5155
/// The Game Version configured for the game
5256
/// </summary>
53-
public string game_version { get; set; } = LootLockerConfig.current.game_version;
57+
public string game_version { get; set; }
58+
59+
public LootLockerLeaseRemoteSessionRequest(string titleId, string environmentId)
60+
{
61+
title_id = titleId;
62+
environment_id = environmentId;
63+
game_version = LootLockerConfig.current.game_version;
64+
}
5465
}
5566

5667
/// <summary>
@@ -218,14 +229,16 @@ static void OnEnterPlaymodeInEditor(EnterPlayModeOptions options)
218229
#region Public Methods
219230
public static Guid StartRemoteSessionWithContinualPolling(
220231
LootLockerRemoteSessionLeaseIntent leaseIntent,
232+
string titleId,
233+
string environmentId,
221234
Action<LootLockerLeaseRemoteSessionResponse> remoteSessionLeaseInformation,
222235
Action<LootLockerRemoteSessionStatusPollingResponse> remoteSessionLeaseStatusUpdateCallback,
223236
Action<LootLockerStartRemoteSessionResponse> remoteSessionCompleted,
224237
float pollingIntervalSeconds = 1.0f,
225238
float timeOutAfterMinutes = 5.0f,
226239
string forPlayerWithUlid = null)
227240
{
228-
return GetInstance()._StartRemoteSessionWithContinualPolling(leaseIntent, remoteSessionLeaseInformation,
241+
return GetInstance()._StartRemoteSessionWithContinualPolling(leaseIntent, titleId, environmentId, remoteSessionLeaseInformation,
229242
remoteSessionLeaseStatusUpdateCallback, remoteSessionCompleted, pollingIntervalSeconds,
230243
timeOutAfterMinutes, forPlayerWithUlid);
231244
}
@@ -355,12 +368,15 @@ protected IEnumerator ContinualPollingAction(Guid processGuid)
355368
}
356369
}
357370

358-
private Guid _StartRemoteSessionWithContinualPolling(LootLockerRemoteSessionLeaseIntent leaseIntent,
371+
private Guid _StartRemoteSessionWithContinualPolling(
372+
LootLockerRemoteSessionLeaseIntent leaseIntent,
373+
string titleId,
374+
string environmentId,
359375
Action<LootLockerLeaseRemoteSessionResponse> remoteSessionLeaseInformation,
360376
Action<LootLockerRemoteSessionStatusPollingResponse> remoteSessionLeaseStatusUpdateCallback,
361377
Action<LootLockerStartRemoteSessionResponse> remoteSessionCompleted,
362378
float pollingIntervalSeconds = 1.0f,
363-
float timeOutAfterMinutes = 5.0f,
379+
float timeOutAfterMinutes = 5.0f,
364380
string forPlayerWithUlid = null)
365381
{
366382
if (_remoteSessionsProcesses.Count > 0)
@@ -384,7 +400,7 @@ private Guid _StartRemoteSessionWithContinualPolling(LootLockerRemoteSessionLeas
384400
};
385401
AddRemoteSessionProcess(processGuid, lootLockerRemoteSessionProcess);
386402

387-
LeaseRemoteSession(leaseIntent, forPlayerWithUlid, leaseRemoteSessionResponse =>
403+
LeaseRemoteSession(leaseIntent, titleId, environmentId, forPlayerWithUlid, leaseRemoteSessionResponse =>
388404
{
389405
if (!_remoteSessionsProcesses.TryGetValue(processGuid, out var process))
390406
{
@@ -415,12 +431,15 @@ private void _CancelRemoteSessionProcess(Guid processGuid)
415431
}
416432
}
417433

418-
private void LeaseRemoteSession(LootLockerRemoteSessionLeaseIntent leaseIntent,
434+
private void LeaseRemoteSession(
435+
LootLockerRemoteSessionLeaseIntent leaseIntent,
436+
string titleId,
437+
string environmentId,
419438
string forPlayerWithUlid,
420439
Action<LootLockerLeaseRemoteSessionResponse> onComplete)
421440
{
422441
LootLockerLeaseRemoteSessionRequest leaseRemoteSessionRequest =
423-
new LootLockerLeaseRemoteSessionRequest();
442+
new LootLockerLeaseRemoteSessionRequest(titleId, environmentId);
424443

425444
EndPointClass endPoint = leaseIntent == LootLockerRemoteSessionLeaseIntent.login ? LootLockerEndPoints.leaseRemoteSession : LootLockerEndPoints.leaseRemoteSessionForLinking;
426445
LootLockerServerRequest.CallAPI(forPlayerWithUlid, endPoint.endPoint,

0 commit comments

Comments
 (0)