Skip to content

Instantly share code, notes, and snippets.

@nevyn
Last active December 26, 2015 22:19
Show Gist options
  • Save nevyn/7222566 to your computer and use it in GitHub Desktop.
Save nevyn/7222566 to your computer and use it in GitHub Desktop.
// Wait for logout, then re-login
[[[loginController waitForLogoutCompletion] chain:^SPTask *(id value) {
return [loginController waitForLoginCompletion];
}] addCallback:^(id value) {
self.view.window.userInteractionEnabled = YES;
[self.introDelegate introFlow:self finishedSuccessfully:YES didMerge:YES];
self.introDelegate = nil;
}];
vs
SPTask *waitForRelog = [loginController waitForLogoutCompletion];
// Then wait for the login to happen.
waitForRelog = [waitForRelog chain:^SPTask *(id value) {
return [loginController waitForLoginCompletion];
} on:dispatch_get_main_queue()];
// When that has happened we have switched user and can continue our flow..
[waitForRelog addCallback:^(id value) {
self.view.window.userInteractionEnabled = YES;
[self.introDelegate introFlow:self finishedSuccessfully:YES didMerge:YES];
self.introDelegate = nil;
} on:dispatch_get_main_queue()];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment