BTHLABS-66: Prepping for public release: Take three

I smell a drastic change to auth flow in the Mac app... Let's see if it
gets approved this time :D.
This commit is contained in:
2025-11-21 20:25:02 +01:00
parent 9abed01e53
commit 23f8296659
11 changed files with 89 additions and 36 deletions

View File

@@ -25,11 +25,20 @@
-(void)viewDidLoad {
[super viewDidLoad];
self.progressLabelTitle = NSLocalizedString(@"Continue to sign out in your browser...", @"Continue to sign out in your browser...");
}
-(void)viewWillAppear {
AppDelegate *appDelegate = [[NSApplication sharedApplication] delegate];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAuthFlowDidFinish:) name:@"AuthFlowDidFinish" object:appDelegate.authFlow];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onAuthFlowDidFinish:)
name:@"AuthFlowDidFinish"
object:appDelegate.authFlow];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onAuthFlowDidReceiveAuthParams:)
name:@"AuthFlowDidReceiveAuthParams"
object:appDelegate.authFlow];
[self.progressIndicator startAnimation:self];
}
@@ -54,10 +63,10 @@
alert.alertStyle = NSAlertStyleCritical;
alert.messageText = NSLocalizedString(@"Oops!", @"Oops!");
alert.informativeText = NSLocalizedString(@"HotPocket couldn't complete this operation.", @"HotPocket couldn't complete this operation.");
[alert runModal];
AuthorizationViewController *authorizationViewController = [self.storyboard instantiateControllerWithIdentifier:@"AuthorizationViewController"];
[self presentViewController:authorizationViewController animator:[[ReplaceAnimator alloc] init]];
[alert beginSheetModalForWindow:self.view.window completionHandler:^(NSModalResponse response) {
AuthorizationViewController *authorizationViewController = [self.storyboard instantiateControllerWithIdentifier:@"AuthorizationViewController"];
[self presentViewController:authorizationViewController animator:[[ReplaceAnimator alloc] init]];
}];
} else {
MainViewController *mainViewController = [self.storyboard instantiateControllerWithIdentifier:@"MainViewController"];
[self presentViewController:mainViewController animator:[[ReplaceAnimator alloc] init]];
@@ -65,4 +74,8 @@
});
}
-(void)onAuthFlowDidReceiveAuthParams:(NSNotification *)notification {
self.progressLabelTitle = NSLocalizedString(@"Processing authorization...", @"Processing authorization...");
}
@end