Fix some bugs caused by order of operations.
This commit is contained in:
@@ -112,16 +112,17 @@ public class AccountManager
|
|||||||
|
|
||||||
public async Task LogoutAsync()
|
public async Task LogoutAsync()
|
||||||
{
|
{
|
||||||
await accountState.SetUser(null);
|
|
||||||
var platform = await localStorage.GetAccountPlatform();
|
var platform = await localStorage.GetAccountPlatform();
|
||||||
await localStorage.DeleteAccountPlatform();
|
await localStorage.DeleteAccountPlatform();
|
||||||
|
|
||||||
if (platform == WhichAccountPlatform.Guest)
|
if (platform == WhichAccountPlatform.Guest)
|
||||||
{
|
{
|
||||||
await shogiApi.GuestLogout();
|
await shogiApi.GuestLogout();
|
||||||
|
await accountState.SetUser(null);
|
||||||
}
|
}
|
||||||
else if (platform == WhichAccountPlatform.Microsoft)
|
else if (platform == WhichAccountPlatform.Microsoft)
|
||||||
{
|
{
|
||||||
|
await accountState.SetUser(null);
|
||||||
navigation.NavigateToLogout("authentication/logout");
|
navigation.NavigateToLogout("authentication/logout");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,14 @@ public class ShogiSocket : IDisposable
|
|||||||
|
|
||||||
public async Task OpenAsync(string token)
|
public async Task OpenAsync(string token)
|
||||||
{
|
{
|
||||||
uriBuilder.Query = new QueryBuilder
|
if (this.socket.State == WebSocketState.Open)
|
||||||
{
|
{
|
||||||
{ "token", token }
|
await this.socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Closing before opening a new connection.", CancellationToken.None);
|
||||||
}.ToQueryString().Value;
|
}
|
||||||
|
|
||||||
|
uriBuilder.Query = new QueryBuilder { { "token", token } }.ToQueryString().Value;
|
||||||
|
|
||||||
|
Console.WriteLine("ShogiSocket.OpenAsync socket state is {0}", this.socket.State.ToString());
|
||||||
|
|
||||||
await socket.ConnectAsync(this.uriBuilder.Uri, cancelToken.Token);
|
await socket.ConnectAsync(this.uriBuilder.Uri, cancelToken.Token);
|
||||||
// Fire and forget! I'm way too lazy to write my own javascript interop to a web worker. Nooo thanks.
|
// Fire and forget! I'm way too lazy to write my own javascript interop to a web worker. Nooo thanks.
|
||||||
@@ -102,8 +106,8 @@ public class ShogiSocket : IDisposable
|
|||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
|
//socket.Dispose(); // This is handled by the DI container.
|
||||||
cancelToken.Cancel();
|
cancelToken.Cancel();
|
||||||
socket.Dispose();
|
|
||||||
memoryOwner.Dispose();
|
memoryOwner.Dispose();
|
||||||
}
|
}
|
||||||
disposedValue = true;
|
disposedValue = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user