Add showing visible members that aren't us
based on very flaky display name checking for now
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user