mirror of
https://github.com/bitwarden/mobile
synced 2026-01-04 09:33:16 +00:00
[PM-2901] Synchronize sends on send creation/update/deletion notification (#2606)
* Add sync on send create/update/delete notification * Update send notifications to only sync sends * Fix incorrect notification type in PushNotificationListenerService Co-authored-by: aj-rosado <109146700+aj-rosado@users.noreply.github.com> * Invert if to improve readability * Simplify shouldUpdate logic in SyncUpsertSendAsync * Further simplify SyncService code * Fix if condition in SyncService Co-authored-by: aj-rosado <109146700+aj-rosado@users.noreply.github.com> * Fixed whitespace formatting --------- Co-authored-by: aj-rosado <109146700+aj-rosado@users.noreply.github.com> Co-authored-by: Andre Rosado <arosado@bitwarden.com>
This commit is contained in:
@@ -131,6 +131,24 @@ namespace Bit.App.Services
|
||||
_messagingService.Value.Send("logout");
|
||||
}
|
||||
break;
|
||||
case NotificationType.SyncSendCreate:
|
||||
case NotificationType.SyncSendUpdate:
|
||||
var sendCreateUpdateMessage = JsonConvert.DeserializeObject<SyncSendNotification>(
|
||||
notification.Payload);
|
||||
if (isAuthenticated && sendCreateUpdateMessage.UserId == myUserId)
|
||||
{
|
||||
await _syncService.Value.SyncUpsertSendAsync(sendCreateUpdateMessage,
|
||||
notification.Type == NotificationType.SyncSendUpdate);
|
||||
}
|
||||
break;
|
||||
case NotificationType.SyncSendDelete:
|
||||
var sendDeleteMessage = JsonConvert.DeserializeObject<SyncSendNotification>(
|
||||
notification.Payload);
|
||||
if (isAuthenticated && sendDeleteMessage.UserId == myUserId)
|
||||
{
|
||||
await _syncService.Value.SyncDeleteSendAsync(sendDeleteMessage);
|
||||
}
|
||||
break;
|
||||
case NotificationType.AuthRequest:
|
||||
var passwordlessLoginMessage = JsonConvert.DeserializeObject<PasswordlessRequestNotification>(notification.Payload);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user