Refactor project, add loading/editing/saving notes, add client/server basic logic

This commit is contained in:
2025-10-05 23:23:19 +02:00
parent 209e08754b
commit 58ad4d47fd
5 changed files with 130 additions and 4 deletions
+6 -1
View File
@@ -10,12 +10,13 @@ import SwiftUI
struct ContentView: View {
@AppStorage("peered_username") private var username: String = ""
@State private var notes = [Note]()
@State private var notesClient: NoteEditingSessionClient?
var body: some View {
NavigationView {
List(notes) { note in
NavigationLink(note.name) {
NoteEditorScreen(note: note)
NoteEditorScreen(note: note, username: username)
}
}
.navigationTitle("Peered")
@@ -28,6 +29,10 @@ struct ContentView: View {
}
.onAppear {
notes = NotesStorage().loadNotes()
if notesClient == nil {
notesClient = .init(id: username)
}
notesClient?.startBrowsingForNotes()
}
.sheet(isPresented: .constant(username.isEmpty)) {
SetUserNameBottomSheetView(username: $username)