mirror of
https://github.com/readest/readest.git
synced 2026-04-29 12:00:49 +00:00
fix(iOS): correct sidebar insets on iPad and resolve occasional stale safe area inset on iOS (#3395)
This commit is contained in:
parent
67249370c9
commit
6ad549d13c
5 changed files with 41 additions and 24 deletions
|
|
@ -889,6 +889,28 @@ class NativeBridgePlugin: Plugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@objc public func get_safe_area_insets(_ invoke: Invoke) {
|
||||
DispatchQueue.main.async {
|
||||
if let window = UIApplication.shared.windows.first {
|
||||
let insets = window.safeAreaInsets
|
||||
invoke.resolve([
|
||||
"top": insets.top,
|
||||
"left": insets.left,
|
||||
"bottom": insets.bottom,
|
||||
"right": insets.right
|
||||
])
|
||||
} else {
|
||||
invoke.resolve([
|
||||
"error": "No window found",
|
||||
"top": 0,
|
||||
"left": 0,
|
||||
"bottom": 0,
|
||||
"right": 0
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@_cdecl("init_plugin_native_bridge")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue