improve handling of user invitation

This commit is contained in:
2026-05-16 14:27:00 +02:00
parent 10e08435a7
commit c55b8e38ca
@@ -47,12 +47,12 @@ final class NoteEditingSessionServer: NSObject {
} }
func invite(peer: Peer, to note: NoteInvitation.NoteContent) { func invite(peer: Peer, to note: NoteInvitation.NoteContent) {
guard peer.state == .available else { return } guard peer.state == .available, let note = try? JSONEncoder().encode(note) else { return }
browser.invitePeer( browser.invitePeer(
peer.mcPeer, peer.mcPeer,
to: session, to: session,
withContext: try! JSONEncoder().encode(note), withContext: note,
timeout: 5 timeout: 600
) )
guard let idxToUpdate = visiblePeers.firstIndex(where: { $0.mcPeer == peer.mcPeer }) else { return } guard let idxToUpdate = visiblePeers.firstIndex(where: { $0.mcPeer == peer.mcPeer }) else { return }
visiblePeers[idxToUpdate].state = .invitationPending visiblePeers[idxToUpdate].state = .invitationPending