Closed RandomShaper closed 4 years ago
Yes this functionality was present in the previous version, but I have not included it in the new one as there were some feedback from other users that it is useless. But definitely I think that it should be added back :+1: . There is one requirement for this PR, could you please also make it synchronous too? I mean to return the value directly, not sending it using a callback. Something like this:
fun isSignedIn(): Boolean {
return signInController.isSignedIn()
}
and then in signInController check if it is signed in :
fun isSignedIn(): Boolean {
val googleSignInAccount = GoogleSignIn.getLastSignedInAccount(activity)
return connectionController.isConnected().first && googleSignInAccount != null
}
and don't forget to add function name in getPluginMethods
Thank you
Synchronous would indeed be much more convenient, but I wasn't sure you can call methods in GoogleSignIn
from outside the UI thread. Can you confirm that's a no issue?
Synchronous would indeed be much more convenient, but I wasn't sure you can call methods in
GoogleSignIn
from outside the UI thread. Can you confirm that's a no issue?
Indeed it could be an issue, but not 100% sure. I was testing it before and it was working. But anyway you could do it in next way:
fun isSignedIn(): Boolean {
val futureTask = FutureTask<Boolean>(Callable<Boolean> {
signInController.isSignedIn()
})
runOnUiThread(futureTask)
return futureTask.get()
}
I've tried that, but some kind of deadlock happens when the game is paused to go to the background.
I've finally added and tested your initial suggestion and it works just fine.
I've tried that, but some kind of deadlock happens when the game is paused to go to the background.
I've finally added and tested your initial suggestion and it works just fine.
👍
I think the old version of this plugin already had something similar.
Since there's no way for the Google auth API to notify that the user has logged out (unless they has initiated the sign out explicitly), a game has no way to easily check if the user has logged out. For instance, say the user opens the achievements UI and logs out from there.
One option would be handle the failed callback of the next action, but this is much more ergonomic. A game can use it in the
NOTIFICATION_WM_FOCUS_IN
to check if the user has somehow logged out while the game wasn't in the foreground.