Browse Source

bugfixes

master
Igor Zhukov 9 years ago
parent
commit
acd38d1632
  1. 9
      app/js/controllers.js
  2. 2
      app/js/lib/ng_utils.js
  3. 94
      app/js/services.js

9
app/js/controllers.js

@ -2211,10 +2211,11 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -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) {

2
app/js/lib/ng_utils.js

@ -1540,7 +1540,7 @@ angular.module('izhukov.utils', []) @@ -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);

94
app/js/services.js

@ -750,50 +750,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -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']) @@ -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,

Loading…
Cancel
Save