improve handling of user invitation
This commit is contained in:
@@ -47,12 +47,12 @@ final class NoteEditingSessionServer: NSObject {
|
||||
}
|
||||
|
||||
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(
|
||||
peer.mcPeer,
|
||||
to: session,
|
||||
withContext: try! JSONEncoder().encode(note),
|
||||
timeout: 5
|
||||
withContext: note,
|
||||
timeout: 600
|
||||
)
|
||||
guard let idxToUpdate = visiblePeers.firstIndex(where: { $0.mcPeer == peer.mcPeer }) else { return }
|
||||
visiblePeers[idxToUpdate].state = .invitationPending
|
||||
|
||||
Reference in New Issue
Block a user