Skip to content

Commit

Permalink
Fixed navigation issue when opening App Store links in Zapic (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsarfati authored Mar 15, 2018
1 parent 10b309b commit 30818f5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Zapic/Controllers/Views/Webview/ZapicWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ enum WebClientStatus {

internal class ZapicWebView: WKWebView, UIScrollViewDelegate {

// private let appUrl: String = ZapicUtils.appUrl()

// Current retry attempt number. Resets when load is sucessful
private var retryAttempt = 0

private var loadSuccessful = false

private var urlRequest: URLRequest?

Expand Down Expand Up @@ -129,7 +129,12 @@ internal class ZapicWebView: WKWebView, UIScrollViewDelegate {
}

private func retryAfterDelay() {


//Dont retry if the load has been successful
if loadSuccessful{
return
}

let base: Double = 5

//Max delay (s)
Expand All @@ -153,6 +158,7 @@ extension ZapicWebView: WKNavigationDelegate {
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
ZLog.info("Finished loading webview content")
retryAttempt = 0
loadSuccessful = true
}

/// Handle errors loading web application
Expand Down

0 comments on commit 30818f5

Please sign in to comment.