Skip to content

Commit

Permalink
Get AndroidClient.SignOut method on the main thread.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 309932650
Change-Id: I63e742543bca6535d1ebe08ccb36f106726f8119
  • Loading branch information
ozdemir08 authored and copybara-github committed May 5, 2020
1 parent 75454b3 commit b5a2ab5
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,19 @@ private static Action<T> AsOnGameThreadCallback<T>(Action<T> callback)
return result => InvokeCallbackOnGameThread(callback, result);
}

private static void InvokeCallbackOnGameThread(Action callback)
{
if (callback == null)
{
return;
}

PlayGamesHelperObject.RunOnGameThread(() =>
{
callback();
});
}

private static void InvokeCallbackOnGameThread<T>(Action<T> callback, T data)
{
if (callback == null)
Expand Down Expand Up @@ -444,6 +457,7 @@ public void SignOut(Action uiCallback)
{
if (mTokenClient == null)
{
InvokeCallbackOnGameThread(uiCallback);
return;
}

Expand All @@ -462,7 +476,7 @@ public void SignOut(Action uiCallback)
mAuthState = AuthState.Unauthenticated;
if (uiCallback != null)
{
uiCallback();
InvokeCallbackOnGameThread(uiCallback);
}
});
}
Expand All @@ -473,11 +487,11 @@ public void SignOut(Action uiCallback)
mAuthState = AuthState.Unauthenticated;
if (uiCallback != null)
{
uiCallback();
InvokeCallbackOnGameThread(uiCallback);
}
}

SignInHelper.SetPromptUiSignIn(true);
PlayGamesHelperObject.RunOnGameThread(() => SignInHelper.SetPromptUiSignIn(true));
}

///<summary></summary>
Expand Down

0 comments on commit b5a2ab5

Please sign in to comment.