Added basic support for Telegram calls
Service messages for calls Alert with download link Closes #1404 Closes #1376
This commit is contained in:
parent
092685db5a
commit
e6395fac83
@ -534,9 +534,26 @@ angular.module('myApp.directives', ['myApp.filters'])
|
||||
}
|
||||
})
|
||||
|
||||
.directive('myServiceMessage', function () {
|
||||
.directive('myServiceMessage', function (ErrorService, AppMessagesManager) {
|
||||
return {
|
||||
templateUrl: templateUrl('message_service')
|
||||
templateUrl: templateUrl('message_service'),
|
||||
scope: {
|
||||
'historyMessage': '=myServiceMessage'
|
||||
},
|
||||
link: link
|
||||
}
|
||||
|
||||
function link ($scope, element, attrs) {
|
||||
$scope.phoneCallClick = function (messageID) {
|
||||
var message = AppMessagesManager.getMessage(messageID)
|
||||
var userID = AppMessagesManager.getMessagePeer(message)
|
||||
ErrorService.show({
|
||||
error: {
|
||||
type: 'PHONECALLS_NOT_SUPPORTED',
|
||||
userID: userID
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -359,6 +359,11 @@
|
||||
"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": "Phone call {duration}",
|
||||
"message_service_scored_game": "{scored} in {message}",
|
||||
"message_service_unsupported_action": "unsupported action {action}",
|
||||
"message_service_bot_intro_header": "What can this bot do?",
|
||||
@ -391,6 +396,7 @@
|
||||
"error_modal_password_success_title": "Success!",
|
||||
"error_modal_password_disabled_title": "Password deactivated",
|
||||
"error_modal_media_not_supported_title": "Unsupported media",
|
||||
"error_modal_phonecalls_not_supported_title": "Calls are not available",
|
||||
"error_modal_recovery_na_title": "Sorry",
|
||||
|
||||
"error_modal_network_description": "Please check your internet connection.",
|
||||
@ -408,6 +414,7 @@
|
||||
"error_modal_username_occupied_description": "Sorry, this username is already taken.",
|
||||
"error_modal_media_not_supported_description": "Your browser cannot play this media file. Try downloading the file and opening it in a standalone player.",
|
||||
"error_modal_username_not_found_description": "There is no Telegram account with the username you provided.",
|
||||
"error_modal_phonecalls_not_supported_description_md": "Unfortunately calls are not supported in Web App at the moment.\nYou can call {user} via mobile apps or native desktop applications.\n{download-link: Download »}",
|
||||
|
||||
"error_modal_bad_request_description": "One of the params is missing or invalid.",
|
||||
"error_modal_unauthorized_description": "This action requires authorization access. Please {login-link: log in}.",
|
||||
|
@ -1353,6 +1353,10 @@ angular.module('myApp.services')
|
||||
apiMessage.pFlags.out = false
|
||||
apiMessage.pFlags.unread = false
|
||||
break
|
||||
|
||||
case 'messageActionPhoneCall':
|
||||
delete apiMessage.fromID
|
||||
break
|
||||
}
|
||||
if (migrateFrom &&
|
||||
migrateTo &&
|
||||
|
@ -2130,6 +2130,13 @@ img.im_message_document_thumb {
|
||||
text-overflow: ellipsis;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.im_service_message_phonecall {
|
||||
color: inherit !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
.im_service_message_phonecall_duration {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.im_message_date,
|
||||
.im_message_fwd_date {
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
<h4 ng-if="error" class="md_simple_header" ng-switch="error.type">
|
||||
<span ng-switch-when="MEDIA_TYPE_NOT_SUPPORTED" my-i18n="error_modal_media_not_supported_title"></span>
|
||||
<span ng-switch-when="PHONECALLS_NOT_SUPPORTED" my-i18n="error_modal_phonecalls_not_supported_title"></span>
|
||||
<span ng-switch-when="USERNAME_NOT_OCCUPIED" my-i18n="error_modal_not_found_title"></span>
|
||||
<span ng-switch-when="PASSWORD_RECOVERY_NA" my-i18n="error_modal_recovery_na_title"></span>
|
||||
<span ng-switch-default ng-switch="error.code">
|
||||
@ -52,6 +53,11 @@
|
||||
<span ng-switch-when="2FA_CONFIRM_WAIT_TIME" my-i18n="error_modal_2fa_delayed_time_md">
|
||||
<my-i18n-param name="time"><span ng-bind="error.waitTime | duration"></span></my-i18n-param>
|
||||
</span>
|
||||
<span ng-switch-when="PHONECALLS_NOT_SUPPORTED" my-i18n="error_modal_phonecalls_not_supported_description_md">
|
||||
<my-i18n-param name="user"><strong my-peer-link="error.userID"></strong></my-i18n-param>
|
||||
<my-i18n-param name="download-link"><a href="https://telegram.org/dl" target="_blank">{0}</a></my-i18n-param>
|
||||
|
||||
</span>
|
||||
|
||||
<span ng-switch-when="CALLBACK_RESPONSE" ng-bind-html="error.description_html"></span>
|
||||
|
||||
@ -69,9 +75,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-if="error" class="error_modal_details" ng-switch="error.detailsShown">
|
||||
<textarea ng-switch-when="true" rows="3" onclick="this.select()">Method: {{error.input || 'N/A'}}
|
||||
Url: {{error.url || 'N/A'}}
|
||||
<div ng-if="error && error.input" class="error_modal_details" ng-switch="error.detailsShown">
|
||||
<textarea ng-switch-when="true" rows="3" onclick="this.select()">Method: {{error.input || 'N/A'}}{{error.url ? "\nUrl: " + error.url : ''}}
|
||||
Result: {{error.originalError ? error.originalError : (error.stack ? (error.name || '') + ' ' + (error.description || error.message) : error)}}</textarea>
|
||||
<div ng-switch-default>
|
||||
<a class="error_modal_details_link" href="" ng-click="error.detailsShown = true" my-i18n="error_modal_tech_details"></a>
|
||||
|
@ -9,7 +9,7 @@
|
||||
</div>
|
||||
<div ng-switch-default class="im_service_message">
|
||||
<a class="im_message_author" ng-if="::historyMessage.fromID > 0" my-peer-link="historyMessage.fromID" short="historyMessage.peerID > 0" color="historyMessage.peerID < 0" no-watch="true"></a>
|
||||
<span class="im_message_service" my-service-message></span>
|
||||
<span class="im_message_service" my-service-message="historyMessage"></span>
|
||||
</div>
|
||||
|
||||
<a ng-if="::historyMessage.action._ == 'messageActionChatEditPhoto' || historyMessage.action._ == 'messageActionChannelEditPhoto'" class="im_service_message_photo_thumb" href="" ng-click="openPhoto(historyMessage.action.photo.id)">
|
||||
|
@ -42,6 +42,16 @@
|
||||
<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>
|
||||
|
||||
|
||||
<span ng-switch-default my-i18n="message_service_unsupported_action">
|
||||
<my-i18n-param name="action"><span ng-bind="historyMessage.action._"></span></my-i18n-param>
|
||||
|
@ -10,7 +10,7 @@
|
||||
</div>
|
||||
<div ng-switch-default class="im_service_message">
|
||||
<a class="im_message_author" ng-if="::historyMessage.fromID > 0" my-peer-link="historyMessage.fromID" short="historyMessage.peerID > 0" color="historyMessage.peerID < 0" no-watch="true"></a>
|
||||
<span class="im_message_service" my-service-message></span>
|
||||
<span class="im_message_service" my-service-message="historyMessage"></span>
|
||||
</div>
|
||||
|
||||
<a ng-if="::historyMessage.action._ == 'messageActionChatEditPhoto' || historyMessage.action._ == 'messageActionChannelEditPhoto'" class="im_service_message_photo_thumb" href="" ng-click="openPhoto(historyMessage.action.photo.id)">
|
||||
|
@ -42,6 +42,16 @@
|
||||
<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>
|
||||
|
||||
<span ng-switch-default my-i18n="message_service_unsupported_action">
|
||||
<my-i18n-param name="action"><span ng-bind="historyMessage.action._"></span></my-i18n-param>
|
||||
</span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user