Skip to content

Commit

Permalink
fix: Unable to open any item from "Bachelor’s Degrees" (#344)
Browse files Browse the repository at this point in the history
[iOS] Unable to open any item from "Bachelor’s Degrees" section in Discover tab #343
  • Loading branch information
forgotvas authored Mar 19, 2024
1 parent d704613 commit 3ae346f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Core/Core/View/Base/Webview/WebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public struct WebView: UIViewRepresentable {

public class Coordinator: NSObject, WKNavigationDelegate, WKUIDelegate, WKScriptMessageHandler {
var parent: WebView
var url: URL?

init(_ parent: WebView) {
self.parent = parent
Expand Down Expand Up @@ -252,16 +253,18 @@ public struct WebView: UIViewRepresentable {
}

webView.customUserAgent = userAgent
context.coordinator.url = nil

return webView
}

public func updateUIView(_ webview: WKWebView, context: UIViewRepresentableContext<WebView>) {
if let url = URL(string: viewModel.url) {
if webview.url?.absoluteString != url.absoluteString {
if context.coordinator.url?.absoluteString != url.absoluteString {
DispatchQueue.main.async {
isLoading = true
}
context.coordinator.url = url
let request = URLRequest(url: url)
webview.load(request)
}
Expand Down

0 comments on commit 3ae346f

Please sign in to comment.