Files
hotpocket/services/apple/macOS (App)/AppDelegate.m
Tomek Wójcik 23f8296659 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.
2025-11-21 21:04:28 +01:00

40 lines
930 B
Objective-C

//
// AppDelegate.m
// macOS (App)
//
// Created by Tomek Wójcik on 21/08/2025.
//
#import "AppDelegate.h"
#import "HPAuthFlow.h"
#import "HPCredentialsHelper.h"
@implementation AppDelegate
-(void)applicationDidFinishLaunching:(NSNotification *)notification {
self.authFlow = [[HPAuthFlow alloc] init];
}
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender {
return YES;
}
-(void)application:(NSApplication *)application openURLs:(NSArray<NSURL *> *)urls {
HPAuthParams *receivedAuthParams = nil;
for (NSURL *url in urls) {
receivedAuthParams = [self.authFlow handlePostAuthenticateURL:url];
if (receivedAuthParams != nil) {
break;
}
}
if (receivedAuthParams != nil) {
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
[self.authFlow handleAuthParams:receivedAuthParams];
}
}
@end