1
This commit is contained in:
@@ -143,8 +143,17 @@ static NSString * const kKBSessionInstallFlagKey = @"KBSession.installInitialize
|
||||
}
|
||||
|
||||
- (void)_onAuthChanged:(NSNotification *)note {
|
||||
// 避免在 KBAuthManager 的 +shared 初始化过程中再次调用 +shared 造成递归,
|
||||
// 这里直接使用通知携带的实例。
|
||||
KBAuthManager *auth = nil;
|
||||
if ([note.object isKindOfClass:[KBAuthManager class]]) {
|
||||
auth = (KBAuthManager *)note.object;
|
||||
} else {
|
||||
auth = [KBAuthManager shared];
|
||||
}
|
||||
|
||||
// 如果 token 被别处清掉了,这里同步清一下 currentUser
|
||||
if (![[KBAuthManager shared] isLoggedIn]) {
|
||||
if (![auth isLoggedIn]) {
|
||||
self.currentUser = nil;
|
||||
[self.defaults removeObjectForKey:kKBSessionUserStoreKey];
|
||||
[self.defaults synchronize];
|
||||
@@ -152,4 +161,3 @@ static NSString * const kKBSessionInstallFlagKey = @"KBSession.installInitialize
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user