Blocking Connect
black-snow opened this issue · 5 comments
Can you add a blocking version of LiveAuthClient.login(), LiveAuthClient.initialize() and LiveAuthClient.logout()? I'd like to avoid the hassle w/ manual locking.
I'm not sure I understand your scenario about manual locking being a hassle? Being that login/initialization are UI driven tasks you should be using the async callbacks to handle your execution flow. Is there a reason that you can't use the kinds of flows provided in the samples?
I don't have an activity that's guaranteed to run before I need to access the LiveConnectClient. Thus I'm creating the auth/init in some background thread. Sadly atm this SDK doesn't fit right into my framework as my other adapters (dropbox, gdrive, ...) all have blocking connects.
Is init UI-driven? I do the following in the background:
LiveAuthClient auth = new LiveAuthClient(...);
auth.initialize(new LiveAuthListener(){ ... });
This seems to work fine. But sadly I can't tell when auth.initialize()
has finished.
Let me give you a short insight on what I'm doing:
There's a sign-in Activity where the user signs in once. Then, in the background I query the file list of a folder ever now and then. When the user/system kills the app and comes back later he still needs to be signed in (I guessed this works by utilizing initialize()
instead of login()
).
(btw, thanks for the quick reply!)
This seems like a scenario that could be handled by checking the LiveAuthClient to see its state before you attempt to query the folder
Yeah, but I'd need to wait for the state to change to connected. It'd be handy to have this functionality within the sdk.
I'm happy to look into pull requests for this behavior; however, this will not be a feature that we add to this sdk.