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) {
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user