Add showing visible members that aren't us

based on very flaky display name checking for now
This commit is contained in:
2025-10-06 23:23:26 +02:00
parent 58ad4d47fd
commit 87753865e2
6 changed files with 131 additions and 16 deletions
+16 -2
View File
@@ -6,6 +6,7 @@
//
import SwiftUI
import MultipeerConnectivity
struct NoteEditorScreen: View {
let note: Note
@@ -13,14 +14,27 @@ struct NoteEditorScreen: View {
@State private var noteContent: String = ""
@State private var timer = Timer.publish(every: 5, on: .current, in: .common)
.autoconnect()
@State private var showManageMembers = false
init(note: Note, username: String) {
init(note: Note, peer: OwnPeer) {
self.note = note
self._noteAdvertiser = .init(wrappedValue: .init(username: username))
self._noteAdvertiser = .init(initialValue: .init(peer: peer))
}
var body: some View {
TextEditor(text: $noteContent)
.toolbar {
ToolbarItem(placement: .primaryAction) {
Button("Manage members") {
showManageMembers = true
}
}
}
.sheet(isPresented: $showManageMembers) {
NavigationStack {
ManageMembersView(noteAdvertiser: noteAdvertiser)
}
}
.onAppear {
noteContent = try! String(contentsOf: note.path, encoding: .utf8)
noteAdvertiser.startServer()