Skip to content

Commit

Permalink
Fix bridge script issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shilgapira committed Nov 11, 2024
1 parent 8084bda commit 1a8310f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/flows/FlowBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -263,20 +263,10 @@ window.console.debug = (s) => { window.webkit.messageHandlers.\(FlowBridgeMessag
window.console.info = (s) => { window.webkit.messageHandlers.\(FlowBridgeMessage.log.rawValue).postMessage({ tag: 'info', message: s }) }
window.console.warn = (s) => { window.webkit.messageHandlers.\(FlowBridgeMessage.log.rawValue).postMessage({ tag: 'warn', message: s }) }
window.console.error = (s) => { window.webkit.messageHandlers.\(FlowBridgeMessage.log.rawValue).postMessage({ tag: 'error', message: s }) }
window.onerror = (message, source, lineno, colno, error) => { window.webkit.messageHandlers.\(FlowBridgeMessage.log.rawValue).postMessage({ tag: 'fail', message: `${message}, ${source || '-'}, ${error || '-'}` }) }
// Called directly below
function \(namespace)_initialize() {
const styles = `
* {
-webkit-touch-callout: none;
-webkit-user-select: none;
}
`
const stylesheet = document.createElement("style")
stylesheet.textContent = styles
document.head.appendChild(stylesheet)
let interval
interval = setInterval(() => {
let component = \(namespace)_find()
Expand All @@ -294,6 +284,17 @@ function \(namespace)_find() {
// Attaches event listeners once the Descope web-component is ready
function \(namespace)_prepare(component) {
const styles = `
* {
-webkit-touch-callout: none;
-webkit-user-select: none;
}
`
const stylesheet = document.createElement('style')
stylesheet.textContent = styles
document.head.appendChild(stylesheet)
component.nativeOptions = {
platform: 'ios',
bridgeVersion: 1,
Expand Down
19 changes: 19 additions & 0 deletions src/flows/FlowViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,25 @@ public protocol DescopeFlowViewControllerDelegate: AnyObject {
/// You can use an instance of ``DescopeFlowViewController`` as a standalone view controller or
/// in a navigation controller stack. In the latter case, if the flow view controller is at the
/// top of the stack, it shows a `Cancel` button where the back arrow usually is.
///
/// ```swift
/// fun showLoginScreen() {
/// let url = URL(string: "https://example.com/myflow")!
/// let flow = DescopeFlow(url: url)
///
/// let flowViewController = DescopeFlowViewController()
/// flowViewController.delegate = self
/// flowViewController.start(flow: flow)
///
/// navigationController?.pushViewController(flowViewController, animated: true)
/// }
///
/// func flowViewControllerDidFinish(_ controller: DescopeFlowViewController, response: AuthenticationResponse) {
/// let session = DescopeSession(from: response)
/// Descope.sessionManager.manageSession(session)
/// showMainScreen()
/// }
/// ```
public class DescopeFlowViewController: UIViewController {

private lazy var flowView: DescopeFlowView = createFlowView()
Expand Down

0 comments on commit 1a8310f

Please sign in to comment.