diff --git a/app/js/controllers.js b/app/js/controllers.js index 9b964a87..5c40a596 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -2211,10 +2211,11 @@ angular.module('myApp.controllers', ['myApp.i18n']) else if (replyToMarkup) { replyClear(); } - $scope.$broadcast('ui_keyboard_update', { - enabled: replyKeyboard && !replyKeyboard.pFlags.hidden && - replyKeyboard._ == 'replyKeyboardMarkup' - }); + var enabled = replyKeyboard && + !replyKeyboard.pFlags.hidden && + replyKeyboard._ == 'replyKeyboardMarkup'; + $scope.$broadcast('ui_keyboard_update', {enabled: enabled}); + $scope.$emit('ui_panel_update', {blur: enabled}); } function replyKeyboardToggle ($event) { diff --git a/app/js/lib/ng_utils.js b/app/js/lib/ng_utils.js index a614787c..cf07b0f8 100644 --- a/app/js/lib/ng_utils.js +++ b/app/js/lib/ng_utils.js @@ -1540,7 +1540,7 @@ angular.module('izhukov.utils', []) skipEntity = true; break; } - var command = entityText; + var command = entityText.substr(1); var bot, atPos; if ((atPos = command.indexOf('@')) != -1) { bot = command.substr(atPos); diff --git a/app/js/services.js b/app/js/services.js index 6fd7d2c0..3c921af6 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -750,50 +750,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) $rootScope.$on('apiUpdate', function (e, update) { // console.log('on apiUpdate', update); switch (update._) { - case 'updateChatParticipants': - var participants = update.participants; - var chatFull = chatsFull[participants.id]; - if (chatFull !== undefined) { - chatFull.participants = update.participants; - $rootScope.$broadcast('chat_full_update', chatID); - } - break; - - case 'updateChatParticipantAdd': - var chatFull = chatsFull[update.chat_id]; - if (chatFull !== undefined) { - var participants = chatFull.participants.participants || []; - for (var i = 0, length = participants.length; i < length; i++) { - if (participants[i].user_id == update.user_id) { - return; - } - } - participants.push({ - _: 'chatParticipant', - user_id: update.user_id, - inviter_id: update.inviter_id, - date: tsNow(true) - }); - chatFull.participants.version = update.version; - $rootScope.$broadcast('chat_full_update', update.chat_id); - } - break; - - case 'updateChatParticipantDelete': - var chatFull = chatsFull[update.chat_id]; - if (chatFull !== undefined) { - var participants = chatFull.participants.participants || []; - for (var i = 0, length = participants.length; i < length; i++) { - if (participants[i].user_id == update.user_id) { - participants.splice(i, 1); - chatFull.participants.version = update.version; - $rootScope.$broadcast('chat_full_update', update.chat_id); - return; - } - } - } - break; - case 'updateChannel': var channelID = update.channel_id; $rootScope.$broadcast('channel_settings', {channelID: channelID}); @@ -1153,6 +1109,56 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) }); } + $rootScope.$on('apiUpdate', function (e, update) { + // console.log('on apiUpdate', update); + switch (update._) { + case 'updateChatParticipants': + var participants = update.participants; + var chatFull = chatsFull[participants.id]; + if (chatFull !== undefined) { + chatFull.participants = update.participants; + $rootScope.$broadcast('chat_full_update', chatID); + } + break; + + case 'updateChatParticipantAdd': + var chatFull = chatsFull[update.chat_id]; + if (chatFull !== undefined) { + var participants = chatFull.participants.participants || []; + for (var i = 0, length = participants.length; i < length; i++) { + if (participants[i].user_id == update.user_id) { + return; + } + } + participants.push({ + _: 'chatParticipant', + user_id: update.user_id, + inviter_id: update.inviter_id, + date: tsNow(true) + }); + chatFull.participants.version = update.version; + $rootScope.$broadcast('chat_full_update', update.chat_id); + } + break; + + case 'updateChatParticipantDelete': + var chatFull = chatsFull[update.chat_id]; + if (chatFull !== undefined) { + var participants = chatFull.participants.participants || []; + for (var i = 0, length = participants.length; i < length; i++) { + if (participants[i].user_id == update.user_id) { + participants.splice(i, 1); + chatFull.participants.version = update.version; + $rootScope.$broadcast('chat_full_update', update.chat_id); + return; + } + } + } + break; + + } + }); + return { getPeerBots: getPeerBots, getProfile: getProfile,