Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ final class MixinWebViewController: WebViewController {
private let defaultEVMChain: Web3Chain = .ethereum

private(set) var context: MixinWebContext!
private(set) var isMinimizable: Bool = true

private lazy var messageHandler = WebViewMessageHandler(delegate: self)
private lazy var suspicousLinkView = R.nib.suspiciousLinkView(withOwner: self)!
Expand Down Expand Up @@ -276,9 +277,17 @@ extension MixinWebViewController: WKNavigationDelegate {
decisionHandler(.cancel)
return
}
let isNavigatingOnMainFrame = navigationAction.targetFrame?.isMainFrame ?? false
isMinimizable = !isNavigatingOnMainFrame
if isViewLoaded && parent != nil && (UrlWindow.checkUrl(url: url, from: .webView(context)) || UrlWindow.checkWithdrawal(string: url.absoluteString)) {
if isNavigatingOnMainFrame {
dismissAsChild(animated: true)
}
decisionHandler(.cancel)
} else if "file" == url.scheme {
return
}
isMinimizable = true
if "file" == url.scheme {
decisionHandler(.allow)
} else if ["http", "https"].contains(url.scheme?.lowercased() ?? "") {
decisionHandler(.allow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ extension HomeNavigationController: UINavigationControllerDelegate {
let webViewControllers = container.children.compactMap { child in
child as? MixinWebViewController
}
for webViewController in webViewControllers {
webViewController.minimizeWithAnimation()
for web in webViewControllers where web.isMinimizable {
web.minimizeWithAnimation()
}
}
}
Expand Down