initial commit
This commit is contained in:
44
kordophone2/App.swift
Normal file
44
kordophone2/App.swift
Normal file
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// kordophone2App.swift
|
||||
// kordophone2
|
||||
//
|
||||
// Created by James Magahern on 8/24/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct KordophoneApp: App
|
||||
{
|
||||
@State var conversationListModel = ConversationListView.ViewModel()
|
||||
|
||||
private let xpcClient = XPCClient()
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
NavigationSplitView {
|
||||
ConversationListView(model: $conversationListModel)
|
||||
.frame(minWidth: 330.0)
|
||||
.task {
|
||||
await refreshConversations()
|
||||
}
|
||||
} detail: {
|
||||
// Detail
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func refreshConversations() async {
|
||||
do {
|
||||
let conversations = try await xpcClient.getConversations()
|
||||
conversationListModel.conversations = conversations.map { Display.Conversation(from: $0) }
|
||||
} catch {
|
||||
reportError(error)
|
||||
}
|
||||
}
|
||||
|
||||
private func reportError(_ e: Error) {
|
||||
// Just printing for now.
|
||||
print("Error: \(e.localizedDescription)")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user