From 00d3d120aacb3f36da80edd1ca829afc045331e9 Mon Sep 17 00:00:00 2001 From: AndyLnd Date: Thu, 14 May 2020 16:08:26 +0200 Subject: [PATCH] feat: Show warning when receiving call with outdated client (#8798) --- src/i18n/en-US.json | 2 ++ src/script/calling/CallingRepository.ts | 10 ++++++++++ src/script/conversation/ConversationRepository.js | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/i18n/en-US.json b/src/i18n/en-US.json index 0e3f5acf943..90c8fa61d68 100644 --- a/src/i18n/en-US.json +++ b/src/i18n/en-US.json @@ -601,6 +601,8 @@ "modalCallSecondOutgoingAction": "Call Anyway", "modalCallSecondOutgoingHeadline": "Hang up current call?", "modalCallSecondOutgoingMessage": "A call is active in another conversation. Calling here will hang up the other call.", + "modalCallUpdateClientHeadline": "Please update {{brandName}}", + "modalCallUpdateClientMessage": "You received a call that isn't supported by this version of {{brandName}}.", "modalConfirmSecondary": "Cancel", "modalConnectAcceptAction": "Connect", "modalConnectAcceptHeadline": "Accept?", diff --git a/src/script/calling/CallingRepository.ts b/src/script/calling/CallingRepository.ts index 7d19a7eaf2c..ff546fa6d9d 100644 --- a/src/script/calling/CallingRepository.ts +++ b/src/script/calling/CallingRepository.ts @@ -30,6 +30,7 @@ import { STATE as CALL_STATE, VIDEO_STATE, Wcall, + ERROR, } from '@wireapp/avs'; import {Calling, GenericMessage} from '@wireapp/protocol-messaging'; import {WebAppEvents} from '@wireapp/webapp-events'; @@ -382,6 +383,15 @@ export class CallingRepository { if (res !== 0) { this.logger.warn(`recv_msg failed with code: ${res}`); + if (res === ERROR.UNKNOWN_PROTOCOL) { + const brandName = Config.getConfig().BRAND_NAME; + amplify.publish(WebAppEvents.WARNING.MODAL, ModalsViewModel.TYPE.ACKNOWLEDGE, { + text: { + message: t('modalCallUpdateClientMessage', brandName), + title: t('modalCallUpdateClientHeadline', brandName), + }, + }); + } return; } this.handleCallEventSaving(content.type, conversationId, userId, time, source); diff --git a/src/script/conversation/ConversationRepository.js b/src/script/conversation/ConversationRepository.js index 4dc73efcbc4..f26a86ebe90 100644 --- a/src/script/conversation/ConversationRepository.js +++ b/src/script/conversation/ConversationRepository.js @@ -2857,7 +2857,7 @@ export class ConversationRepository { return this.grantMessage(eventInfoEntity, consentType, userIds); } - grantMessage(eventInfoEntity, consentType, userIds, shouldShowLegalHoldWarning = false) { + grantMessage(eventInfoEntity, consentType, userIds = null, shouldShowLegalHoldWarning = false) { return this.get_conversation_by_id(eventInfoEntity.conversationId).then(conversationEntity => { const legalHoldMessageTypes = [ GENERIC_MESSAGE_TYPE.ASSET,