diff --git a/src/platforms/native/bridge/NativeBridgeManager.ts b/src/platforms/native/bridge/NativeBridgeManager.ts index 8fcc4d92..c95d688a 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,8 @@ export class NativeBridgeManager implements INativeBridge { parameters.invitationUrl, options.leeway ?? 0, options.ephemeralSession ?? false, - presentationStyle, + 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); 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 ); });