Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add redirected to visit response #225

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 1 addition & 5 deletions Source/Session/Session.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ public class Session: NSObject {
private lazy var bridge = WebViewBridge(webView: webView)
private var initialized = false
private var refreshing = false

/// Options behave differently if a response is provided.
private let visitOptionsHandler = VisitOptionsHandler()

private var isShowingStaleContent = false
private var isSnapshotCacheStale = false
Expand Down Expand Up @@ -68,8 +65,7 @@ public class Session: NSObject {
initialized = false
}

let processedOptions = visitOptionsHandler.process(options)
let visit = makeVisit(for: visitable, options: processedOptions)
let visit = makeVisit(for: visitable, options: options ?? VisitOptions())
currentVisit?.cancel()
currentVisit = visit

Expand Down
24 changes: 0 additions & 24 deletions Source/Session/VisitOptionsHandler.swift

This file was deleted.

4 changes: 3 additions & 1 deletion Source/Visit/VisitResponse.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import Foundation

public struct VisitResponse: Codable {
public let redirected: Bool
public let statusCode: Int
public let responseHTML: String?

public init(statusCode: Int, responseHTML: String? = nil) {
public init(statusCode: Int, responseHTML: String? = nil, redirected: Bool = false) {
self.statusCode = statusCode
self.responseHTML = responseHTML
self.redirected = redirected
}

public var isSuccessful: Bool {
Expand Down
71 changes: 0 additions & 71 deletions Tests/VisitOptionsTests.swift

This file was deleted.