Private
Public Access
1
0

Adds keychain support

This commit is contained in:
2025-08-29 15:12:54 -06:00
parent 402b5a5f80
commit 5da92a90d4
3 changed files with 69 additions and 1 deletions

View File

@@ -71,16 +71,51 @@ struct ImageItemView: View
@State private var img: NSImage?
@Environment(\.xpcClient) var xpcClient
@State private var containerWidth: CGFloat? = nil
var aspectRatio: CGFloat {
if let size = attachment.size, size.height > 0 {
return size.width / size.height
} else {
return 1.0
}
}
var preferredSize: CGSize {
return CGSize(
width: preferredWidth,
height: preferredWidth / aspectRatio
)
}
var preferredWidth: CGFloat {
if let containerWidth, let attachmentWidth = attachment.size?.width {
return CGFloat.minimum(containerWidth, attachmentWidth)
} else if let containerWidth {
return containerWidth
} else {
return 200.0 // fallback
}
}
var body: some View {
BubbleView(isFromMe: isFromMe) {
if let img {
Image(nsImage: img)
.resizable()
.scaledToFit()
.frame(
maxWidth: containerWidth
)
} else {
ProgressView()
Rectangle()
.fill(.gray)
}
}
.onGeometryChange(for: CGFloat.self,
of: { $0.size.width },
action: { containerWidth = $0 })
.task {
do {
let handle = try await xpcClient.openAttachmentFileHandle(