Fix[auth]: correct UI calls to dispatch main queue

This commit is contained in:
khanhduytran0 committed 2025-05-11 15:24:08 +07:00
1 parent 184c20c601
commit 6c2d097a2d
2 files changed
+16 -5

No files matched your search

+11 -5
View File
@@ -95,7 +95,9 @@
[self addActivityIndicatorTo:cell];
id callback = ^(id status, BOOL success) {
[self callbackMicrosoftAuth:status success:success forCell:cell];
dispatch_async(dispatch_get_main_queue(), ^(){
[self callbackMicrosoftAuth:status success:success forCell:cell];
});
};
[[BaseAuthenticator loadSavedName:self.accountList[indexPath.row][@"username"]] refreshTokenWithCallback:callback];
}
@@ -210,14 +212,18 @@
NSDictionary *queryItems = [self parseQueryItems:callbackURL.absoluteString];
if (queryItems[@"code"]) {
self.modalInPresentation = YES;
self.tableView.userInteractionEnabled = NO;
[self addActivityIndicatorTo:sender];
dispatch_async(dispatch_get_main_queue(), ^(){
self.modalInPresentation = YES;
self.tableView.userInteractionEnabled = NO;
[self addActivityIndicatorTo:sender];
});
id callback = ^(id status, BOOL success) {
if ([status isKindOfClass:NSString.class] && [status isEqualToString:@"DEMO"] && success) {
showDialog(localize(@"login.warn.title.demomode", nil), localize(@"login.warn.message.demomode", nil));
}
[self callbackMicrosoftAuth:status success:success forCell:sender];
dispatch_async(dispatch_get_main_queue(), ^(){
[self callbackMicrosoftAuth:status success:success forCell:sender];
});
};
[[[MicrosoftAuthenticator alloc] initWithInput:queryItems[@"code"]] loginWithCallback:callback];
} else {
+5
View File
@@ -128,6 +128,11 @@ void init_logDeviceAndVer(char *argument) {
}
void init_redirectStdio() {
if (getenv("POJAV_LOG_TO_CONSOLE") != NULL) {
NSLog(@"[Pre-init] POJAV_LOG_TO_CONSOLE is set, not logging to latestlog.txt");
return;
}
NSLog(@"[Pre-init] Starting logging STDIO to latestlog.txt\n");
NSString *home = @(getenv("POJAV_HOME"));