Embed mach service
This commit is contained in:
BIN
kordophone2/Daemon/kordophoned
Executable file
BIN
kordophone2/Daemon/kordophoned
Executable file
Binary file not shown.
26
kordophone2/Daemon/net.buzzert.kordophonecd.plist
Normal file
26
kordophone2/Daemon/net.buzzert.kordophonecd.plist
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>net.buzzert.kordophonecd</string>
|
||||
<key>BundleProgram</key>
|
||||
<string>Contents/MacOS/kordophoned</string>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>RUST_LOG</key>
|
||||
<string>info</string>
|
||||
</dict>
|
||||
<key>MachServices</key>
|
||||
<dict>
|
||||
<key>net.buzzert.kordophonecd</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/tmp/kordophoned.out.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/tmp/kordophoned.err.log</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -19,7 +19,7 @@ struct MessageEntryView: View
|
||||
.frame(height: 1.0)
|
||||
|
||||
HStack {
|
||||
TextField("", text: $viewModel.draftText, axis: .vertical)
|
||||
TextField("iMessage", text: $viewModel.draftText, axis: .vertical)
|
||||
.focusEffectDisabled(true)
|
||||
.textFieldStyle(.plain)
|
||||
.lineLimit(nil)
|
||||
@@ -30,7 +30,7 @@ struct MessageEntryView: View
|
||||
.padding(8.0)
|
||||
.disabled(selectedConversation == nil)
|
||||
.background {
|
||||
RoundedRectangle(cornerRadius: 6.0)
|
||||
RoundedRectangle(cornerRadius: 8.0)
|
||||
.stroke(SeparatorShapeStyle())
|
||||
.fill(.background)
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-only</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
|
||||
<array>
|
||||
<string>net.buzzert.kordophonecd</string>
|
||||
|
||||
@@ -29,6 +29,7 @@ struct TranscriptView: View
|
||||
.padding()
|
||||
}
|
||||
.scaleEffect(CGSize(width: 1.0, height: -1.0))
|
||||
.id(model.displayedConversation)
|
||||
.task { await watchForMessageListChanges() }
|
||||
}
|
||||
|
||||
@@ -103,7 +104,7 @@ struct TranscriptView: View
|
||||
|
||||
func attachmentDownloaded(id: String) {
|
||||
// TODO: should be smarter here
|
||||
setNeedsReload(animated: true)
|
||||
setNeedsReload(animated: false)
|
||||
}
|
||||
|
||||
private func observeDisplayedConversation() {
|
||||
|
||||
@@ -6,18 +6,35 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import ServiceManagement
|
||||
import XPC
|
||||
|
||||
private let serviceName = "net.buzzert.kordophonecd"
|
||||
|
||||
|
||||
final class XPCClient
|
||||
{
|
||||
private let connection: xpc_connection_t
|
||||
private let signalLock = NSLock()
|
||||
private var signalSinks: [UUID: (Signal) -> Void] = [:]
|
||||
private var didSubscribeSignals: Bool = false
|
||||
|
||||
static let appService: SMAppService = {
|
||||
do {
|
||||
let service = SMAppService.agent(plistName: "net.buzzert.kordophonecd.plist")
|
||||
if service.status != .enabled {
|
||||
try service.register()
|
||||
}
|
||||
|
||||
return service
|
||||
} catch {
|
||||
fatalError("Unable to register agent: \(error)")
|
||||
}
|
||||
}()
|
||||
|
||||
init() {
|
||||
_ = Self.appService
|
||||
|
||||
self.connection = xpc_connection_create_mach_service(serviceName, nil, 0)
|
||||
|
||||
let handler: xpc_handler_t = { [weak self] event in
|
||||
|
||||
Reference in New Issue
Block a user