From a2078aa9a522ec7322601c6dc282506d6785b8a2 Mon Sep 17 00:00:00 2001 From: Subhankar Maiti Date: Mon, 28 Jul 2025 03:31:33 +0530 Subject: [PATCH 1/3] refactor(native): Simplify presentation style handling in authorize method --- .../native/bridge/NativeBridgeManager.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/platforms/native/bridge/NativeBridgeManager.ts b/src/platforms/native/bridge/NativeBridgeManager.ts index 8fcc4d92..b5b2dace 100644 --- a/src/platforms/native/bridge/NativeBridgeManager.ts +++ b/src/platforms/native/bridge/NativeBridgeManager.ts @@ -6,6 +6,7 @@ import type { NativeClearSessionOptions, } from '../../../types'; import { + SafariViewControllerPresentationStyle, type LocalAuthenticationOptions, type NativeAuthorizeOptions, } from '../../../types/platform-specific'; @@ -71,16 +72,11 @@ export class NativeBridgeManager implements INativeBridge { parameters: WebAuthorizeParameters, options: NativeAuthorizeOptions ): Promise { - let presentationStyle: number | undefined; - if (options.useSFSafariViewController === true) { - // If just `true`, default to a safe style like `fullScreen` (value 1 from our enum) - presentationStyle = 1; - } else if (typeof options.useSFSafariViewController === 'object') { - presentationStyle = options.useSFSafariViewController.presentationStyle; - } else { - // If false or undefined, pass undefined to the native layer. - presentationStyle = undefined; - } + let presentationStyle = options.useSFSafariViewController + ? (options.useSFSafariViewController as { presentationStyle: number }) + ?.presentationStyle ?? + SafariViewControllerPresentationStyle.fullScreen + : undefined; const scheme = parameters.redirectUrl?.split('://')[0] ?? options.customScheme; const credential = await this.a0_call( @@ -97,7 +93,7 @@ export class NativeBridgeManager implements INativeBridge { parameters.invitationUrl, options.leeway ?? 0, options.ephemeralSession ?? false, - presentationStyle, + presentationStyle ?? 99, parameters.additionalParameters ?? {} ); return new CredentialsModel(credential); From 6cd964e7c68b6343713983a36c84accce48bddb0 Mon Sep 17 00:00:00 2001 From: Subhankar Maiti Date: Mon, 28 Jul 2025 09:50:06 +0530 Subject: [PATCH 2/3] test(native): Update default presentationStyle value in NativeBridgeManager tests --- .../native/bridge/__tests__/NativeBridgeManager.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/native/bridge/__tests__/NativeBridgeManager.spec.ts b/src/platforms/native/bridge/__tests__/NativeBridgeManager.spec.ts index 16f48a07..909290ec 100644 --- a/src/platforms/native/bridge/__tests__/NativeBridgeManager.spec.ts +++ b/src/platforms/native/bridge/__tests__/NativeBridgeManager.spec.ts @@ -99,7 +99,7 @@ describe('NativeBridgeManager', () => { undefined, // invitationUrl 0, // leeway false, // ephemeralSession - undefined, // presentationStyle + 99, // presentationStyle {} // additionalParameters ); }); From 3fc020432cf368772544772ce1f48cdf8793046f Mon Sep 17 00:00:00 2001 From: Subhankar Maiti Date: Mon, 28 Jul 2025 09:55:35 +0530 Subject: [PATCH 3/3] fix(native): Update presentationStyle handling to use 99 as a default for unset values --- src/platforms/native/bridge/NativeBridgeManager.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/platforms/native/bridge/NativeBridgeManager.ts b/src/platforms/native/bridge/NativeBridgeManager.ts index b5b2dace..c95d688a 100644 --- a/src/platforms/native/bridge/NativeBridgeManager.ts +++ b/src/platforms/native/bridge/NativeBridgeManager.ts @@ -93,7 +93,8 @@ export class NativeBridgeManager implements INativeBridge { parameters.invitationUrl, options.leeway ?? 0, options.ephemeralSession ?? false, - presentationStyle ?? 99, + presentationStyle ?? 99, // Since we can't pass null to the native layer, and we need a value to represent this parameter is not set, we are using 99. + // //The native layer will check for this and ignore if the value is 99 parameters.additionalParameters ?? {} ); return new CredentialsModel(credential);