Browse Source

Improved support for calls service messages

master
Igor Zhukov 7 years ago
parent
commit
facd3bfd2d
  1. 8
      app/js/locales/en-us.json
  2. 25
      app/js/messages_manager.js
  3. 14
      app/partials/desktop/message_service.html
  4. 6
      app/partials/desktop/short_message.html
  5. 14
      app/partials/mobile/message_service.html

8
app/js/locales/en-us.json

@ -359,10 +359,10 @@ @@ -359,10 +359,10 @@
"message_service_joined_by_link": "joined group via invite link",
"message_service_joined": "joined the group",
"message_service_pinned_message": "pinned «{message}»",
"message_service_phonecall_incoming": "Incoming Call {duration}",
"message_service_phonecall_outgoing": "Outgoing Call {duration}",
"message_service_phonecall_missed": "Missed Call {duration}",
"message_service_phonecall_canceled": "Canceled Call {duration}",
"message_service_phonecall_incoming": "Incoming Call",
"message_service_phonecall_outgoing": "Outgoing Call",
"message_service_phonecall_missed": "Missed Call",
"message_service_phonecall_canceled": "Canceled Call",
"message_service_phonecall": "Phone call {duration}",
"message_service_scored_game": "{scored} in {message}",
"message_service_unsupported_action": "unsupported action {action}",

25
app/js/messages_manager.js

@ -1356,6 +1356,14 @@ angular.module('myApp.services') @@ -1356,6 +1356,14 @@ angular.module('myApp.services')
case 'messageActionPhoneCall':
delete apiMessage.fromID
apiMessage.action.type =
(apiMessage.pFlags.out ? 'out_' : 'in_') +
(
apiMessage.action.reason._ == 'phoneCallDiscardReasonMissed' ||
apiMessage.action.reason._ == 'phoneCallDiscardReasonBusy'
? 'missed'
: 'ok'
)
break
}
if (migrateFrom &&
@ -2777,6 +2785,23 @@ angular.module('myApp.services') @@ -2777,6 +2785,23 @@ angular.module('myApp.services')
case 'messageActionGameScore':
notificationMessage = gameScorePluralize(message.action.score)
break
case 'messageActionPhoneCall':
switch (message.action.type) {
case 'out_missed':
notificationMessage = _('message_service_phonecall_canceled_raw')
break
case 'in_missed':
notificationMessage = _('message_service_phonecall_missed_raw')
break
case 'out_ok':
notificationMessage = _('message_service_phonecall_outgoing_raw')
break
case 'in_ok':
notificationMessage = _('message_service_phonecall_incoming_raw')
break
}
break
}
}

14
app/partials/desktop/message_service.html

@ -42,14 +42,12 @@ @@ -42,14 +42,12 @@
<my-i18n-param name="message"><a class="im_service_message_pinned" my-pinned-message="::historyMessage.reply_to_mid"></a></my-i18n-param>
</span>
<a ng-switch-when="messageActionPhoneCall" class="im_service_message_phonecall" ng-click="phoneCallClick(historyMessage.mid)">
<my-i18n ng-switch="(historyMessage.pFlags.out ? 'out' : 'in') + (historyMessage.action.reason._ == 'phoneCallDiscardReasonMissed' || historyMessage.action.reason._ == 'phoneCallDiscardReasonBusy' ? 'missed' : 'ok')">
<span ng-switch-when="outmissed" my-i18n-format="message_service_phonecall_canceled"></span>
<span ng-switch-when="inmissed" my-i18n-format="message_service_phonecall_missed"></span>
<span ng-switch-when="outok" my-i18n-format="message_service_phonecall_outgoing"></span>
<span ng-switch-when="inok" my-i18n-format="message_service_phonecall_incoming"></span>
<my-i18n-param name="duration"><span ng-if="historyMessage.action.duration > 0" ng-bind="historyMessage.action.duration | duration" class="im_service_message_phonecall_duration"></span></my-i18n-param>
</my-i18n>
<a ng-switch-when="messageActionPhoneCall" class="im_service_message_phonecall" ng-click="phoneCallClick(historyMessage.mid)" ng-switch="historyMessage.action.type">
<span ng-switch-when="out_missed" my-i18n="message_service_phonecall_canceled"></span>
<span ng-switch-when="in_missed" my-i18n="message_service_phonecall_missed"></span>
<span ng-switch-when="out_ok" my-i18n="message_service_phonecall_outgoing"></span>
<span ng-switch-when="in_ok" my-i18n="message_service_phonecall_incoming"></span>
<span ng-if="historyMessage.action.duration > 0" ng-bind="historyMessage.action.duration | duration" class="im_service_message_phonecall_duration"></span>
</a>

6
app/partials/desktop/short_message.html

@ -49,5 +49,11 @@ @@ -49,5 +49,11 @@
when="conversation_scored_X"></ng-pluralize>
</my-i18n-param>
</span>
<span ng-switch-when="messageActionPhoneCall" ng-switch="message.action.type">
<span ng-switch-when="out_missed" my-i18n="message_service_phonecall_canceled"></span>
<span ng-switch-when="in_missed" my-i18n="message_service_phonecall_missed"></span>
<span ng-switch-when="out_ok" my-i18n="message_service_phonecall_outgoing"></span>
<span ng-switch-when="in_ok" my-i18n="message_service_phonecall_incoming"></span>
</span>
</span><span class="im_short_message_text" ng-if="message.message.length && (!message.media || message.media._ == 'messageMediaWebPage')" ng-bind-html="message.richMessage"></span>

14
app/partials/mobile/message_service.html

@ -42,14 +42,12 @@ @@ -42,14 +42,12 @@
<my-i18n-param name="message"><a my-pinned-message="historyMessage.reply_to_mid"></a></my-i18n-param>
</span>
<a ng-switch-when="messageActionPhoneCall" class="im_service_message_phonecall" ng-click="phoneCallClick(historyMessage.mid)">
<my-i18n ng-switch="(historyMessage.pFlags.out ? 'out' : 'in') + (historyMessage.action.reason._ == 'phoneCallDiscardReasonMissed' || historyMessage.action.reason._ == 'phoneCallDiscardReasonBusy' ? 'missed' : 'ok')">
<span ng-switch-when="outmissed" my-i18n-format="message_service_phonecall_canceled"></span>
<span ng-switch-when="inmissed" my-i18n-format="message_service_phonecall_missed"></span>
<span ng-switch-when="outok" my-i18n-format="message_service_phonecall_outgoing"></span>
<span ng-switch-when="inok" my-i18n-format="message_service_phonecall_incoming"></span>
<my-i18n-param name="duration"><span ng-if="historyMessage.action.duration > 0" ng-bind="historyMessage.action.duration | duration" class="im_service_message_phonecall_duration"></span></my-i18n-param>
</my-i18n>
<a ng-switch-when="messageActionPhoneCall" class="im_service_message_phonecall" ng-click="phoneCallClick(historyMessage.mid)" ng-switch="historyMessage.action.type">
<span ng-switch-when="out_missed" my-i18n="message_service_phonecall_canceled"></span>
<span ng-switch-when="in_missed" my-i18n="message_service_phonecall_missed"></span>
<span ng-switch-when="out_ok" my-i18n="message_service_phonecall_outgoing"></span>
<span ng-switch-when="in_ok" my-i18n="message_service_phonecall_incoming"></span>
<span ng-if="historyMessage.action.duration > 0" ng-bind="historyMessage.action.duration | duration" class="im_service_message_phonecall_duration"></span>
</a>
<span ng-switch-default my-i18n="message_service_unsupported_action">

Loading…
Cancel
Save