Browse Source

Keyboard support improvements

master
Igor Zhukov 10 years ago
parent
commit
77fadbe0de
  1. 3
      app/js/controllers.js
  2. 3
      app/js/directives.js
  3. 11
      app/js/services.js
  4. 2
      app/less/app.less
  5. 10
      app/less/desktop.less
  6. 9
      app/partials/desktop/im.html

3
app/js/controllers.js

@ -1391,7 +1391,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -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']) @@ -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();
}
});

3
app/js/directives.js

@ -403,7 +403,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -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']) @@ -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);
}
}

11
app/js/services.js

@ -1291,11 +1291,12 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -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']) @@ -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']) @@ -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']) @@ -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 () {

2
app/less/app.less

@ -2061,7 +2061,7 @@ a.im_message_fwd_photo { @@ -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;

10
app/less/desktop.less

@ -1395,6 +1395,16 @@ a.im_panel_peer_photo .peer_initials { @@ -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 {

9
app/partials/desktop/im.html

@ -172,17 +172,18 @@ @@ -172,17 +172,18 @@
<div my-reply-message="draftMessage.replyToMessage"></div>
</div>
<div class="im_send_keyboard_wrap" ng-if="historyState.replyKeyboard._ == 'replyKeyboardMarkup'">
<div my-reply-markup="historyState.replyKeyboard"></div>
</div>
<div class="im_send_field_wrap">
<div class="im_send_field_wrap" ng-class="historyState.replyKeyboard._ == 'replyKeyboardMarkup' && !historyState.replyKeyboard.pFlags.hidden ? 'im_send_field_wkeyboard' : ''">
<a class="composer_emoji_insert_btn"><i class="icon icon-emoji"></i></a>
<div class="im_send_dropbox_wrap" my-i18n="im_photos_drop_text"></div>
<textarea ng-model="draftMessage.text" placeholder="{{'im_message_field_placeholder' | i18n}}" class="form-control im_message_field no_outline" dir="auto"></textarea>
</div>
<div class="im_send_keyboard_wrap" ng-if="historyState.replyKeyboard._ == 'replyKeyboardMarkup'">
<div my-reply-markup="historyState.replyKeyboard"></div>
</div>
<div class="clearfix">
<button type="submit" class="btn btn-md im_submit" my-i18n="im_submit_message"></button>

Loading…
Cancel
Save