From 23f8296659ba5bfe59ef30ebf2e2e7ca6dd06e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20W=C3=B3jcik?= Date: Fri, 21 Nov 2025 20:25:02 +0100 Subject: [PATCH] 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. --- .../apple/HotPocket.xcodeproj/project.pbxproj | 4 +-- services/apple/Shared (App)/HPAuthFlow.m | 4 ++- .../AuthorizationProgressViewController.h | 3 ++ .../AuthorizationProgressViewController.m | 16 ++++++++- .../iOS (App)/Base.lproj/Main.storyboard | 5 +-- services/apple/macOS (App)/AppDelegate.m | 1 + .../AuthorizationProgressViewController.h | 1 + .../AuthorizationProgressViewController.m | 23 ++++++++++--- .../macOS (App)/AuthorizationViewController.m | 34 +++++++++++++------ .../macOS (App)/Base.lproj/Main.storyboard | 29 +++++++++------- services/extension/tasks.py | 5 ++- 11 files changed, 89 insertions(+), 36 deletions(-) diff --git a/services/apple/HotPocket.xcodeproj/project.pbxproj b/services/apple/HotPocket.xcodeproj/project.pbxproj index 1177470..b88d974 100644 --- a/services/apple/HotPocket.xcodeproj/project.pbxproj +++ b/services/apple/HotPocket.xcodeproj/project.pbxproj @@ -1022,7 +1022,7 @@ CODE_SIGN_ENTITLEMENTS = "macOS (App)/HotPocket.entitlements"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2025111901; + CURRENT_PROJECT_VERSION = 2025111902; DEVELOPMENT_TEAM = 648728X64K; ENABLE_HARDENED_RUNTIME = YES; GENERATE_INFOPLIST_FILE = YES; @@ -1061,7 +1061,7 @@ CODE_SIGN_ENTITLEMENTS = "macOS (App)/HotPocket.entitlements"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2025111901; + CURRENT_PROJECT_VERSION = 2025111902; DEVELOPMENT_TEAM = 648728X64K; ENABLE_HARDENED_RUNTIME = YES; GENERATE_INFOPLIST_FILE = YES; diff --git a/services/apple/Shared (App)/HPAuthFlow.m b/services/apple/Shared (App)/HPAuthFlow.m index f67c9b5..cadddd3 100644 --- a/services/apple/Shared (App)/HPAuthFlow.m +++ b/services/apple/Shared (App)/HPAuthFlow.m @@ -109,6 +109,8 @@ } -(BOOL)handleAuthParams:(HPAuthParams *)authParams { + [[NSNotificationCenter defaultCenter] postNotificationName:@"AuthFlowDidReceiveAuthParams" object:self]; + HPRPCClient *rpcClient = [[HPRPCClient alloc] initWithBaseURL:self.baseURL accessToken:nil]; NSArray *callParams = @[ @@ -120,7 +122,7 @@ method:@"accounts.access_tokens.create" params:callParams endopoint:@"/accounts/rpc/" completionHandler:^(NSString *callId, HPRPCCallResult *result) { - dispatch_async(dispatch_get_main_queue(), ^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ if (result.error != nil) { NSLog(@"-[HPAuthFlow handleAuthParams:] error=`%@`", result.error); } else { diff --git a/services/apple/iOS (App)/AuthorizationProgressViewController.h b/services/apple/iOS (App)/AuthorizationProgressViewController.h index 7ad3eba..dcae411 100644 --- a/services/apple/iOS (App)/AuthorizationProgressViewController.h +++ b/services/apple/iOS (App)/AuthorizationProgressViewController.h @@ -9,9 +9,12 @@ NS_ASSUME_NONNULL_BEGIN +@class MultilineLabel; + @interface AuthorizationProgressViewController : UIViewController @property IBOutlet UIActivityIndicatorView *progressIndicator; +@property IBOutlet MultilineLabel *progressLabel; @end diff --git a/services/apple/iOS (App)/AuthorizationProgressViewController.m b/services/apple/iOS (App)/AuthorizationProgressViewController.m index 5ab7483..c263e22 100644 --- a/services/apple/iOS (App)/AuthorizationProgressViewController.m +++ b/services/apple/iOS (App)/AuthorizationProgressViewController.m @@ -9,6 +9,7 @@ #import "AppDelegate.h" #import "HPCredentialsHelper.h" +#import "MultilineLabel.h" @interface AuthorizationProgressViewController (AuthorizationProgressViewControllerPrivate) @@ -22,6 +23,7 @@ -(void)viewDidLoad { [super viewDidLoad]; + self.progressLabel.text = NSLocalizedString(@"Continue to sign out in your browser...", @"Continue to sign out in your browser..."); } -(void)viewWillAppear:(BOOL)animated { @@ -29,7 +31,15 @@ [self.progressIndicator startAnimating]; AppDelegate *appDelegate = [[UIApplication 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]; } -(void)viewWillDisappear:(BOOL)animated { @@ -71,4 +81,8 @@ }); } +-(void)onAuthFlowDidReceiveAuthParams:(NSNotification *)notification { + self.progressLabel.text = NSLocalizedString(@"Processing authorization...", @"Processing authorization..."); +} + @end diff --git a/services/apple/iOS (App)/Base.lproj/Main.storyboard b/services/apple/iOS (App)/Base.lproj/Main.storyboard index a1cc4cf..0762818 100644 --- a/services/apple/iOS (App)/Base.lproj/Main.storyboard +++ b/services/apple/iOS (App)/Base.lproj/Main.storyboard @@ -229,8 +229,8 @@ -