Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions src/platforms/native/bridge/NativeBridgeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
NativeClearSessionOptions,
} from '../../../types';
import {
SafariViewControllerPresentationStyle,
type LocalAuthenticationOptions,
type NativeAuthorizeOptions,
} from '../../../types/platform-specific';
Expand Down Expand Up @@ -71,16 +72,11 @@ export class NativeBridgeManager implements INativeBridge {
parameters: WebAuthorizeParameters,
options: NativeAuthorizeOptions
): Promise<Credentials> {
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(
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('NativeBridgeManager', () => {
undefined, // invitationUrl
0, // leeway
false, // ephemeralSession
undefined, // presentationStyle
99, // presentationStyle
{} // additionalParameters
);
});
Expand Down