Compare commits
3 Commits
92fe14cd9b
...
71831e58f2
Author | SHA1 | Date |
---|---|---|
Shadowfacts | 71831e58f2 | |
Shadowfacts | e27ac15635 | |
Shadowfacts | 040a799b7b |
|
@ -34,6 +34,10 @@ class BrowserNavigationController: UIViewController {
|
||||||
|
|
||||||
if (oldValue <= 0.5 && toolbarOffset > 0.5) || (oldValue > 0.5 && toolbarOffset <= 0.5) {
|
if (oldValue <= 0.5 && toolbarOffset > 0.5) || (oldValue > 0.5 && toolbarOffset <= 0.5) {
|
||||||
setNeedsStatusBarAppearanceUpdate()
|
setNeedsStatusBarAppearanceUpdate()
|
||||||
|
|
||||||
|
if navBarView.textField.isFirstResponder {
|
||||||
|
navBarView.textField.resignFirstResponder()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,6 +209,10 @@ class BrowserNavigationController: UIViewController {
|
||||||
if position == .end {
|
if position == .end {
|
||||||
self.navigator.goBack()
|
self.navigator.goBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.navBarView.textField.isFirstResponder {
|
||||||
|
self.navBarView.textField.resignFirstResponder()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
gestureState = .backwards(animator)
|
gestureState = .backwards(animator)
|
||||||
} else if location.x > view.bounds.width - startEdgeNavigationSwipeDistance && velocity.x < 0 && navigator.forwardStack.count > 0 {
|
} else if location.x > view.bounds.width - startEdgeNavigationSwipeDistance && velocity.x < 0 && navigator.forwardStack.count > 0 {
|
||||||
|
@ -236,6 +244,10 @@ class BrowserNavigationController: UIViewController {
|
||||||
if position == .end {
|
if position == .end {
|
||||||
self.navigator.goForward()
|
self.navigator.goForward()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.navBarView.textField.isFirstResponder {
|
||||||
|
self.navBarView.textField.resignFirstResponder()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
gestureState = .forwards(animator)
|
gestureState = .forwards(animator)
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ class BrowserWebViewController: UIViewController {
|
||||||
webView.scrollView.delegate = scrollViewDelegate
|
webView.scrollView.delegate = scrollViewDelegate
|
||||||
// this doesn't default to .default :S
|
// this doesn't default to .default :S
|
||||||
webView.scrollView.indicatorStyle = .default
|
webView.scrollView.indicatorStyle = .default
|
||||||
|
webView.scrollView.keyboardDismissMode = .interactive
|
||||||
webView.translatesAutoresizingMaskIntoConstraints = false
|
webView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
view.addSubview(webView)
|
view.addSubview(webView)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
|
|
|
@ -14,7 +14,7 @@ class NavigationBarView: UIView {
|
||||||
let navigator: NavigationManager
|
let navigator: NavigationManager
|
||||||
|
|
||||||
private var border: UIView!
|
private var border: UIView!
|
||||||
private var textField: UITextField!
|
private(set) var textField: UITextField!
|
||||||
|
|
||||||
private var cancellables = [AnyCancellable]()
|
private var cancellables = [AnyCancellable]()
|
||||||
|
|
||||||
|
@ -40,9 +40,10 @@ class NavigationBarView: UIView {
|
||||||
textField.text = navigator.displayURL
|
textField.text = navigator.displayURL
|
||||||
textField.borderStyle = .roundedRect
|
textField.borderStyle = .roundedRect
|
||||||
textField.keyboardType = .URL
|
textField.keyboardType = .URL
|
||||||
|
textField.returnKeyType = .go
|
||||||
textField.autocapitalizationType = .none
|
textField.autocapitalizationType = .none
|
||||||
textField.autocorrectionType = .no
|
textField.autocorrectionType = .no
|
||||||
textField.addTarget(self, action: #selector(commitURL), for: .editingDidEnd)
|
textField.addTarget(self, action: #selector(commitURL), for: .primaryActionTriggered)
|
||||||
textField.translatesAutoresizingMaskIntoConstraints = false
|
textField.translatesAutoresizingMaskIntoConstraints = false
|
||||||
addSubview(textField)
|
addSubview(textField)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
|
@ -75,8 +76,12 @@ class NavigationBarView: UIView {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func commitURL() {
|
@objc private func commitURL() {
|
||||||
if let text = textField.text, let url = URL(string: text) {
|
textField.resignFirstResponder()
|
||||||
navigator.changeURL(url)
|
if let text = textField.text, var components = URLComponents(string: text) {
|
||||||
|
if components.scheme == nil {
|
||||||
|
components.scheme = "gemini"
|
||||||
|
}
|
||||||
|
navigator.changeURL(components.url!)
|
||||||
} else {
|
} else {
|
||||||
textField.text = navigator.displayURL
|
textField.text = navigator.displayURL
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue