From cf3624264eb2e846ea2a2f7a562289605dccf4c2 Mon Sep 17 00:00:00 2001 From: David Perez Date: Wed, 16 Oct 2024 11:43:46 -0500 Subject: [PATCH] PM-13726: Process cipher notifications without organizationIds or collectionIds (#4102) --- .../data/platform/manager/PushManagerImpl.kt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/PushManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/PushManagerImpl.kt index b17da2a6f..1f37ba976 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/PushManagerImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/PushManagerImpl.kt @@ -162,19 +162,14 @@ class PushManagerImpl @Inject constructor( string = notification.payload, ) .takeIf { isLoggedIn(userId) && it.userMatchesNotification(userId) } - ?.takeIf { - it.cipherId != null && - it.revisionDate != null && - it.organizationId != null && - it.collectionIds != null - } + ?.takeIf { it.cipherId != null && it.revisionDate != null } ?.let { mutableSyncCipherUpsertSharedFlow.tryEmit( SyncCipherUpsertData( cipherId = requireNotNull(it.cipherId), revisionDate = requireNotNull(it.revisionDate), - organizationId = requireNotNull(it.organizationId), - collectionIds = requireNotNull(it.collectionIds), + organizationId = it.organizationId, + collectionIds = it.collectionIds, isUpdate = type == NotificationType.SYNC_CIPHER_UPDATE, ), ) @@ -339,6 +334,6 @@ class PushManagerImpl @Inject constructor( ): Boolean = authDiskSource.getAccountTokens(userId)?.isLoggedIn == true } -private fun NotificationPayload.userMatchesNotification(userId: String?): Boolean { +private fun NotificationPayload.userMatchesNotification(userId: String): Boolean { return this.userId != null && this.userId == userId }