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 }
|
||||
|
||||
window = UIWindow(windowScene: windowScene)
|
||||
window!.tintColor = .systemRed
|
||||
window!.tintColor = .appTintColor
|
||||
|
||||
if let account = LocalData.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 {
|
||||
|
@ -125,7 +131,7 @@ extension ReadViewController: WKNavigationDelegate {
|
|||
if url == item.url {
|
||||
return .allow
|
||||
} else {
|
||||
present(SFSafariViewController(url: url), animated: true)
|
||||
present(createSafariVC(url: url), animated: true)
|
||||
return .cancel
|
||||
}
|
||||
}
|
||||
|
@ -137,8 +143,8 @@ extension ReadViewController: WKUIDelegate {
|
|||
["http", "https"].contains(url.scheme?.lowercased()) else {
|
||||
return nil
|
||||
}
|
||||
return UIContextMenuConfiguration(identifier: nil) {
|
||||
SFSafariViewController(url: url)
|
||||
return UIContextMenuConfiguration(identifier: nil) { [unowned self] in
|
||||
self.createSafariVC(url: url)
|
||||
} actionProvider: { _ in
|
||||
return UIMenu(children: [
|
||||
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