diff --git a/swift-sdk/Internal/ActionRunner.swift b/swift-sdk/Internal/ActionRunner.swift index 409760a5f..306df81e1 100644 --- a/swift-sdk/Internal/ActionRunner.swift +++ b/swift-sdk/Internal/ActionRunner.swift @@ -29,23 +29,28 @@ struct ActionRunner { customActionHandler: CustomActionHandler? = nil, urlOpener: UrlOpenerProtocol? = nil, allowedProtocols: [String] = []) -> Bool { - let handled = callExternalHandlers(action: action, - from: context.source, - urlHandler: urlHandler, - customActionHandler: customActionHandler) - if handled { + guard case let .openUrl(url) = detectActionType(fromAction: action), + shouldOpenUrl(url: url, from: context.source, withAllowedProtocols: allowedProtocols) else { + return false + } + + if case let handled = callExternalHandlers(action: action, + from: context.source, + urlHandler: urlHandler, + customActionHandler: customActionHandler), handled { + return true + } + + if case let .openUrl(url) = detectActionType(fromAction: action), + let urlOpener = urlOpener { + urlOpener.open(url: url) return true - } else { - if case let .openUrl(url) = detectActionType(fromAction: action), - shouldOpenUrl(url: url, from: context.source, withAllowedProtocols: allowedProtocols), - let urlOpener = urlOpener { - urlOpener.open(url: url) - return true - } else { - return false - } } + + return false + + } // MARK: - Private