This commit is contained in:
2025-12-03 12:55:51 +08:00
parent 6be90ebb10
commit 27aa723e7d
9 changed files with 120 additions and 65 deletions

View File

@@ -112,7 +112,9 @@ static void KBAuthDarwinCallback(CFNotificationCenterRef center, void *observer,
} @catch (__unused NSException *e) { session = nil; }
}
self.current = session;
[[NSNotificationCenter defaultCenter] postNotificationName:KBAuthChangedNotification object:nil]; //
// object self +shared
[[NSNotificationCenter defaultCenter] postNotificationName:KBAuthChangedNotification
object:self];
}
- (BOOL)saveAccessToken:(NSString *)accessToken
@@ -133,7 +135,8 @@ static void KBAuthDarwinCallback(CFNotificationCenterRef center, void *observer,
if (ok) {
self.current = s;
//
[[NSNotificationCenter defaultCenter] postNotificationName:KBAuthChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:KBAuthChangedNotification
object:self];
// App <->
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), (__bridge CFStringRef)kKBDarwinAuthChanged, NULL, NULL, true);
}
@@ -143,7 +146,8 @@ static void KBAuthDarwinCallback(CFNotificationCenterRef center, void *observer,
- (void)signOut {
[self keychainDelete];
self.current = nil;
[[NSNotificationCenter defaultCenter] postNotificationName:KBAuthChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:KBAuthChangedNotification
object:self];
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), (__bridge CFStringRef)kKBDarwinAuthChanged, NULL, NULL, true);
}