Set safari VC tint color
This commit is contained in:
parent
e1296223fe
commit
415340882e
|
@ -20,7 +20,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
guard let windowScene = (scene as? UIWindowScene) else { return }
|
guard let windowScene = (scene as? UIWindowScene) else { return }
|
||||||
|
|
||||||
window = UIWindow(windowScene: windowScene)
|
window = UIWindow(windowScene: windowScene)
|
||||||
window!.tintColor = .systemRed
|
window!.tintColor = .appTintColor
|
||||||
|
|
||||||
if let account = LocalData.account {
|
if let account = LocalData.account {
|
||||||
fervorController = FervorController(account: account)
|
fervorController = FervorController(account: account)
|
||||||
|
|
|
@ -117,6 +117,12 @@ class ReadViewController: UIViewController {
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func createSafariVC(url: URL) -> SFSafariViewController {
|
||||||
|
let vc = SFSafariViewController(url: url)
|
||||||
|
vc.preferredControlTintColor = .appTintColor
|
||||||
|
return vc
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ReadViewController: WKNavigationDelegate {
|
extension ReadViewController: WKNavigationDelegate {
|
||||||
|
@ -125,7 +131,7 @@ extension ReadViewController: WKNavigationDelegate {
|
||||||
if url == item.url {
|
if url == item.url {
|
||||||
return .allow
|
return .allow
|
||||||
} else {
|
} else {
|
||||||
present(SFSafariViewController(url: url), animated: true)
|
present(createSafariVC(url: url), animated: true)
|
||||||
return .cancel
|
return .cancel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,8 +143,8 @@ extension ReadViewController: WKUIDelegate {
|
||||||
["http", "https"].contains(url.scheme?.lowercased()) else {
|
["http", "https"].contains(url.scheme?.lowercased()) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return UIContextMenuConfiguration(identifier: nil) {
|
return UIContextMenuConfiguration(identifier: nil) { [unowned self] in
|
||||||
SFSafariViewController(url: url)
|
self.createSafariVC(url: url)
|
||||||
} actionProvider: { _ in
|
} actionProvider: { _ in
|
||||||
return UIMenu(children: [
|
return UIMenu(children: [
|
||||||
UIAction(title: "Open in Safari", image: UIImage(systemName: "safari"), handler: { [weak self] _ in
|
UIAction(title: "Open in Safari", image: UIImage(systemName: "safari"), handler: { [weak self] _ in
|
||||||
|
|
|
@ -42,4 +42,6 @@ extension UIColor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static let appTintColor = UIColor.systemRed
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue