From 54df338ce04cb71e25903822a1698020d239023f Mon Sep 17 00:00:00 2001 From: James Magahern Date: Fri, 29 Aug 2025 18:49:00 -0600 Subject: [PATCH] Some minor changes --- kordophone2/ConversationListView.swift | 12 +++++++++--- .../Transcript/TranscriptDisplayItemViews.swift | 2 ++ kordophone2/XPC/XPCClient.swift | 7 +++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/kordophone2/ConversationListView.swift b/kordophone2/ConversationListView.swift index 37df92f..656de92 100644 --- a/kordophone2/ConversationListView.swift +++ b/kordophone2/ConversationListView.swift @@ -17,9 +17,15 @@ struct ConversationListView: View let isUnread = conv.wrappedValue.unreadCount > 0 HStack(spacing: 0.0) { - Image(systemName: isUnread ? "circlebadge.fill" : "") - .foregroundStyle(.tint) - .frame(width: 10.0) + if isUnread { + Image(systemName: "circlebadge.fill") + .foregroundStyle(.tint) + .frame(width: 10.0) + } else { + Rectangle() + .foregroundStyle(.clear) + .frame(width: 10.0) + } VStack(alignment: .leading) { Text(conv.wrappedValue.displayName) diff --git a/kordophone2/Transcript/TranscriptDisplayItemViews.swift b/kordophone2/Transcript/TranscriptDisplayItemViews.swift index 2b5c1cd..f6d6f16 100644 --- a/kordophone2/Transcript/TranscriptDisplayItemViews.swift +++ b/kordophone2/Transcript/TranscriptDisplayItemViews.swift @@ -128,6 +128,8 @@ struct ImageItemView: View let ns = NSImage(data: data) { img = ns } + + try handle.close() } catch { print("Attachment file handle acquisition error: \(error)") } diff --git a/kordophone2/XPC/XPCClient.swift b/kordophone2/XPC/XPCClient.swift index 878756f..0b66ffc 100644 --- a/kordophone2/XPC/XPCClient.swift +++ b/kordophone2/XPC/XPCClient.swift @@ -148,9 +148,11 @@ final class XPCClient guard let reply = try await sendSync(req), xpc_get_type(reply) == XPC_TYPE_DICTIONARY else { throw Error.typeError } let fd = xpc_dictionary_dup_fd(reply, "fd") - if fd < 0 { throw Error.typeError } + let fileHandler = FileHandle(fileDescriptor: fd, closeOnDealloc: true) - return FileHandle(fileDescriptor: fd, closeOnDealloc: true) + if fd < 0 { throw Error.badFileHandle } + + return fileHandler } public func getSettings() async throws -> Serialized.Settings { @@ -177,6 +179,7 @@ final class XPCClient { case typeError case encodingError + case badFileHandle } enum Signal