diff --git a/app/css/app.css b/app/css/app.css index 7defae5b..7e2ee827 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -256,7 +256,7 @@ input[type="number"]::-webkit-inner-spin-button { vertical-align: text-top; background: url(../img/icons/IconsetW.png?1) -15px -419px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; opacity: 0.6; } .is_1x .icon-back { @@ -511,7 +511,7 @@ input[type="number"]::-webkit-inner-spin-button { font-size: 12px; line-height: normal; background: #F2F2F2 url(../img/icons/IconsetW.png?1) -6px -205px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; border: 1px solid #F2F2F2; border-radius: 3px; padding: 6px 20px 6px 30px; @@ -535,7 +535,7 @@ input[type="number"]::-webkit-inner-spin-button { height: 13px; vertical-align: text-top; background: url(../img/icons/IconsetW.png?1) -15px -192px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; opacity: 0.6; } .is_1x .im_dialogs_search_clear { @@ -788,7 +788,7 @@ a.im_dialog:hover .im_dialog_date { margin-left: 6px; background: url(../img/icons/IconsetW.png?1) -17px -444px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; } .is_1x .icon-caret { background-image: url(../img/icons/IconsetW_1x.png?2); @@ -987,7 +987,7 @@ div.im_message_video_thumb { height: 19px; background: url(../img/icons/IconsetW.png?1) -14px -389px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; } .is_1x .icon-geo-point { background-image: url(../img/icons/IconsetW_1x.png?2); @@ -1015,7 +1015,7 @@ div.im_message_video_thumb { vertical-align: text-top; background: #F2F2F2 url(../img/icons/IconsetW.png?1) -2px -229px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; border-radius: 3px; margin-right: 10px; } @@ -1032,6 +1032,7 @@ div.im_message_video_thumb { .im_history_selectable .im_message_outer_wrap:hover .icon-photo, .im_history_selectable .im_message_outer_wrap:hover .icon-video { background-color: #dae6f0; + background-position: -2px -542px; } .im_message_document_info { @@ -1076,7 +1077,7 @@ div.im_message_video_thumb { vertical-align: text-top; background: #F2F2F2 url(../img/icons/IconsetW.png?1) -2px -277px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; border-radius: 3px; margin-right: 10px; } @@ -1335,7 +1336,7 @@ textarea.im_message_field { height: 23px; vertical-align: text-top; background: url(../img/icons/IconsetW.png?1) -12px -68px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; opacity: 0.8; } .is_1x .icon-paperclip { @@ -1363,7 +1364,7 @@ textarea.im_message_field { height: 23px; vertical-align: text-top; background: url(../img/icons/IconsetW.png?1) -10px -4px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; opacity: 0.8; } .is_1x .icon-emoji { @@ -1413,7 +1414,7 @@ textarea.im_message_field { height: 21px; vertical-align: text-top; background: url(../img/icons/IconsetW.png?1) -9px -132px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; opacity: 0.8; } .is_1x .icon-camera { @@ -1833,7 +1834,7 @@ img.img_fullsize { .emoji-menu-tail { display: none; background: url(../img/icons/IconsetW.png?1) -14px -268px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; width: 14px; height: 7px; margin: 0 83px; @@ -1984,7 +1985,7 @@ img.img_fullsize { font-size: 12px; line-height: normal; background: #F2F2F2 url(../img/icons/IconsetW.png?1) -6px -205px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; border: 1px solid #F2F2F2; border-radius: 3px; padding: 6px 20px 6px 30px; @@ -2008,7 +2009,7 @@ img.img_fullsize { height: 13px; vertical-align: text-top; background: url(../img/icons/IconsetW.png?1) -15px -192px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; opacity: 0.6; } .is_1x .contacts_modal_search_clear { @@ -2085,7 +2086,7 @@ a.contacts_modal_contact:hover .contacts_modal_contact_status { width: 17px; height: 15px; background: url(../img/icons/IconsetW.png?1) -13px -366px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; opacity: 0.5; } .is_1x .icon-contact-tick { @@ -2183,7 +2184,7 @@ a.contacts_modal_contact:hover .contacts_modal_contact_status { height: 15px; background: url(../img/icons/IconsetW.png?1) -15px -319px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; } .is_1x .icon-delete { background-image: url(../img/icons/IconsetW_1x.png?2); @@ -2230,7 +2231,7 @@ a.contacts_modal_contact:hover .contacts_modal_contact_status { height: 26px; margin: 13px 0 0 40px; background: url(../img/icons/IconsetW.png?1) -9px -516px no-repeat; - background-size: 42px 560px; + background-size: 42px 620px; } .is_1x .icon-select-tick { background-image: url(../img/icons/IconsetW_1x.png?2); diff --git a/app/img/icons/IconsetW.png b/app/img/icons/IconsetW.png index d162ef29..ee6a46c4 100644 Binary files a/app/img/icons/IconsetW.png and b/app/img/icons/IconsetW.png differ diff --git a/app/img/icons/IconsetW_1x.png b/app/img/icons/IconsetW_1x.png index 1e049450..efa92f21 100644 Binary files a/app/img/icons/IconsetW_1x.png and b/app/img/icons/IconsetW_1x.png differ diff --git a/app/js/controllers.js b/app/js/controllers.js index 30cdbd95..4e402672 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -728,7 +728,7 @@ angular.module('myApp.controllers', []) // console.trace('ctrl text changed', newVal); AppMessagesManager.readHistory($scope.curDialog.inputPeer); - if (newVal.length) { + if (newVal && newVal.length) { var backupDraftObj = {}; backupDraftObj['draft' + $scope.curDialog.peerID] = newVal; AppConfigManager.set(backupDraftObj); diff --git a/app/js/directives.js b/app/js/directives.js index 29bbd22d..be178298 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -429,6 +429,7 @@ angular.module('myApp.directives', ['myApp.filters']) }; $('body').on('dragenter dragleave dragover drop', onDragDropEvent); + $(document).on('paste', onPasteEvent); scope.$on('ui_peer_change', focusField); scope.$on('ui_history_focus', focusField); @@ -440,6 +441,7 @@ angular.module('myApp.directives', ['myApp.filters']) scope.$on('$destroy', function cleanup() { $('body').off('dragenter dragleave dragover drop', onDragDropEvent); + $(document).off('paste', onPasteEvent); }); focusField(); @@ -450,6 +452,26 @@ angular.module('myApp.directives', ['myApp.filters']) }); } + function onPasteEvent (e) { + var cData = (e.originalEvent || e).clipboardData, + items = cData && cData.items || [], + files = [], + i; + + for (i = 0; i < items.length; i++) { + if (items[i].kind == 'file') { + files.push(items[i].getAsFile()); + } + } + + if (files.length && safeConfirm('Are you sure to send file(s) from clipboard?')) { + scope.$apply(function () { + scope.draftMessage.files = files; + scope.draftMessage.isMedia = true; + }); + } + } + function onDragDropEvent(e) { var dragStateChanged = false; if (!dragStarted || dragStarted == 1) { @@ -696,7 +718,8 @@ angular.module('myApp.directives', ['myApp.filters']) MtpApiFileManager.downloadFile(scope.video.dc_id, inputLocation, scope.video.size, null, {mime: 'video/mp4'}).then(function (url) { scope.progress.enabled = false; // scope.progress = {enabled: true, percent: 50}; - scope.player.quicktime = hasQt; + scope.player.hasQuicktime = hasQt; + scope.player.quicktime = false; scope.player.src = $sce.trustAsResourceUrl(url); }, function (e) { console.log('Download video failed', e, scope.video); diff --git a/app/js/services.js b/app/js/services.js index 928563b6..eb7de3c7 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -134,6 +134,7 @@ angular.module('myApp.services', []) var users = {}, cachedPhotoLocations = {}, contactsFillPromise, + contactsList, contactsIndex = SearchIndexManager.createIndex(); function fillContacts () { @@ -143,8 +144,8 @@ angular.module('myApp.services', []) return contactsFillPromise = MtpApiManager.invokeApi('contacts.getContacts', { hash: '' }).then(function (result) { - var contactsList = [], - userID, searchText, i; + var userID, searchText, i; + contactsList = []; saveApiUsers(result.users); for (var i = 0; i < result.contacts.length; i++) { @@ -323,6 +324,24 @@ angular.module('myApp.services', []) $rootScope.$broadcast('user_update', userID); } break; + + case 'updateContactLink': + if (angular.isArray(contactsList)) { + var userID = update.user_id, + curPos = curIsContact = contactsList.indexOf(userID), + curIsContact = curPos != -1, + newIsContact = update.my_link._ == 'contacts.myLinkContact'; + + if (newIsContact != curIsContact) { + if (newIsContact) { + contactsList.push(userID); + SearchIndexManager.indexObject(userID, getUserSearchText(userID), contactsIndex); + } else { + contactsList.splice(curPos, 1); + } + } + } + break; } }); @@ -1072,18 +1091,27 @@ angular.module('myApp.services', []) randomIDS = bigint(randomID[0]).shiftLeft(32).add(bigint(randomID[1])).toString(), historyStorage = historiesStorage[peerID], inputPeer = AppPeersManager.getInputPeerByID(peerID), - attachType; + attachType, fileName, fileName; if (!options.isMedia) { attachType = 'doc'; + fileName = 'doc.' + file.type.split('/')[1]; } else if (['image/jpeg', 'image/gif', 'image/png', 'image/bmp'].indexOf(file.type) >= 0) { attachType = 'photo'; + fileName = 'photo.' + file.type.split('/')[1]; } else if (file.type.substr(0, 6) == 'video/') { attachType = 'video'; + fileName = 'video.mp4'; } else if (file.type == 'audio/mpeg' || file.type == 'audio/mp3') { attachType = 'audio'; + fileName = 'audio.mp3'; } else { attachType = 'doc'; + fileName = 'doc.' + file.type.split('/')[1]; + } + + if (!file.name) { + file.name = fileName; } if (historyStorage === undefined) { @@ -1113,6 +1141,21 @@ angular.module('myApp.services', []) pending: true }; + var toggleError = function (on) { + var historyMessage = messagesForHistory[messageID]; + if (on) { + message.error = true; + if (historyMessage) { + historyMessage.error = true; + } + } else { + delete message.error; + if (historyMessage) { + delete historyMessage.error; + } + } + } + message.send = function () { MtpApiFileManager.uploadFile(file).then(function (inputFile) { var inputMedia; diff --git a/app/vendor/jquery.emojiarea/jquery.emojiarea.js b/app/vendor/jquery.emojiarea/jquery.emojiarea.js index 61e0f631..f0888c24 100644 --- a/app/vendor/jquery.emojiarea/jquery.emojiarea.js +++ b/app/vendor/jquery.emojiarea/jquery.emojiarea.js @@ -315,6 +315,16 @@ Following code was modified by Igor Zhukov, in order to improve rich text paste */ EmojiArea_WYSIWYG.prototype.onPaste = function(e) { + var cData = (e.originalEvent || e).clipboardData, + items = cData && cData.items || [], + i; + for (i = 0; i < items.length; i++) { + if (items[i].kind == 'file') { + e.preventDefault(); + return true; + } + } + var text = (e.originalEvent || e).clipboardData.getData('text/plain'), self = this; setTimeout(function () {