//
//  SceneDelegate.m
//  iOS (App)
//
//  Created by Tomek Wójcik on 21/08/2025.
//

#import "SceneDelegate.h"

#import "AppDelegate.h"
#import "HPAuthFlow.h"

@implementation SceneDelegate

-(void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
    AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];

    for (UIOpenURLContext *context in URLContexts) {
        NSURL *url = context.URL;
        HPAuthParams *receivedAuthParams = [appDelegate.authFlow handlePostAuthenticateURL:url];
    
        if (receivedAuthParams == nil) {
            return;
        }
    
        [appDelegate.authFlow handleAuthParams:receivedAuthParams];
    }
}

@end
