7
7
8
8
namespace LootLocker
9
9
{
10
- /// <summary>
11
- /// made for user, relay on playtime coroutines
12
- /// </summary>
13
10
public class LootLockerGameServerAPI : LootLockerBaseServerAPI
14
11
{
15
12
public new static LootLockerGameServerAPI I ;
@@ -28,9 +25,22 @@ public static void Init(LootLockerServerManager serverManager)
28
25
29
26
protected override void RefreshTokenAndCompleteCall ( LootLockerServerRequest cacheServerRequest , Action < LootLockerResponse > OnServerResponse )
30
27
{
31
- if ( LootLockerConfig . current . platform == LootLockerConfig . platformType . Steam )
28
+ string platform = LootLockerSDKManager . GetCurrentPlatform ( ) ;
29
+
30
+ if ( platform == Platforms . Steam )
31
+ {
32
+ LootLockerSDKManager . DebugMessage ( "Token has expired and token refresh is not supported for Steam" , true ) ;
33
+ LootLockerResponse res = new LootLockerResponse ( ) ;
34
+ res . statusCode = 401 ;
35
+ res . Error = "Token Expired" ;
36
+ res . hasError = true ;
37
+ OnServerResponse ? . Invoke ( res ) ;
38
+ return ;
39
+ }
40
+
41
+ if ( platform == Platforms . NintendoSwitch )
32
42
{
33
- LootLockerSDKManager . DebugMessage ( "Token has expired, And token refresh not supported in Steam calls " , true ) ;
43
+ LootLockerSDKManager . DebugMessage ( "Token has expired and token refresh is not supported for Nintendo Switch " , true ) ;
34
44
LootLockerResponse res = new LootLockerResponse ( ) ;
35
45
res . statusCode = 401 ;
36
46
res . Error = "Token Expired" ;
@@ -39,9 +49,30 @@ protected override void RefreshTokenAndCompleteCall(LootLockerServerRequest cach
39
49
return ;
40
50
}
41
51
42
- var sessionRequest = new LootLockerSessionRequest ( LootLockerConfig . current . deviceID ) ;
52
+ if ( platform == Platforms . Guest )
53
+ {
54
+ LootLockerSDKManager . StartGuestSession ( response =>
55
+ {
56
+ CompleteCall ( cacheServerRequest , OnServerResponse , response ) ;
57
+ } ) ;
58
+ return ;
59
+ } else if ( platform == Platforms . WhiteLabel )
60
+ {
61
+ LootLockerSDKManager . StartWhiteLabelSession ( response =>
62
+ {
63
+ CompleteCall ( cacheServerRequest , OnServerResponse , response ) ;
64
+ } ) ;
43
65
44
- LootLockerAPIManager . Session ( sessionRequest , ( response ) =>
66
+ return ;
67
+ } else {
68
+ var sessionRequest = new LootLockerSessionRequest ( LootLockerConfig . current . deviceID ) ;
69
+ LootLockerAPIManager . Session ( sessionRequest , ( response ) =>
70
+ {
71
+ CompleteCall ( cacheServerRequest , OnServerResponse , response ) ;
72
+ } ) ;
73
+ }
74
+
75
+ void CompleteCall ( LootLockerServerRequest cacheServerRequest , Action < LootLockerResponse > OnServerResponse , LootLockerSessionResponse response )
45
76
{
46
77
if ( response . success )
47
78
{
@@ -72,7 +103,7 @@ protected override void RefreshTokenAndCompleteCall(LootLockerServerRequest cach
72
103
res . hasError = true ;
73
104
OnServerResponse ? . Invoke ( res ) ;
74
105
}
75
- } ) ;
106
+ }
76
107
}
77
108
}
78
109
}
0 commit comments