Fix multi-window, turn off sandboxing
This commit is contained in:
@@ -9,33 +9,10 @@ import SwiftUI
|
||||
|
||||
@main
|
||||
struct KordophoneApp: App
|
||||
{
|
||||
@State var conversationListModel = ConversationListView.ViewModel()
|
||||
@State var transcriptViewModel = TranscriptView.ViewModel()
|
||||
@State var entryViewModel = MessageEntryView.ViewModel()
|
||||
|
||||
private let xpcClient = XPCClient()
|
||||
private var selectedConversation: Display.Conversation? {
|
||||
guard let id = conversationListModel.selectedConversations.first else { return nil }
|
||||
return conversationListModel.conversations.first { $0.id == id }
|
||||
}
|
||||
|
||||
{
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
NavigationSplitView {
|
||||
ConversationListView(model: $conversationListModel)
|
||||
.frame(minWidth: 330.0)
|
||||
.xpcClient(xpcClient)
|
||||
} detail: {
|
||||
ConversationView(transcriptModel: $transcriptViewModel, entryModel: $entryViewModel)
|
||||
.xpcClient(xpcClient)
|
||||
.selectedConversation(selectedConversation)
|
||||
.navigationTitle("Kordophone")
|
||||
.navigationSubtitle(selectedConversation?.displayName ?? "")
|
||||
.onChange(of: conversationListModel.selectedConversations) { oldValue, newValue in
|
||||
transcriptViewModel.displayedConversation = newValue.first
|
||||
}
|
||||
}
|
||||
SplitView()
|
||||
}
|
||||
|
||||
Settings {
|
||||
@@ -48,21 +25,3 @@ struct KordophoneApp: App
|
||||
print("Error: \(e.localizedDescription)")
|
||||
}
|
||||
}
|
||||
|
||||
extension EnvironmentValues
|
||||
{
|
||||
@Entry var xpcClient: XPCClient = XPCClient()
|
||||
@Entry var selectedConversation: Display.Conversation? = nil
|
||||
}
|
||||
|
||||
extension View
|
||||
{
|
||||
func xpcClient(_ client: XPCClient) -> some View {
|
||||
environment(\.xpcClient, client)
|
||||
}
|
||||
|
||||
func selectedConversation(_ convo: Display.Conversation?) -> some View {
|
||||
environment(\.selectedConversation, convo)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
26
kordophone2/Environment.swift
Normal file
26
kordophone2/Environment.swift
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Environment.swift
|
||||
// kordophone2
|
||||
//
|
||||
// Created by James Magahern on 8/29/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
extension EnvironmentValues
|
||||
{
|
||||
@Entry var xpcClient: XPCClient = XPCClient()
|
||||
@Entry var selectedConversation: Display.Conversation? = nil
|
||||
}
|
||||
|
||||
extension View
|
||||
{
|
||||
func xpcClient(_ client: XPCClient) -> some View {
|
||||
environment(\.xpcClient, client)
|
||||
}
|
||||
|
||||
func selectedConversation(_ convo: Display.Conversation?) -> some View {
|
||||
environment(\.selectedConversation, convo)
|
||||
}
|
||||
}
|
||||
|
||||
38
kordophone2/SplitView.swift
Normal file
38
kordophone2/SplitView.swift
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// SplitView.swift
|
||||
// kordophone2
|
||||
//
|
||||
// Created by James Magahern on 8/29/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SplitView: View
|
||||
{
|
||||
@State var conversationListModel = ConversationListView.ViewModel()
|
||||
@State var transcriptViewModel = TranscriptView.ViewModel()
|
||||
@State var entryViewModel = MessageEntryView.ViewModel()
|
||||
|
||||
private let xpcClient = XPCClient()
|
||||
private var selectedConversation: Display.Conversation? {
|
||||
guard let id = conversationListModel.selectedConversations.first else { return nil }
|
||||
return conversationListModel.conversations.first { $0.id == id }
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationSplitView {
|
||||
ConversationListView(model: $conversationListModel)
|
||||
.frame(minWidth: 330.0)
|
||||
.xpcClient(xpcClient)
|
||||
} detail: {
|
||||
ConversationView(transcriptModel: $transcriptViewModel, entryModel: $entryViewModel)
|
||||
.xpcClient(xpcClient)
|
||||
.selectedConversation(selectedConversation)
|
||||
.navigationTitle("Kordophone")
|
||||
.navigationSubtitle(selectedConversation?.displayName ?? "")
|
||||
.onChange(of: conversationListModel.selectedConversations) { oldValue, newValue in
|
||||
transcriptViewModel.displayedConversation = newValue.first
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,6 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user