Skip to content
Merged
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
6 changes: 2 additions & 4 deletions Assets/Talo Game Services/Talo/Runtime/APIs/PlayerAuthAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ public async Task Logout()
var uri = new Uri($"{baseUrl}/logout");
await Call(uri, "POST");

_sessionManager.ClearSession();
Talo.CurrentAlias = null;
await _sessionManager.ClearSession();
}

public async Task ChangePassword(string currentPassword, string newPassword)
Expand Down Expand Up @@ -136,8 +135,7 @@ public async Task DeleteAccount(string currentPassword)
});
await Call(uri, "DELETE", content);

_sessionManager.ClearSession();
Talo.CurrentAlias = null;
await _sessionManager.ClearSession();
}
}
}
1 change: 1 addition & 0 deletions Assets/Talo Game Services/Talo/Runtime/APIs/PlayersAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public async Task<Player> Identify(string service, string identifier)
var json = await Call(uri, "GET");

var res = JsonUtility.FromJson<PlayersIdentifyResponse>(json);
await Talo.Socket.ResetConnection();

Talo.CurrentAlias = res.alias;
Talo.Socket.SetSocketToken(res.socketToken);
Expand Down
13 changes: 13 additions & 0 deletions Assets/Talo Game Services/Talo/Runtime/TaloSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,18 @@ public void SetSocketToken(string token)
IdentifyPlayer();
}
}

public async Task ResetConnection()
{
if (!identified)
{
return;
}

CloseConnection();
socketAuthenticated = false;
identified = false;
await OpenConnection();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEngine;
using System.Threading.Tasks;
using UnityEngine;

namespace TaloGameServices
{
Expand All @@ -20,9 +21,11 @@ private void SaveSession(string sessionToken)
PlayerPrefs.SetString("TaloSessionIdentifier", Talo.CurrentAlias.identifier);
}

public void ClearSession()
public async Task ClearSession()
{
Talo.CurrentAlias = null;
PlayerPrefs.DeleteKey("TaloSessionToken");
await Talo.Socket.ResetConnection();
}

public string GetSessionToken()
Expand Down