Remove some no-longer-needed #available checks.
This commit is contained in:
parent
bdd858f509
commit
f96ba4943c
@ -94,19 +94,6 @@ final class DetailWebViewController: NSViewController {
|
||||
|
||||
view = webView
|
||||
|
||||
// Use the safe area layout guides if they are available.
|
||||
if #available(OSX 11.0, *) {
|
||||
// These constraints have been removed as they were unsatisfiable after removing NSBox.
|
||||
} else {
|
||||
let constraints = [
|
||||
webView.topAnchor.constraint(equalTo: view.topAnchor),
|
||||
webView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
||||
webView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
webView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||
]
|
||||
NSLayoutConstraint.activate(constraints)
|
||||
}
|
||||
|
||||
// Hide the web view until the first reload (navigation) is complete (plus some delay) to avoid the awful white flash that happens on the initial display in dark mode.
|
||||
// See bug #901.
|
||||
webView.isHidden = true
|
||||
@ -318,10 +305,7 @@ private extension DetailWebViewController {
|
||||
}
|
||||
|
||||
func fetchScrollInfo(_ completion: @escaping (ScrollInfo?) -> Void) {
|
||||
var javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: document.body.scrollTop}; x"
|
||||
if #available(macOS 10.15, *) {
|
||||
javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: window.pageYOffset}; x"
|
||||
}
|
||||
let javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: window.pageYOffset}; x"
|
||||
|
||||
webView.evaluateJavaScript(javascriptString) { (info, error) in
|
||||
guard let info = info as? [String: Any] else {
|
||||
|
@ -34,35 +34,33 @@ public final class WidgetDataEncoder {
|
||||
}
|
||||
|
||||
func encode() {
|
||||
if #available(iOS 14, *) {
|
||||
isRunning = true
|
||||
|
||||
flushSharedContainer()
|
||||
os_log(.debug, log: log, "Starting encoding widget data.")
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.encodeWidgetData() { latestData in
|
||||
guard let latestData = latestData else {
|
||||
self.isRunning = false
|
||||
return
|
||||
}
|
||||
|
||||
let encodedData = try? JSONEncoder().encode(latestData)
|
||||
|
||||
os_log(.debug, log: self.log, "Finished encoding widget data.")
|
||||
|
||||
if self.fileExists() {
|
||||
try? FileManager.default.removeItem(at: self.dataURL!)
|
||||
os_log(.debug, log: self.log, "Removed widget data from container.")
|
||||
}
|
||||
|
||||
if FileManager.default.createFile(atPath: self.dataURL!.path, contents: encodedData, attributes: nil) {
|
||||
os_log(.debug, log: self.log, "Wrote widget data to container.")
|
||||
WidgetCenter.shared.reloadAllTimelines()
|
||||
}
|
||||
|
||||
isRunning = true
|
||||
|
||||
flushSharedContainer()
|
||||
os_log(.debug, log: log, "Starting encoding widget data.")
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.encodeWidgetData() { latestData in
|
||||
guard let latestData = latestData else {
|
||||
self.isRunning = false
|
||||
return
|
||||
}
|
||||
|
||||
let encodedData = try? JSONEncoder().encode(latestData)
|
||||
|
||||
os_log(.debug, log: self.log, "Finished encoding widget data.")
|
||||
|
||||
if self.fileExists() {
|
||||
try? FileManager.default.removeItem(at: self.dataURL!)
|
||||
os_log(.debug, log: self.log, "Removed widget data from container.")
|
||||
}
|
||||
|
||||
if FileManager.default.createFile(atPath: self.dataURL!.path, contents: encodedData, attributes: nil) {
|
||||
os_log(.debug, log: self.log, "Wrote widget data to container.")
|
||||
WidgetCenter.shared.reloadAllTimelines()
|
||||
}
|
||||
|
||||
self.isRunning = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user