BTHLABS-66: Prepping for public release: Take five

AKA "Using Apple reviewers as QA for your project". Thanks, y'all! :)
This commit is contained in:
2025-11-27 17:51:19 +01:00
parent cca49f2292
commit 55126f4af6
26 changed files with 386 additions and 97 deletions

View File

@@ -31,31 +31,24 @@
#pragma mark - Actions
-(IBAction)doStartAuthorizationFlow:(id)sender {
NSAlert *alert = [[NSAlert alloc] init];
alert.alertStyle = NSAlertStyleInformational;
alert.messageText = NSLocalizedString(@"Continue in the browser", @"Continue in the browser");
alert.informativeText = NSLocalizedString(@"HotPocket will now open the instance in your browser and you can continue to sign in.", @"HotPocket will now open the instance in your browser and you can continue to sign in.");
AppDelegate *appDelegate = [[NSApplication sharedApplication] delegate];
appDelegate.authFlow.baseURL = [NSURL URLWithString:self.baseURL];
[alert addButtonWithTitle:NSLocalizedString(@"Let's go!", @"Let's go!")];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Cancel")];
NSURL *authURL = [appDelegate.authFlow start];
if (authURL == nil) {
NSBeep();
return;
}
[alert beginSheetModalForWindow:self.view.window completionHandler:^(NSModalResponse response) {
if (response == NSAlertFirstButtonReturn) {
AppDelegate *appDeleate = [[NSApplication sharedApplication] delegate];
appDeleate.authFlow.baseURL = [NSURL URLWithString:self.baseURL];
NSURL *authURL = [appDeleate.authFlow start];
if (authURL == nil) {
NSBeep();
return;
}
AuthorizationProgressViewController *authProgressViewController = [self.storyboard instantiateControllerWithIdentifier:@"AuthorizationProgressViewController"];
authProgressViewController.authorizationURL = authURL;
[self presentViewController:authProgressViewController animator:[[ReplaceAnimator alloc] init]];
}
AuthorizationProgressViewController *authProgressViewController = [self.storyboard instantiateControllerWithIdentifier:@"AuthorizationProgressViewController"];
[self presentViewController:authProgressViewController animator:[[ReplaceAnimator alloc] init]];
[[NSWorkspace sharedWorkspace] openURL:authURL];
}
}];
# pragma mark - ASWebAuthenticationPresentationContextProviding implementation
-(ASPresentationAnchor)presentationAnchorForWebAuthenticationSession:(ASWebAuthenticationSession *)session {
return self.view.window;
}
@end