Skip to content
This repository has been archived by the owner on Sep 25, 2021. It is now read-only.

Make sure finishRequest() is always called for cold boot visits #154

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
REMOVE BEFORE MERGING: Reproduce issue in demo app
calleluks committed Apr 4, 2019
commit 11d71c3c0cf818fe1ec34a0d998e9429aac3b07e
1 change: 1 addition & 0 deletions Turbolinks/Visit.swift
Original file line number Diff line number Diff line change
@@ -173,6 +173,7 @@ class ColdBootVisit: Visit, WKNavigationDelegate, WebViewPageLoadDelegate {
// MARK: WKNavigationDelegate

func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
print("ColdBootVisit \(#function)")
if navigation === self.navigation {
finishRequest()
}
4 changes: 3 additions & 1 deletion TurbolinksDemo/ApplicationController.swift
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import WebKit
import Turbolinks

class ApplicationController: UINavigationController {
fileprivate let url = URL(string: "http://localhost:9292")!
fileprivate let url = URL(string: "http://localhost:9292/slow")!
fileprivate let webViewProcessPool = WKProcessPool()

fileprivate var application: UIApplication {
@@ -94,10 +94,12 @@ extension ApplicationController: SessionDelegate {

func sessionDidStartRequest(_ session: Session) {
application.isNetworkActivityIndicatorVisible = true
print("\(ObjectIdentifier(self)) \(#function)")
}

func sessionDidFinishRequest(_ session: Session) {
application.isNetworkActivityIndicatorVisible = false
print("\(ObjectIdentifier(self)) \(#function)")
}
}

41 changes: 37 additions & 4 deletions TurbolinksDemo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,26 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="tbq-el-AUE">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="eaa-mb-s0X">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Application Controller-->
<!--Item-->
<scene sceneID="Z6f-pY-U74">
<objects>
<navigationController id="tbq-el-AUE" customClass="ApplicationController" customModule="TurbolinksDemo" customModuleProvider="target" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Item" id="LxP-Sz-mgD"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="Wy5-gK-0jd">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="UQ8-Z9-H5O" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="728" y="396"/>
<point key="canvasLocation" x="1750" y="-19"/>
</scene>
<!--Tab Bar Controller-->
<scene sceneID="Y0t-Dx-7qH">
<objects>
<tabBarController automaticallyAdjustsScrollViewInsets="NO" id="eaa-mb-s0X" sceneMemberID="viewController">
<toolbarItems/>
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="BHz-O6-87e">
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tabBar>
<connections>
<segue destination="tbq-el-AUE" kind="relationship" relationship="viewControllers" id="pH8-S8-ocZ"/>
<segue destination="tpO-JS-r9F" kind="relationship" relationship="viewControllers" id="eH9-CE-I7e"/>
</connections>
</tabBarController>
<placeholder placeholderIdentifier="IBFirstResponder" id="R76-u9-Qvc" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="727.20000000000005" y="395.35232383808096"/>
</scene>
<!--Item-->
<scene sceneID="uJX-Wo-IJP">
<objects>
<navigationController id="tpO-JS-r9F" customClass="ApplicationController" customModule="TurbolinksDemo" customModuleProvider="target" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Item" id="NVo-Gq-WPZ"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="Dzd-n0-ywL">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="aLs-7Y-Wob" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1750" y="758"/>
</scene>
</scenes>
</document>
2 changes: 1 addition & 1 deletion TurbolinksDemo/server/lib/turbolinks_demo/app.rb
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ class App < Sinatra::Base
end

get '/slow' do
sleep 2
sleep 5
@title = 'Slow Page'
erb :slow, layout: :layout
end