Skip to content

Commit

Permalink
Get web view's URL at runtime
Browse files Browse the repository at this point in the history
If a Turbo request is redirected to a page with a Strada component this
check would always fail. `location` is only set when `BridgeDelegate` is
initialized. This change dynamically grabs the URL from the web view,
falling back to the original `location` if nil.

Fixes #23
  • Loading branch information
joemasilotti committed Dec 7, 2023
1 parent d8c1bcf commit ffcc782
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/BridgeDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public final class BridgeDelegate: BridgingDelegate {
@discardableResult
public func bridgeDidReceiveMessage(_ message: Message) -> Bool {
guard destinationIsActive,
location == message.metadata?.url else {
webView?.url?.absoluteString ?? location == message.metadata?.url else {
logger.warning("bridgeDidIgnoreMessage: \(String(describing: message))")
return false
}
Expand Down

0 comments on commit ffcc782

Please sign in to comment.