You've already forked hotpocket
BTHLABS-58: Share Extension in Apple Apps
This commit is contained in:
49
services/apple/macOS (App)/AuthorizationViewController.m
Normal file
49
services/apple/macOS (App)/AuthorizationViewController.m
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// AuthorizationViewController.m
|
||||
// HotPocket (macOS)
|
||||
//
|
||||
// Created by Tomek Wójcik on 20/09/2025.
|
||||
//
|
||||
|
||||
#import "AuthorizationViewController.h"
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "HPAuthFlow.h"
|
||||
#import "AuthorizationProgressViewController.h"
|
||||
#import "ReplaceAnimator.h"
|
||||
|
||||
@interface AuthorizationViewController (AuthorizationViewControllerPrivate)
|
||||
|
||||
#pragma mark - Private interface
|
||||
|
||||
@end
|
||||
|
||||
@implementation AuthorizationViewController
|
||||
|
||||
#pragma mark - View lifecycle
|
||||
|
||||
-(void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.baseURL = nil;
|
||||
self.authorizationSessionToken = nil;
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
-(IBAction)doStartAuthorizationFlow:(id)sender {
|
||||
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"];
|
||||
[self presentViewController:authProgressViewController animator:[[ReplaceAnimator alloc] init]];
|
||||
|
||||
[[NSWorkspace sharedWorkspace] openURL:authURL];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user