From 77fadbe0de90e4337eb0fa7a8ff2ddd2452c0150 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Fri, 3 Jul 2015 19:08:00 +0300 Subject: [PATCH] Keyboard support improvements --- app/js/controllers.js | 3 ++- app/js/directives.js | 3 +-- app/js/services.js | 11 ++++++++--- app/less/app.less | 2 +- app/less/desktop.less | 10 ++++++++++ app/partials/desktop/im.html | 9 +++++---- 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/app/js/controllers.js b/app/js/controllers.js index 5370ade0..9912e915 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -1391,7 +1391,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) if (replyKeyboard) { replyKeyboard = AppMessagesManager.wrapReplyMarkup(replyKeyboard); } + console.log('update reply markup', peerID, replyKeyboard); $scope.historyState.replyKeyboard = replyKeyboard; + $scope.$broadcast('ui_panel_update'); } function botStart () { @@ -1803,7 +1805,6 @@ angular.module('myApp.controllers', ['myApp.i18n']) $scope.$on('history_reply_markup', function (e, peerData) { if (peerData.peerID == $scope.curDialog.peerID) { - console.log('update reply markup'); updateReplyKeyboard(); } }); diff --git a/app/js/directives.js b/app/js/directives.js index 2d21e473..afb793c9 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -403,7 +403,7 @@ angular.module('myApp.directives', ['myApp.filters']) }) - .directive('myReplyMarkup', function(AppPhotosManager, AppMessagesManager, AppPeersManager, $rootScope) { + .directive('myReplyMarkup', function() { return { templateUrl: templateUrl('reply_markup'), @@ -415,7 +415,6 @@ angular.module('myApp.directives', ['myApp.filters']) function link ($scope, element, attrs) { $scope.buttonSend = function (button) { - console.log('buttonSend', button); $scope.$emit('reply_button_press', button); } } diff --git a/app/js/services.js b/app/js/services.js index 3354df80..1988eb45 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -1291,11 +1291,12 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) } function getReplyKeyboard (peerID) { + console.log('get', historiesStorage[peerID]); return (historiesStorage[peerID] || {}).reply_markup || false; } function mergeReplyKeyboard (historyStorage, message) { - console.log('merge', message.reply_markup, historyStorage.reply_markup); + console.log('merge', message.id, message.reply_markup, historyStorage.reply_markup); if (!message.reply_markup && !( historyStorage.reply_markup !== undefined && @@ -1321,16 +1322,18 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) messageReplyMarkup.fromID = message.from_id; } historyStorage.reply_markup = messageReplyMarkup; + console.log('set', historyStorage.reply_markup); return true; } if (lastReplyMarkup && lastReplyMarkup.pFlags.one_time && - !lastReplyMarkup.hidden && + !lastReplyMarkup.pFlags.hidden && message.out && (message.id > lastReplyMarkup.id || message.id < 0) && message.message) { - lastReplyMarkup.hidden = true; + lastReplyMarkup.pFlags.hidden = true; + console.log('set', historyStorage.reply_markup); return true; } @@ -1343,6 +1346,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) id: message.id, flags: 0 }; + console.log('set', historyStorage.reply_markup); return true; } @@ -2418,6 +2422,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) markupButton.rText = RichTextProcessor.wrapRichText(markupButton.text, {noLinks: true, noLinebreaks: true}); }) }) + return replyMarkup; } function fetchSingleMessages () { diff --git a/app/less/app.less b/app/less/app.less index aafe3ad6..60dcae2b 100644 --- a/app/less/app.less +++ b/app/less/app.less @@ -2061,7 +2061,7 @@ a.im_message_fwd_photo { } .reply_markup_wrap { - margin: 0 -2px 5px; + margin: 5px -2px 0; } .reply_markup_button_wrap { display: inline-block; diff --git a/app/less/desktop.less b/app/less/desktop.less index a025be33..8cc9800f 100644 --- a/app/less/desktop.less +++ b/app/less/desktop.less @@ -1395,6 +1395,16 @@ a.im_panel_peer_photo .peer_initials { } } +.im_send_field_wkeyboard { + .composer { + &_rich_textarea, + &_textarea { + min-height: 25px; + padding-right: 25px; + } + } +} + /* Peer modals */ .user_modal { &_window .modal-dialog { diff --git a/app/partials/desktop/im.html b/app/partials/desktop/im.html index e37a35c6..b82d54ca 100644 --- a/app/partials/desktop/im.html +++ b/app/partials/desktop/im.html @@ -172,17 +172,18 @@
-
-
-
-
+
+
+
+
+