1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-08 12:40:26 +00:00

Center the Locked Vault modal when using passkeys

This commit is contained in:
Jeffrey Holland
2025-05-21 16:35:01 +02:00
parent a8f9671447
commit 34732a8896

View File

@@ -137,14 +137,10 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
}
private func getWindowPosition() -> Position {
let frame = self.view.window?.frame ?? .zero
let screenHeight = NSScreen.main?.frame.height ?? 0
// frame.width and frame.height is always 0. Estimating works OK for now.
let estimatedWidth:CGFloat = 400;
let estimatedHeight:CGFloat = 200;
let centerX = Int32(round(frame.origin.x + estimatedWidth/2))
let centerY = Int32(round(screenHeight - (frame.origin.y + estimatedHeight/2)))
let screenHeight = NSScreen.main?.frame.height ?? 0
let screenWidth = NSScreen.main?.frame.width ?? 0
let centerX = Int32(round(screenWidth)/2)
let centerY = Int32(round(screenHeight)/2)
return Position(x: centerX, y:centerY)
}