Set safari VC tint color

This commit is contained in:
Shadowfacts 2022-01-12 10:55:50 -05:00
parent e1296223fe
commit 415340882e
3 changed files with 12 additions and 4 deletions

View File

@ -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)

View File

@ -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

View File

@ -42,4 +42,6 @@ extension UIColor {
}
}
static let appTintColor = UIColor.systemRed
}