diff --git a/IonicPortals.podspec b/IonicPortals.podspec index 2a63cbd..844c818 100644 --- a/IonicPortals.podspec +++ b/IonicPortals.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.authors = { 'Ionic Team' => 'hi@ionicframework.com' } s.source = { :git => 'https://github.com/ionic-team/ionic-portals-ios.git', :tag => s.version.to_s } s.source_files = 'Sources/IonicPortals/*.swift' - s.dependency 'Capacitor', '~> 3.5' + s.dependency 'Capacitor', '~> 3.7' s.dependency 'IonicLiveUpdates', '~> 0.1.2' s.swift_version = '5.4' end diff --git a/Sources/IonicPortals/PortalUIView.swift b/Sources/IonicPortals/PortalUIView.swift index 77e05ee..55d37c7 100644 --- a/Sources/IonicPortals/PortalUIView.swift +++ b/Sources/IonicPortals/PortalUIView.swift @@ -55,20 +55,16 @@ public class PortalUIView: UIView { /// Reloads the underlying `WKWebView` @objc public func reload() { - guard - let liveUpdate = portal.liveUpdateConfig, - let capViewController = bridge.viewController as? CAPBridgeViewController, - let latestAppPath = try? portal.liveUpdateManager.latestAppDirectory(for: liveUpdate.appId) - else { return } - - if liveUpdatePath == nil || liveUpdatePath?.path != latestAppPath.path { + if let liveUpdate = portal.liveUpdateConfig, + let latestAppPath = try? portal.liveUpdateManager.latestAppDirectory(for: liveUpdate.appId), + liveUpdatePath == nil || liveUpdatePath?.path != latestAppPath.path { liveUpdatePath = latestAppPath - capViewController.setServerBasePath(path: liveUpdatePath!.path) - return + return webView.setServerBasePath(path: latestAppPath.path) } - // Reload the bridge to the existing start url - bridge.webView?.reload() + DispatchQueue.main.async { [weak self] in + self?.bridge.webView?.reload() + } } class InternalCapWebView: CAPWebView {