Skip to content

Commit

Permalink
Expose web view activation/deactivation through VisitableDelegate.
Browse files Browse the repository at this point in the history
  • Loading branch information
svara committed Aug 3, 2023
1 parent 8a769ab commit bc4f3eb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Source/Visitable/Visitable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ public protocol VisitableDelegate: AnyObject {
func visitableViewDidAppear(_ visitable: Visitable)
func visitableDidRequestReload(_ visitable: Visitable)
func visitableDidRequestRefresh(_ visitable: Visitable)
func visitableDidActivateWebView(_ webView: WKWebView)
func visitableDidDeactivateWebView(_ visitable: Visitable)
}

public protocol Visitable: AnyObject {
Expand All @@ -17,8 +19,6 @@ public protocol Visitable: AnyObject {
func visitableDidRender()
func showVisitableActivityIndicator()
func hideVisitableActivityIndicator()
func activateVisitableWebView(_ webView: WKWebView)
func deactivateVisitableWebView()
}

extension Visitable {
Expand All @@ -34,12 +34,14 @@ extension Visitable {
visitableView.hideActivityIndicator()
}

public func activateVisitableWebView(_ webView: WKWebView) {
func activateVisitableWebView(_ webView: WKWebView) {
visitableView.activateWebView(webView, forVisitable: self)
visitableDelegate?.visitableDidActivateWebView(webView)
}

public func deactivateVisitableWebView() {
func deactivateVisitableWebView() {
visitableView.deactivateWebView()
visitableDelegate?.visitableDidDeactivateWebView(self)
}

func updateVisitableScreenshot() {
Expand Down

0 comments on commit bc4f3eb

Please sign in to comment.