mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-05-02 06:16:16 -04:00
contact accept
This commit is contained in:
parent
b12cbcf684
commit
6f525843ff
4 changed files with 125 additions and 30 deletions
|
@ -111,7 +111,24 @@ class PasteInviteDialogState extends ConsumerState<PasteInviteDialog> {
|
|||
}
|
||||
final validInvitation = _validInvitation;
|
||||
if (validInvitation != null) {
|
||||
await acceptContactInvitation(activeAccountInfo, validInvitation);
|
||||
final acceptedContact =
|
||||
await acceptContactInvitation(activeAccountInfo, validInvitation);
|
||||
if (acceptedContact != null) {
|
||||
await createContact(
|
||||
activeAccountInfo: activeAccountInfo,
|
||||
profile: acceptedContact.profile,
|
||||
remoteIdentity: acceptedContact.remoteIdentity,
|
||||
remoteConversation: acceptedContact.remoteConversation,
|
||||
localConversation: acceptedContact.localConversation,
|
||||
);
|
||||
ref
|
||||
..invalidate(fetchContactInvitationRecordsProvider)
|
||||
..invalidate(fetchContactListProvider);
|
||||
} else {
|
||||
if (context.mounted) {
|
||||
showErrorToast(context, 'paste_invite_dialog.failed_to_accept');
|
||||
}
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
_isAccepting = false;
|
||||
|
@ -135,7 +152,13 @@ class PasteInviteDialogState extends ConsumerState<PasteInviteDialog> {
|
|||
}
|
||||
final validInvitation = _validInvitation;
|
||||
if (validInvitation != null) {
|
||||
await rejectContactInvitation(activeAccountInfo, validInvitation);
|
||||
if (await rejectContactInvitation(activeAccountInfo, validInvitation)) {
|
||||
// do nothing right now
|
||||
} else {
|
||||
if (context.mounted) {
|
||||
showErrorToast(context, 'paste_invite_dialog.failed_to_reject');
|
||||
}
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
_isAccepting = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue