Browse Source

Migrating schema pt2

master
Igor Zhukov 9 years ago
parent
commit
90d5d23e44
  1. 107
      app/js/controllers.js
  2. 21
      app/js/directives.js
  3. 24
      app/js/messages_manager.js
  4. 65
      app/js/services.js
  5. 2
      app/less/app.less
  6. 13
      app/partials/desktop/forwarded_messages.html
  7. 2
      app/partials/desktop/im.html
  8. 32
      app/partials/desktop/login.html
  9. 8
      app/partials/desktop/message.html
  10. 35
      app/partials/desktop/message_attach_document.html
  11. 35
      app/partials/desktop/message_attach_video.html
  12. 30
      app/partials/mobile/login.html
  13. 2
      app/partials/mobile/message.html
  14. 12
      app/partials/mobile/message_attach_document.html
  15. 12
      app/partials/mobile/message_attach_video.html

107
app/js/controllers.js

@ -55,7 +55,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -55,7 +55,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.credentials = {phone_country: '', phone_country_name: '', phone_number: '', phone_full: ''};
$scope.progress = {};
$scope.callPending = {};
$scope.nextPending = {};
$scope.about = {};
$scope.chooseCountry = function () {
@ -158,38 +158,20 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -158,38 +158,20 @@ angular.module('myApp.controllers', ['myApp.i18n'])
initPhoneCountry();
var callTimeout;
var nextTimeout;
var updatePasswordTimeout = false;
function saveAuth (result) {
MtpApiManager.setUserAuth(options.dcID, {
id: result.user.id
});
$timeout.cancel(callTimeout);
$timeout.cancel(nextTimeout);
$location.url('/im');
};
function callCheck () {
$timeout.cancel(callTimeout);
if ($scope.credentials.viaApp) {
return;
}
if (!(--$scope.callPending.remaining)) {
$scope.callPending.success = false;
MtpApiManager.invokeApi('auth.sendCall', {
phone_number: $scope.credentials.phone_full,
phone_code_hash: $scope.credentials.phone_code_hash
}, options).then(function () {
$scope.callPending.success = true;
});
} else {
callTimeout = $timeout(callCheck, 1000);
}
}
$scope.sendCode = function () {
$timeout.cancel(callTimeout);
$timeout.cancel(nextTimeout);
ErrorService.confirm({
type: 'LOGIN_PHONE_CORRECT',
@ -204,26 +186,18 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -204,26 +186,18 @@ angular.module('myApp.controllers', ['myApp.i18n'])
var authKeyStarted = tsNow();
MtpApiManager.invokeApi('auth.sendCode', {
flags: 0,
phone_number: $scope.credentials.phone_full,
sms_type: 5,
api_id: Config.App.id,
api_hash: Config.App.hash,
lang_code: navigator.language || 'en'
}, options).then(function (sentCode) {
$scope.progress.enabled = false;
$scope.credentials.phone_code_hash = sentCode.phone_code_hash;
$scope.credentials.phone_occupied = sentCode.phone_registered;
$scope.credentials.viaApp = sentCode._ == 'auth.sentAppCode';
$scope.callPending.remaining = sentCode.send_call_timeout || 60;
$scope.error = {};
$scope.about = {};
callCheck();
onContentLoaded(function () {
$scope.$broadcast('ui_height');
});
$scope.credentials.phone_code_hash = sentCode.phone_code_hash;
applySentCode(sentCode);
}, function (error) {
$scope.progress.enabled = false;
@ -246,28 +220,71 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -246,28 +220,71 @@ angular.module('myApp.controllers', ['myApp.i18n'])
});
}
$scope.sendSms = function () {
if (!$scope.credentials.viaApp) {
function applySentCode(sentCode) {
$scope.credentials.type = sentCode.type;
$scope.nextPending.type = sentCode.next_type || false;
$scope.nextPending.remaining = sentCode.timeout || false;
nextTimeoutCheck();
onContentLoaded(function () {
$scope.$broadcast('ui_height');
});
}
$scope.sendNext = function () {
if (!$scope.nextPending.type ||
$scope.nextPending.remaining > 0) {
return;
}
delete $scope.credentials.viaApp;
MtpApiManager.invokeApi('auth.sendSms', {
MtpApiManager.invokeApi('auth.resendCode', {
phone_number: $scope.credentials.phone_full,
phone_code_hash: $scope.credentials.phone_code_hash
}, options).then(callCheck);
}, options).then(applySentCode);
}
function nextTimeoutCheck () {
$timeout.cancel(nextTimeout);
if (!$scope.nextPending.type ||
$scope.nextPending.remaining === false) {
return;
}
if (!(--$scope.nextPending.remaining)) {
$scope.nextPending.success = false;
$scope.sendNext();
} else {
nextTimeout = $timeout(nextTimeoutCheck, 1000);
}
}
$scope.editPhone = function () {
$timeout.cancel(callTimeout);
$timeout.cancel(nextTimeout);
if ($scope.credentials.phone_full &&
$scope.credentials.phone_code_hash) {
MtpApiManager.invokeApi('auth.cancelCode', {
phone_number: $scope.credentials.phone_full,
phone_code_hash: $scope.credentials.phone_code_hash
}, options);
}
delete $scope.credentials.phone_code_hash;
delete $scope.credentials.phone_unoccupied;
delete $scope.credentials.phone_code_valid;
delete $scope.credentials.viaApp;
delete $scope.callPending.remaining;
delete $scope.callPending.success;
delete $scope.nextPending.remaining;
delete $scope.nextPending.success;
}
$scope.$watch('credentials.phone_code', function (newVal) {
if (newVal &&
newVal.match(/^\d+$/) &&
$scope.credentials.type &&
$scope.credentials.type.length &&
newVal.length == $scope.credentials.type.length) {
$scope.logIn();
}
});
$scope.logIn = function (forceSignUp) {
var method = 'auth.signIn', params = {
phone_number: $scope.credentials.phone_full,
@ -3080,9 +3097,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -3080,9 +3097,9 @@ angular.module('myApp.controllers', ['myApp.i18n'])
})
.controller('VideoModalController', function ($scope, $rootScope, $modalInstance, PeersSelectService, AppMessagesManager, AppVideoManager, AppPeersManager, ErrorService) {
.controller('VideoModalController', function ($scope, $rootScope, $modalInstance, PeersSelectService, AppMessagesManager, AppDocsManager, AppPeersManager, ErrorService) {
$scope.video = AppVideoManager.wrapForFull($scope.videoID);
$scope.video = AppDocsManager.wrapVideoForFull($scope.docID);
$scope.progress = {enabled: false};
$scope.player = {};
@ -3109,7 +3126,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -3109,7 +3126,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
};
$scope.download = function () {
AppVideoManager.saveVideoFile($scope.videoID);
AppDocsManager.saveDocFile($scope.docID);
};
$scope.$on('history_delete', function (e, historyUpdate) {

21
app/js/directives.js

@ -579,24 +579,6 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -579,24 +579,6 @@ angular.module('myApp.directives', ['myApp.filters'])
}
};
})
.directive('myMessageVideo', function(AppDocsManager) {
return {
scope: {
'media': '=myMessageVideo',
'messageId': '=messageId'
},
templateUrl: templateUrl('message_attach_video'),
link: function ($scope, element, attrs) {
AppDocsManager.updateDocDownloaded($scope.media.video.id);
$scope.videoSave = function () {
AppDocsManager.saveDocFile($scope.media.video.id);
};
$scope.videoOpen = function () {
AppDocsManager.openVideo($scope.media.video.id, $scope.messageId);
};
}
};
})
.directive('myMessageDocument', function(AppDocsManager) {
return {
scope: {
@ -615,6 +597,9 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -615,6 +597,9 @@ angular.module('myApp.directives', ['myApp.filters'])
}
AppDocsManager.openDoc($scope.media.document.id, $scope.messageId);
};
$scope.videoOpen = function () {
AppDocsManager.openVideo($scope.media.document.id, $scope.messageId);
};
}
};
})

24
app/js/messages_manager.js

@ -260,7 +260,9 @@ angular.module('myApp.services') @@ -260,7 +260,9 @@ angular.module('myApp.services')
dialog.top_message > maxSeenID
) {
var notifyPeer = message.flags & 16 ? message.from_id : peerID;
if (message.pFlags.unread && !message.pFlags.out) {
if (message.pFlags.unread &&
!message.pFlags.out &&
!message.pFlags.silent) {
NotificationsManager.getPeerMuted(notifyPeer).then(function (muted) {
if (!muted) {
notifyAboutMessage(message);
@ -1188,14 +1190,16 @@ angular.module('myApp.services') @@ -1188,14 +1190,16 @@ angular.module('myApp.services')
}
apiMessage.date -= serverTimeOffset;
if (apiMessage.fwd_date) {
apiMessage.fwd_date -= serverTimeOffset;
var fwdHeader = apiMessage.fwd_from;
if (fwdHeader) {
apiMessage.fwdFromID = fwdHeader.from_id ? fwdHeader.from_id : -fwdHeader.channel_id;
fwdHeader.date -= serverTimeOffset;
}
apiMessage.toID = toPeerID;
apiMessage.fromID = apiMessage.from_id || toPeerID;
if (apiMessage.fwd_from_id) {
apiMessage.fwdFromID = AppPeersManager.getPeerID(apiMessage.fwd_from_id);
}
if (apiMessage.via_bot_id > 0) {
apiMessage.viaBotID = apiMessage.via_bot_id;
}
@ -2387,10 +2391,6 @@ angular.module('myApp.services') @@ -2387,10 +2391,6 @@ angular.module('myApp.services')
sticker = true;
}
break;
case 'messageMediaVideo':
thumbPhotoSize = message.media.video.thumb;
break;
}
}
@ -2746,7 +2746,9 @@ angular.module('myApp.services') @@ -2746,7 +2746,9 @@ angular.module('myApp.services')
newDialogsHandlePromise = $timeout(handleNewDialogs, 0);
}
if (inboxUnread && ($rootScope.selectedPeerID != peerID || $rootScope.idle.isIDLE)) {
if (inboxUnread &&
($rootScope.selectedPeerID != peerID || $rootScope.idle.isIDLE) &&
!message.pFlags.silent) {
var notifyPeer = message.flags & 16 ? message.from_id : peerID;
var notifyPeerToHandle = notificationsToHandle[notifyPeer];

65
app/js/services.js

@ -94,6 +94,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -94,6 +94,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
var userID = apiUser.id;
var result = users[userID];
if (apiUser.pFlags === undefined) {
apiUser.pFlags = {};
}
if (apiUser.pFlags.min) {
if (result !== undefined) {
return;
}
}
if (apiUser.phone) {
apiUser.rPhone = $filter('phoneNumber')(apiUser.phone);
@ -114,10 +125,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -114,10 +125,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
usernames[searchUsername] = userID;
}
if (apiUser.pFlags === undefined) {
apiUser.pFlags = {};
}
apiUser.sortName = apiUser.pFlags.deleted ? '' : SearchIndexManager.cleanSearchText(apiUser.first_name + ' ' + (apiUser.last_name || ''));
var nameWords = apiUser.sortName.split(' ');
@ -191,8 +198,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -191,8 +198,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
return users[id] && users[id].pFlags.bot;
}
function hasUser(id) {
return angular.isObject(users[id]);
function hasUser(id, allowMin) {
var user = users[id];
return angular.isObject(user) && (!allowMin || !user.pFlags.min);
}
function getUserPhoto(id) {
@ -592,6 +600,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -592,6 +600,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
apiChat.rTitle = RichTextProcessor.wrapRichText(apiChat.title, {noLinks: true, noLinebreaks: true}) || _('chat_title_deleted');
var result = chats[apiChat.id];
var titleWords = SearchIndexManager.cleanSearchText(apiChat.title || '').split(' ');
var firstWord = titleWords.shift();
var lastWord = titleWords.pop();
@ -602,16 +611,21 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -602,16 +611,21 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
if (apiChat.pFlags === undefined) {
apiChat.pFlags = {};
}
if (apiChat.pFlags.min) {
if (result !== undefined) {
return;
}
}
if (apiChat.username) {
var searchUsername = SearchIndexManager.cleanUsername(apiChat.username);
usernames[searchUsername] = apiChat.id;
}
if (chats[apiChat.id] === undefined) {
chats[apiChat.id] = apiChat;
if (result === undefined) {
result = chats[apiChat.id] = apiChat;
} else {
safeReplaceObject(chats[apiChat.id], apiChat);
safeReplaceObject(result, apiChat);
$rootScope.$broadcast('chat_update', apiChat.id);
}
@ -653,7 +667,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -653,7 +667,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
case 'invite':
if (chat._ == 'channel') {
if (chat.pFlags.megagroup) {
if (!chat.pFlags.editor) {
if (!chat.pFlags.editor &&
!(action == 'invite' && chat.pFlags.democracy)) {
return false;
}
} else {
@ -717,8 +732,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -717,8 +732,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
}
function hasChat (id) {
return angular.isObject(chats[id]);
function hasChat (id, allowMin) {
var chat = chats[id];
return angular.isObject(chat) && (!allowMin || !chat.pFlags.min);
}
function getChatPhoto(id) {
@ -1778,7 +1794,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -1778,7 +1794,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
apiDoc.duration = attribute.duration;
apiDoc.w = attribute.w;
apiDoc.h = attribute.h;
if (apiDoc.thumb) {
apiDoc.type = 'video';
}
break;
case 'documentAttributeSticker':
apiDoc.sticker = true;
@ -1794,7 +1812,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -1794,7 +1812,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
apiDoc.stickerSetInput = attribute.stickerset;
}
}
if (apiDoc.mime_type == 'image/webp') {
if (apiDoc.thumb && apiDoc.mime_type == 'image/webp') {
apiDoc.type = 'sticker';
}
break;
@ -1804,8 +1822,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -1804,8 +1822,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
break;
case 'documentAttributeAnimated':
if ((apiDoc.mime_type == 'image/gif' || apiDoc.mime_type == 'video/mp4') &&
apiDoc.thumb &&
apiDoc.thumb._ == 'photoSize') {
apiDoc.thumb) {
apiDoc.type = 'gif';
}
apiDoc.animated = true;
@ -1846,7 +1863,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -1846,7 +1863,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
if (doc.file_name) {
return doc.file_name;
}
var fileExt = '.' + doc.mime_type.split('.')[1];
var fileExt = '.' + doc.mime_type.split('/')[1];
if (fileExt == '.octet-stream') {
fileExt = '';
}
@ -2005,7 +2022,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -2005,7 +2022,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
function saveDocFile (docID) {
var doc = docs[docID],
historyDoc = docsForHistory[docID] || doc || {},
mimeType = video.mime_type || 'video/mp4',
mimeType = doc.mime_type,
fileName = getFileName(doc),
ext = (fileName.split('.', 2) || [])[1] || '';
@ -2728,8 +2745,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -2728,8 +2745,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
to_id: AppPeersManager.getOutputPeer(toID),
date: updateMessage.date,
message: updateMessage.message,
fwd_from_id: updateMessage.fwd_from_id,
fwd_date: updateMessage.fwd_date,
fwd_from: updateMessage.fwd_from,
reply_to_msg_id: updateMessage.reply_to_msg_id,
entities: updateMessage.entities
},
@ -2932,13 +2948,14 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -2932,13 +2948,14 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
return false;
}
if (update._ == 'updateNewMessage') {
if (update._ == 'updateNewMessage' ||
update._ == 'updateNewChannelMessage') {
var message = update.message;
var fwdPeerID = message.fwd_from_id ? AppPeersManager.getPeerID(message.fwd_from_id) : 0;
var toPeerID = AppPeersManager.getPeerID(message.to_id);
if (message.from_id && !AppUsersManager.hasUser(message.from_id) ||
fwdPeerID > 0 && !AppUsersManager.hasUser(fwdPeerID) ||
fwdPeerID < 0 && !AppChatsManager.hasChat(-fwdPeerID) ||
var fwdHeader = message.fwdHeader || {};
if (message.from_id && !AppUsersManager.hasUser(message.from_id, message.pFlags.post) ||
fwdHeader.from_id && !AppUsersManager.hasUser(fwdHeader.from_id, !!fwdHeader.channel_id) ||
fwdHeader.channel_id && !AppChatsManager.hasChat(fwdHeader.channel_id) ||
toPeerID > 0 && !AppUsersManager.hasUser(toPeerID) ||
toPeerID < 0 && !AppChatsManager.hasChat(-toPeerID)) {
console.warn(dT(), 'Short update not enough data', message);

2
app/less/app.less

@ -2348,7 +2348,7 @@ a.im_message_fwd_photo { @@ -2348,7 +2348,7 @@ a.im_message_fwd_photo {
}
}
.im_history_loading {
width: 60px;
width: 35px;
margin: 0 auto;
visibility: hidden;

13
app/partials/desktop/forwarded_messages.html

@ -15,16 +15,17 @@ @@ -15,16 +15,17 @@
<div ng-switch-when="true">
<span class="im_reply_message_media" ng-if="singleMessage.media" ng-switch="singleMessage.media._">
<span ng-switch-when="messageMediaPhoto" my-i18n="conversation_media_photo"></span>
<span ng-switch-when="messageMediaVideo" my-i18n="conversation_media_video"></span>
<span ng-switch-when="messageMediaDocument" ng-switch="::singleMessage.media.document.sticker || false">
<span ng-switch-when="1" my-i18n="conversation_media_sticker"></span>
<span ng-switch-when="2">
<span ng-switch-when="messageMediaDocument" ng-switch="singleMessage.media.document.type || false">
<span ng-switch-when="sticker">
<span ng-bind-html="singleMessage.media.document.stickerEmoji"></span>
(<my-i18n msgid="conversation_media_sticker"></my-i18n>)
<my-i18n msgid="conversation_media_sticker"></my-i18n>
</span>
<span ng-switch-when="video" my-i18n="conversation_media_video"></span>
<span ng-switch-when="gif" my-i18n="conversation_media_gif"></span>
<span ng-switch-when="audio" my-i18n="conversation_media_audio"></span>
<span ng-switch-when="voice" my-i18n="conversation_media_audio"></span>
<span ng-switch-default ng-bind="singleMessage.media.document.file_name"></span>
</span>
<span ng-switch-when="messageMediaAudio" my-i18n="conversation_media_audio"></span>
<span ng-switch-when="messageMediaGeo" my-i18n="conversation_media_location"></span>
<span ng-switch-when="messageMediaVenue" my-i18n="conversation_media_location"></span>
<span ng-switch-when="messageMediaContact" my-i18n="conversation_media_contact"></span>

2
app/partials/desktop/im.html

@ -106,7 +106,7 @@ @@ -106,7 +106,7 @@
<div class="im_history_empty_wrap" ng-show="state.empty" ng-switch="state.mayBeHasMore">
<div ng-switch-when="true" class="im_history_loading" my-vertical-position="0.3" padding="true">
<div my-arc-progress stroke="5" width="50"></div>
<div my-arc-progress stroke="4" width="32"></div>
</div>
<div ng-switch-default class="im_history_empty" my-vertical-position="0.25" padding="true" my-i18n="im_no_messages"></div>
</div>

32
app/partials/desktop/login.html

@ -56,26 +56,32 @@ @@ -56,26 +56,32 @@
<form name="myLoginForm" ng-if="credentials.phone_code_hash &amp;&amp; !credentials.phone_code_valid" ng-submit="logIn()">
<h3 class="login_phone_head"><span ng-bind="credentials.phone_country"></span> <span ng-bind="credentials.phone_number"></span></h3>
<div class="login_edit_phone"><a ng-click="editPhone()" my-i18n="login_edit_number"></a></div>
<div ng-switch="credentials.viaApp">
<div ng-switch-when="true">
<p class="login_smscode_lead" my-i18n="login_enter_code_label_md"></p>
<p class="login_smscode_lead">
<a ng-click="sendSms()" my-i18n="login_code_not_received"></a>
</p>
<div ng-switch="credentials.type._">
<p ng-switch-when="auth.sentCodeTypeApp" class="login_smscode_lead" my-i18n="login_enter_code_label_md"></p>
<p ng-switch-default class="login_smscode_lead" my-i18n="login_enter_sms_code_label_md"></p>
</div>
<div ng-switch-default>
<p class="login_smscode_lead" my-i18n="login_enter_sms_code_label_md"></p>
<p class="login_smscode_lead">
<span ng-show="callPending.remaining > 0" my-i18n="login_call_remaining">
<my-i18n-param name="remaining">{{callPending.remaining | duration}}</my-i18n-param>
<div ng-if="nextPending.type" ng-switch="nextPending.remaining === false">
<p ng-switch-when="true" class="login_smscode_lead">
<a ng-click="sendNext()" my-i18n="login_code_not_received"></a>
</p>
<p ng-switch-default class="login_smscode_lead">
<span ng-show="nextPending.remaining > 0" my-i18n="login_call_remaining">
<my-i18n-param name="remaining" ng-bind="nextPending.remaining | duration"></my-i18n-param>
</span>
<span ng-show="!callPending.remaining &amp;&amp; !callPending.success" my-i18n="login_calling"></span>
<span ng-show="!callPending.remaining &amp;&amp; callPending.success" my-i18n="login_number_dialed"></span>
<span ng-show="!nextPending.remaining" my-i18n="login_calling"></span>
</p>
</div>
<div ng-if="credentials.type._ == 'auth.sentCodeTypeCall'">
<p class="login_smscode_lead">
<span my-i18n="login_number_dialed"></span>
</p>
</div>
<div class="md-input-group md-input-group-centered" ng-class="{'md-input-error': error.field == 'phone_code'}" my-labeled-input ng-switch="error.field == 'phone_code'">
<label ng-switch-when="true" class="md-input-label" my-i18n="login_incorrect_sms_code"></label>
<label ng-switch-default class="md-input-label" my-i18n="login_number_input_placeholder"></label>

8
app/partials/desktop/message.html

@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
<span class="copyonly"><span my-i18n="message_forwarded_message"></span>:&nbsp;</span>
<a class="im_message_fwd_photo pull-left" my-peer-photolink="::historyMessage.fwdFromID" img-class="im_message_fwd_photo"></a>
<div class="im_message_fwd_author_wrap">
<a class="im_message_fwd_author" my-peer-link="historyMessage.fwdFromID"></a><a ng-if="::historyMessage.viaBotID" class="im_message_fwd_via" ng-click="selectInlineBot(historyMessage.viaBotID, $event)"><span class="copyonly">&nbsp;</span><span my-i18n="message_via_bot"><my-i18n-param name="bot"><span class="im_message_fwd_author" my-peer-link="historyMessage.viaBotID" username="true" no-watch="true"></span></my-i18n-param></span></a><span class="copyonly">&nbsp;[</span><span class="im_message_fwd_date" ng-bind="::historyMessage.fwd_date | dateOrTime"></span><span class="copyonly">]&nbsp;</span>
<a class="im_message_fwd_author" my-peer-link="historyMessage.fwdFromID"></a><a ng-if="::historyMessage.viaBotID" class="im_message_fwd_via" ng-click="selectInlineBot(historyMessage.viaBotID, $event)"><span class="copyonly">&nbsp;</span><span my-i18n="message_via_bot"><my-i18n-param name="bot"><span class="im_message_fwd_author" my-peer-link="historyMessage.viaBotID" username="true" no-watch="true"></span></my-i18n-param></span></a><span class="copyonly">&nbsp;[</span><span class="im_message_fwd_date" ng-bind="::historyMessage.fwd_from.date | dateOrTime"></span><span class="copyonly">]&nbsp;</span>
<span class="im_message_views_inline" ng-if="::historyMessage.views > 0">
<i class="icon-message-views"></i><span class="im_message_views_cnt" my-message-views="historyMessage.mid"></span>
</span>
@ -67,18 +67,14 @@ @@ -67,18 +67,14 @@
<div ng-if="::historyMessage.media || historyMessage.mid < 0 ? true : false" class="im_message_media" ng-switch="historyMessage.media._">
<div ng-switch-when="messageMediaPhoto" my-message-photo="historyMessage.media" message-id="historyMessage.mid"></div>
<div ng-switch-when="messageMediaVideo" my-message-video="historyMessage.media" message-id="historyMessage.mid"></div>
<div ng-switch-when="messageMediaDocument" my-message-document="historyMessage.media" message-id="historyMessage.mid"></div>
<div ng-switch-when="messageMediaAudio" class="im_message_audio" my-audio-player audio="historyMessage.media.audio" message="historyMessage"></div>
<div ng-switch-when="messageMediaGeo" my-message-geo="historyMessage.media"></div>
<div ng-switch-when="messageMediaVenue" my-message-venue="historyMessage.media"></div>
<div ng-switch-when="messageMediaContact" class="im_message_contact" my-message-contact></div>
<div ng-switch-when="messageMediaWebPage" class="im_message_webpage" my-message-webpage="historyMessage.media.webpage" message-id="historyMessage.mid"></div>
<div ng-switch-when="messageMediaPending" my-message-pending></div>
<div ng-switch-when="messageMediaUnsupported">
<div class="im_message_text">
The message is not supported on your version of Telegram Web. Update the app to view: <a href="https://web.telegram.org">web.telegram.org</a>.
</div>
<div class="im_message_text">The message is not supported on your version of Telegram Web. Update the app to view: <a href="https://web.telegram.org" target="_blank">web.telegram.org</a>.</div>
</div>
</div>

35
app/partials/desktop/message_attach_document.html

@ -12,6 +12,41 @@ @@ -12,6 +12,41 @@
<div my-audio-player audio="media.document"></div>
</div>
<div ng-switch-when="video" class="im_message_video im_message_document_thumbed">
<a class="im_message_video_thumb" ng-click="videoOpen()" ng-style="::{width: media.document.thumb.width + 'px'}">
<span class="im_message_video_duration nocopy" data-content="{{::media.document.duration | duration}}"></span>
<i class="icon icon-videoplay"></i>
<img
class="im_message_video_thumb im_message_video_thumb_blurred"
my-load-thumb
thumb="media.document.thumb"
/>
</a>
<div class="im_message_document_info">
<div class="im_message_document_name_wrap">
<span class="copyonly">[</span><span class="im_message_document_name" my-i18n="message_attach_video_video"></span><span class="copyonly">&nbsp;<span ng-bind="::media.document.duration | duration"></span>]</span>
<span class="im_message_document_size" ng-if="!media.document.progress.enabled" ng-bind="::media.document.size | formatSize"></span>
<span class="im_message_document_size" ng-if="media.document.progress.enabled" ng-bind="media.document.progress | formatSizeProgress"></span>
</div>
<div class="im_message_document_actions noselect" ng-if="!media.document.progress.enabled">
<a href="" ng-click="docSave()" ng-switch="media.document.downloaded">
<span class="nocopy" ng-switch-when="true" my-i18n="message_attach_video_save"></span>
<span class="nocopy" ng-switch-default my-i18n="message_attach_video_download"></span>
</a>
<a class="nocopy" href="" ng-click="videoOpen()" my-i18n="message_attach_video_play"></a>
</div>
<div class="clearfix im_message_cancelable_progress_wrap" ng-if="media.document.progress.enabled">
<a class="im_message_media_progress_cancel pull-right nocopy" ng-click="media.document.progress.cancel()" my-i18n="modal_cancel"></a>
<div class="im_message_download_progress_wrap">
<div class="progress tg_down_progress">
<div class="progress-bar progress-bar-success" ng-style="{width: media.document.progress.percent + '%'}"></div>
</div>
</div>
</div>
</div>
</div>
<div ng-switch-default class="im_message_document clearfix" ng-class="{im_message_document_thumbed: !!media.document.thumb, im_message_document_progress: media.document.progress.enabled}">
<a ng-if="::!media.document.thumb" class="im_message_file_button" ng-click="docOpen()" ng-class="{im_message_file_button_dl_doc: media.document.downloaded}">

35
app/partials/desktop/message_attach_video.html

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
<div class="im_message_video im_message_document_thumbed">
<a class="im_message_video_thumb" ng-click="videoOpen()" ng-style="::{width: media.video.thumb.width + 'px'}">
<span class="im_message_video_duration nocopy" data-content="{{::media.video.duration | duration}}"></span>
<i class="icon icon-videoplay"></i>
<img
class="im_message_video_thumb im_message_video_thumb_blurred"
my-load-thumb
thumb="media.video.thumb"
/>
</a>
<div class="im_message_document_info">
<div class="im_message_document_name_wrap">
<span class="copyonly">[</span><span class="im_message_document_name" my-i18n="message_attach_video_video"></span><span class="copyonly">&nbsp;<span ng-bind="::media.video.duration | duration"></span>]</span>
<span class="im_message_document_size" ng-if="!media.video.progress.enabled" ng-bind="::media.video.size | formatSize"></span>
<span class="im_message_document_size" ng-if="media.video.progress.enabled" ng-bind="media.video.progress | formatSizeProgress"></span>
</div>
<div class="im_message_document_actions noselect" ng-if="!media.video.progress.enabled">
<a href="" ng-click="videoSave()" ng-switch="media.video.downloaded">
<span class="nocopy" ng-switch-when="true" my-i18n="message_attach_video_save"></span>
<span class="nocopy" ng-switch-default my-i18n="message_attach_video_download"></span>
</a>
<a class="nocopy" href="" ng-click="videoOpen()" my-i18n="message_attach_video_play"></a>
</div>
<div class="clearfix im_message_cancelable_progress_wrap" ng-if="media.video.progress.enabled">
<a class="im_message_media_progress_cancel pull-right nocopy" ng-click="media.video.progress.cancel()" my-i18n="modal_cancel"></a>
<div class="im_message_download_progress_wrap">
<div class="progress tg_down_progress">
<div class="progress-bar progress-bar-success" ng-style="{width: media.video.progress.percent + '%'}"></div>
</div>
</div>
</div>
</div>
</div>
<div ng-if="::media.rCaption" class="im_message_video_caption" ng-bind-html="::media.rCaption"></div>

30
app/partials/mobile/login.html

@ -66,24 +66,28 @@ @@ -66,24 +66,28 @@
<form name="myLoginForm" ng-if="credentials.phone_code_hash &amp;&amp; !credentials.phone_code_valid" ng-submit="logIn()">
<h3 class="login_phone_head"><span ng-bind="credentials.phone_country"></span> <span ng-bind="credentials.phone_number"></span></h3>
<div class="login_edit_phone"><a ng-click="editPhone()" my-i18n="login_edit_number"></a></div>
<div ng-switch="credentials.viaApp">
<div ng-switch-when="true">
<p class="login_smscode_lead" my-i18n="login_enter_code_label_md"></p>
<p class="login_smscode_lead">
<a ng-click="sendSms()" my-i18n="login_code_not_received"></a>
</p>
<div ng-switch="credentials.type._">
<p ng-switch-when="auth.sentCodeTypeApp" class="login_smscode_lead" my-i18n="login_enter_code_label_md"></p>
<p ng-switch-default class="login_smscode_lead" my-i18n="login_enter_sms_code_label_md"></p>
</div>
<div ng-switch-default>
<p class="login_smscode_lead" my-i18n="login_enter_sms_code_label_md"></p>
<p class="login_smscode_lead">
<span ng-show="callPending.remaining > 0" my-i18n="login_call_remaining">
<my-i18n-param name="remaining">{{callPending.remaining | duration}}</my-i18n-param>
<div ng-if="nextPending.type" ng-switch="nextPending.remaining === false">
<p ng-switch-when="true" class="login_smscode_lead">
<a ng-click="sendNext()" my-i18n="login_code_not_received"></a>
</p>
<p ng-switch-default class="login_smscode_lead">
<span ng-show="nextPending.remaining > 0" my-i18n="login_call_remaining">
<my-i18n-param name="remaining" ng-bind="nextPending.remaining | duration"></my-i18n-param>
</span>
<span ng-show="!callPending.remaining &amp;&amp; !callPending.success" my-i18n="login_calling"></span>
<span ng-show="!callPending.remaining &amp;&amp; callPending.success" my-i18n="login_number_dialed"></span>
<span ng-show="!nextPending.remaining" my-i18n="login_calling"></span>
</p>
</div>
<div ng-if="credentials.type._ == 'auth.sentCodeTypeCall'">
<p class="login_smscode_lead">
<span my-i18n="login_number_dialed"></span>
</p>
</div>
<div class="md-input-group md-input-group-centered" ng-class="{'md-input-error': error.field == 'phone_code'}" my-labeled-input ng-switch="error.field == 'phone_code'">

2
app/partials/mobile/message.html

@ -59,9 +59,7 @@ @@ -59,9 +59,7 @@
<div ng-if="::historyMessage.media || historyMessage.mid < 0 ? true : false" class="im_message_media" ng-switch="historyMessage.media._">
<div ng-switch-when="messageMediaPhoto" my-message-photo="historyMessage.media" message-id="historyMessage.mid"></div>
<div ng-switch-when="messageMediaVideo" my-message-video="historyMessage.media" message-id="historyMessage.mid"></div>
<div ng-switch-when="messageMediaDocument" my-message-document="historyMessage.media" message-id="historyMessage.mid"></div>
<div ng-switch-when="messageMediaAudio" class="im_message_audio" my-audio-player audio="historyMessage.media.audio" message="historyMessage"></div>
<div ng-switch-when="messageMediaGeo" my-message-geo="historyMessage.media"></div>
<div ng-switch-when="messageMediaVenue" my-message-venue="historyMessage.media"></div>
<div ng-switch-when="messageMediaContact" class="im_message_contact" my-message-contact></div>

12
app/partials/mobile/message_attach_document.html

@ -12,6 +12,18 @@ @@ -12,6 +12,18 @@
<div my-audio-player audio="media.document"></div>
</div>
<div ng-switch-when="video" class="im_message_video im_message_document_thumbed">
<a class="im_message_video_thumb" href="" ng-click="videoOpen()" ng-style="::{width: media.document.thumb.width + 'px'}">
<span class="im_message_video_duration" ng-bind="::media.document.duration | duration"></span>
<i class="icon icon-videoplay"></i>
<img
class="im_message_video_thumb im_message_video_thumb_blurred"
my-load-thumb
thumb="media.document.thumb"
/>
</a>
</div>
<div ng-switch-default class="im_message_document clearfix" ng-class="{im_message_document_thumbed: !!media.document.thumb, im_message_document_progress: media.document.progress.enabled}">
<a ng-if="::!media.document.thumb" class="im_message_file_button" ng-click="docOpen()" ng-class="{im_message_file_button_dl_doc: media.document.downloaded}">

12
app/partials/mobile/message_attach_video.html

@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
<div class="im_message_video im_message_document_thumbed">
<a class="im_message_video_thumb" href="" ng-click="videoOpen()" ng-style="::{width: media.video.thumb.width + 'px'}">
<span class="im_message_video_duration" ng-bind="::media.video.duration | duration"></span>
<i class="icon icon-videoplay"></i>
<img
class="im_message_video_thumb im_message_video_thumb_blurred"
my-load-thumb
thumb="media.video.thumb"
/>
</a>
</div>
<div ng-if="::media.rCaption" class="im_message_video_caption" ng-bind-html="::media.rCaption"></div>
Loading…
Cancel
Save