diff --git a/app/img/icons/General.png b/app/img/icons/General.png
index 045dccad..16d772ae 100644
Binary files a/app/img/icons/General.png and b/app/img/icons/General.png differ
diff --git a/app/img/icons/General_2x.png b/app/img/icons/General_2x.png
index aa2e7ec8..72b8b7a3 100644
Binary files a/app/img/icons/General_2x.png and b/app/img/icons/General_2x.png differ
diff --git a/app/img/icons/IconsetSmiles.png b/app/img/icons/IconsetSmiles.png
index b244cb76..128f3608 100644
Binary files a/app/img/icons/IconsetSmiles.png and b/app/img/icons/IconsetSmiles.png differ
diff --git a/app/img/icons/IconsetSmiles_2x.png b/app/img/icons/IconsetSmiles_2x.png
index 6618c24b..d6594207 100644
Binary files a/app/img/icons/IconsetSmiles_2x.png and b/app/img/icons/IconsetSmiles_2x.png differ
diff --git a/app/index.html b/app/index.html
index bb28e8e6..9f77c6fa 100644
--- a/app/index.html
+++ b/app/index.html
@@ -64,7 +64,7 @@
-
+
diff --git a/app/js/controllers.js b/app/js/controllers.js
index c3c6a7c1..c726dc7c 100644
--- a/app/js/controllers.js
+++ b/app/js/controllers.js
@@ -160,7 +160,6 @@ angular.module('myApp.controllers', ['myApp.i18n'])
function saveAuth (result) {
MtpApiManager.setUserAuth(options.dcID, {
- expires: result.expires,
id: result.user.id
});
$timeout.cancel(callTimeout);
@@ -408,9 +407,12 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.$on('$routeUpdate', updateCurDialog);
+ var pendingParams = false;
$scope.$on('history_focus', function (e, peerData) {
$modalStack.dismissAll();
- if (peerData.peerString == $scope.curDialog.peer && peerData.messageID == $scope.curDialog.messageID) {
+ if (peerData.peerString == $scope.curDialog.peer &&
+ peerData.messageID == $scope.curDialog.messageID &&
+ !peerData.startParam) {
$scope.$broadcast(peerData.messageID ? 'ui_history_change_scroll' : 'ui_history_focus');
} else {
var peerID = AppPeersManager.getPeerID(peerData.peerString);
@@ -421,7 +423,19 @@ angular.module('myApp.controllers', ['myApp.i18n'])
peer = '@' + username;
}
}
- $location.url('/im?p=' + peer + (peerData.messageID ? '&m=' + peerData.messageID : ''));
+ if (peerData.messageID || peerData.startParam) {
+ pendingParams = {
+ messageID: peerData.messageID,
+ startParam: peerData.startParam
+ };
+ } else {
+ pendingParams = false;
+ }
+ if ($routeParams.p != peer) {
+ $location.url('/im?p=' + peer);
+ } else {
+ updateCurDialog();
+ }
}
});
@@ -569,21 +583,24 @@ angular.module('myApp.controllers', ['myApp.i18n'])
} else {
lastSearch = false;
}
+ var addParams = pendingParams || {};
+ pendingParams = false;
+ addParams.messageID = parseInt(addParams.messageID) || false;
+ addParams.startParam = addParams.startParam || false;
+
if ($routeParams.p && $routeParams.p.charAt(0) == '@') {
if ($scope.curDialog === undefined) {
$scope.curDialog = {};
}
AppUsersManager.resolveUsername($routeParams.p.substr(1)).then(function (userID) {
- $scope.curDialog = {
- peer: AppUsersManager.getUserString(userID),
- messageID: parseInt($routeParams.m) || false
- };
+ $scope.curDialog = angular.extend({
+ peer: AppUsersManager.getUserString(userID)
+ }, addParams);
});
} else {
- $scope.curDialog = {
- peer: $routeParams.p || false,
- messageID: parseInt($routeParams.m) || false
- };
+ $scope.curDialog = angular.extend({
+ peer: $routeParams.p || false
+ }, addParams);
}
}
@@ -639,6 +656,9 @@ angular.module('myApp.controllers', ['myApp.i18n'])
var topMessages = [];
var topToDialogs = {};
angular.forEach(dialogsUpdated, function (dialog, peerID) {
+ if ($scope.noUsers && peerID > 0) {
+ return;
+ }
topToDialogs[dialog.top_message] = dialog;
topMessages.push(dialog.top_message);
});
@@ -738,8 +758,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$location.url(
'/im' +
($scope.curDialog.peer
- ? '?p=' + $scope.curDialog.peer +
- ($scope.curDialog.messageID ? '&m=' + $scope.curDialog.messageID : '')
+ ? '?p=' + $scope.curDialog.peer
: ''
)
);
@@ -777,7 +796,11 @@ angular.module('myApp.controllers', ['myApp.i18n'])
return AppMessagesManager.getSearch({_: 'inputPeerEmpty'}, $scope.search.query, {_: 'inputMessagesFilterEmpty'}, maxID);
});
} else {
- promise = AppMessagesManager.getDialogs($scope.search.query, maxID);
+ var query = $scope.search.query;
+ if ($scope.noUsers) {
+ query = '%pg ' + (query || '');
+ }
+ promise = AppMessagesManager.getDialogs(query, maxID);
}
return promise.then(function (result) {
@@ -862,7 +885,10 @@ angular.module('myApp.controllers', ['myApp.i18n'])
return;
}
- if (!hasMore && !searchMessages && ($scope.search.query || !$scope.dialogs.length)) {
+ if (!hasMore &&
+ !searchMessages &&
+ !$scope.noUsers &&
+ ($scope.search.query || !$scope.dialogs.length)) {
showMoreConversations();
return;
}
@@ -937,7 +963,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
}, 500);
}
- if ($scope.search.query) {
+ if ($scope.search.query && !$scope.noMessages) {
searchMessages = true;
loadDialogs();
}
@@ -947,7 +973,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
.controller('AppImHistoryController', function ($scope, $location, $timeout, $rootScope, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, PeersSelectService, IdleManager, StatusManager, ErrorService) {
- $scope.$watch('curDialog', applyDialogSelect);
+ $scope.$watchCollection('curDialog', applyDialogSelect);
ApiUpdatesManager.attach();
IdleManager.start();
@@ -967,6 +993,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.selectedReply = selectedReply;
$scope.selectedCancel = selectedCancel;
$scope.selectedFlush = selectedFlush;
+ $scope.botStart = botStart;
$scope.toggleEdit = toggleEdit;
$scope.toggleMedia = toggleMedia;
@@ -1007,8 +1034,9 @@ angular.module('myApp.controllers', ['myApp.i18n'])
var newPeer = newDialog.peer || $scope.curDialog.peer || '';
peerID = AppPeersManager.getPeerID(newPeer);
-
- if (peerID == $scope.curDialog.peerID && oldDialog.messageID == newDialog.messageID) {
+ if (peerID == $scope.curDialog.peerID &&
+ oldDialog.messageID == newDialog.messageID &&
+ oldDialog.startParam == newDialog.startParam) {
return false;
}
@@ -1017,9 +1045,12 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.curDialog.inputPeer = AppPeersManager.getInputPeer(newPeer);
$scope.historyFilter.mediaType = false;
+ updateStartBot();
selectedCancel(true);
- if (oldDialog.peer && oldDialog.peer == newDialog.peer && newDialog.messageID) {
+ if (oldDialog.peer &&
+ oldDialog.peer == newDialog.peer &&
+ newDialog.messageID) {
messageFocusHistory();
}
else if (peerID) {
@@ -1108,6 +1139,36 @@ angular.module('myApp.controllers', ['myApp.i18n'])
}
}
+ function updateStartBot () {
+ var wasStartBot = $scope.historyState.startBot;
+ if (!peerID ||
+ peerID < 0 ||
+ !AppUsersManager.isBot(peerID) ||
+ $scope.historyFilter.mediaType ||
+ $scope.curDialog.messageID) {
+ $scope.historyState.startBot = false;
+ }
+ else if (
+ $scope.state.empty || (
+ peerHistory &&
+ peerHistory.messages.length == 1 &&
+ peerHistory.messages[0].action &&
+ peerHistory.messages[0].action._ == 'messageActionBotIntro'
+ )
+ ) {
+ $scope.historyState.startBot = 2;
+ }
+ else if ($scope.curDialog.startParam) {
+ $scope.historyState.startBot = 1;
+ }
+ else {
+ $scope.historyState.startBot = false;
+ }
+ if (wasStartBot != $scope.historyState.startBot) {
+ $scope.$broadcast('ui_panel_update');
+ }
+ }
+
function messageFocusHistory () {
var history = historiesQueueFind(peerID);
@@ -1310,6 +1371,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
AppMessagesManager.readHistory($scope.curDialog.inputPeer);
+ updateStartBot();
+
}, function () {
safeReplaceObject($scope.state, {error: true});
});
@@ -1325,16 +1388,47 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.$broadcast('ui_history_change');
}
+ function botStart () {
+ AppMessagesManager.startBot(peerID, 0, $scope.curDialog.startParam);
+ $scope.curDialog.startParam = false;
+ }
+
function toggleMessage (messageID, $event) {
- var target = $event.target,
- shiftClick = $event.shiftKey;
+ if ($scope.historyState.startBot) {
+ return false;
+ }
- if (shiftClick) {
- $scope.$broadcast('ui_selection_clear');
+ if (!$scope.historyState.selectActions) {
+ var sel = (
+ window.getSelection && window.getSelection() ||
+ document.getSelection && document.getSelection() ||
+ document.selection && document.selection.createRange().text || ''
+ ).toString().replace(/^\s+|\s+$/g, '');
+ if (sel) {
+ return false;
+ }
+
+ var target = $event.target;
+ while (target) {
+ if (target.className.indexOf('im_message_outer_wrap') != -1) {
+ break;
+ }
+ if (target.tagName == 'A' ||
+ target.onclick ||
+ target.getAttribute('ng-click')) {
+ return false;
+ }
+ var events = $._data(target, 'events');
+ if (events && (events.click || events.mousedown)) {
+ return false;
+ }
+ target = target.parentNode;
+ }
}
- if (!$scope.historyState.selectActions && !$(target).hasClass('icon-select-tick') && !$(target).hasClass('im_content_message_select_area')) {
- return false;
+ var shiftClick = $event.shiftKey;
+ if (shiftClick) {
+ $scope.$broadcast('ui_selection_clear');
}
if ($scope.selectedMsgs[messageID]) {
@@ -1382,6 +1476,11 @@ angular.module('myApp.controllers', ['myApp.i18n'])
}
function selectedCancel (noBroadcast) {
+ if (!noBroadcast &&
+ $scope.curDialog.startParam) {
+ delete $scope.curDialog.startParam;
+ return;
+ }
$scope.selectedMsgs = {};
$scope.selectedCount = 0;
$scope.historyState.selectActions = false;
@@ -1416,7 +1515,6 @@ angular.module('myApp.controllers', ['myApp.i18n'])
}
}
-
function selectedForward () {
if ($scope.selectedCount > 0) {
var selectedMessageIDs = [];
@@ -1493,6 +1591,16 @@ angular.module('myApp.controllers', ['myApp.i18n'])
loadAfterSync = false;
});
+ $scope.$on('reply_button_press', function (e, button) {
+ var replyKeyboard = $scope.historyState.replyKeyboard;
+ if (!replyKeyboard) {
+ return;
+ }
+ AppMessagesManager.sendText(peerID, button.text, {
+ replyToMsgID: peerID < 0 && replyKeyboard.id
+ });
+ });
+
var typingTimeouts = {};
$scope.$on('history_append', function (e, addedMessage) {
@@ -1552,6 +1660,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
AppMessagesManager.readHistory($scope.curDialog.inputPeer);
});
}
+
+ updateStartBot();
}
});
@@ -1644,6 +1754,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
AppMessagesManager.readHistory($scope.curDialog.inputPeer);
});
}
+
+ updateStartBot();
}
});
@@ -1673,6 +1785,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.$broadcast('messages_regroup');
if (historyUpdate.peerID == $scope.curDialog.peerID) {
$scope.state.empty = !newMessages.length;
+ updateStartBot();
}
});
@@ -1683,6 +1796,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
history.ids = [];
if (dialog.peerID == $scope.curDialog.peerID) {
$scope.state.empty = true;
+ updateStartBot();
}
}
});
@@ -1737,7 +1851,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.$on('user_update', angular.noop);
})
- .controller('AppImSendController', function ($scope, $timeout, MtpApiManager, Storage, AppChatsManager, AppUsersManager, AppPeersManager, AppDocsManager, AppMessagesManager, MtpApiFileManager) {
+ .controller('AppImSendController', function ($scope, $timeout, MtpApiManager, Storage, AppProfileManager, AppChatsManager, AppUsersManager, AppPeersManager, AppDocsManager, AppMessagesManager, MtpApiFileManager, RichTextProcessor) {
$scope.$watch('curDialog.peer', resetDraft);
$scope.$on('user_update', angular.noop);
@@ -1746,11 +1860,28 @@ angular.module('myApp.controllers', ['myApp.i18n'])
});
$scope.$on('ui_typing', onTyping);
- $scope.draftMessage = {text: '', send: sendMessage, replyClear: replyClear};
+ $scope.draftMessage = {
+ text: '',
+ send: sendMessage,
+ replyClear: replyClear
+ };
$scope.mentions = {};
+ $scope.commands = {};
$scope.$watch('draftMessage.text', onMessageChange);
$scope.$watch('draftMessage.files', onFilesSelected);
$scope.$watch('draftMessage.sticker', onStickerSelected);
+ $scope.$watch('draftMessage.command', onCommandSelected);
+
+ $scope.$on('history_reply_markup', function (e, peerData) {
+ if (peerData.peerID == $scope.curDialog.peerID) {
+ updateReplyKeyboard();
+ }
+ });
+
+ $scope.replyKeyboardToggle = replyKeyboardToggle;
+ $scope.toggleSlash = toggleSlash;
+
+ var replyToMarkup = false;
function sendMessage (e) {
$scope.$broadcast('ui_message_before_send');
@@ -1822,9 +1953,53 @@ angular.module('myApp.controllers', ['myApp.i18n'])
});
}
+ function updateCommands () {
+ var peerID = $scope.curDialog.peerID;
+
+ AppProfileManager.getPeerBots(peerID).then(function (peerBots) {
+ if (!peerBots.length) {
+ safeReplaceObject($scope.commands, {});
+ $scope.$broadcast('mentions_update');
+ return;
+ }
+
+ var needMentions = peerBots.length > 1;
+ var commandsList = [];
+ var commandsIndex = SearchIndexManager.createIndex();
+
+ angular.forEach(peerBots, function (peerBot) {
+ var mention = '';
+ if (needMentions) {
+ var bot = AppUsersManager.getUser(peerBot.id);
+ if (bot && bot.username) {
+ mention += '@' + bot.username;
+ }
+ }
+ var botSearchText = AppUsersManager.getUserSearchText(peerBot.id);
+ angular.forEach(peerBot.commands, function (description, command) {
+ var value = '/' + command + mention;
+ commandsList.push({
+ botID: peerBot.id,
+ value: value,
+ rDescription: RichTextProcessor.wrapRichText(description, {noLinks: true, noLineBreaks: true})
+ });
+ SearchIndexManager.indexObject(value, botSearchText + ' ' + command + ' ' + description, commandsIndex);
+ })
+ });
+
+ safeReplaceObject($scope.commands, {
+ list: commandsList,
+ index: commandsIndex
+ });
+ $scope.$broadcast('mentions_update');
+ });
+ }
+
function resetDraft (newPeer) {
updateMentions();
+ updateCommands();
replyClear();
+ updateReplyKeyboard();
if (newPeer) {
Storage.get('draft' + $scope.curDialog.peerID).then(function (draftText) {
@@ -1843,13 +2018,67 @@ angular.module('myApp.controllers', ['myApp.i18n'])
function replySelect(messageID) {
$scope.draftMessage.replyToMessage = AppMessagesManager.wrapForDialog(messageID);
$scope.$broadcast('ui_peer_reply');
+ replyToMarkup = false;
}
function replyClear() {
+ var message = $scope.draftMessage.replyToMessage;
+ if (message &&
+ $scope.historyState.replyKeyboard &&
+ $scope.historyState.replyKeyboard.id == message.id &&
+ !$scope.historyState.replyKeyboard.pFlags.hidden) {
+ $scope.historyState.replyKeyboard.pFlags.hidden = true;
+ $scope.$broadcast('ui_keyboard_update');
+ }
delete $scope.draftMessage.replyToMessage;
$scope.$broadcast('ui_peer_reply');
}
+ function toggleSlash ($event) {
+ if ($scope.draftMessage.text &&
+ $scope.draftMessage.text.charAt(0) == '/') {
+ $scope.draftMessage.text = '';
+ } else {
+ $scope.draftMessage.text = '/';
+ }
+ $scope.$broadcast('ui_peer_draft');
+ return cancelEvent($event);
+ }
+
+ function updateReplyKeyboard () {
+ var peerID = $scope.curDialog.peerID;
+ var replyKeyboard = AppMessagesManager.getReplyKeyboard(peerID);
+ if (replyKeyboard) {
+ replyKeyboard = AppMessagesManager.wrapReplyMarkup(replyKeyboard);
+ }
+ // console.log('update reply markup', peerID, replyKeyboard);
+ $scope.historyState.replyKeyboard = replyKeyboard;
+
+ var addReplyMessage =
+ replyKeyboard &&
+ !replyKeyboard.hidden &&
+ (replyKeyboard._ == 'replyKeyboardForceReply' ||
+ (replyKeyboard._ == 'replyKeyboardMarkup' && peerID < 0));
+
+ if (addReplyMessage) {
+ replySelect(replyKeyboard.id);
+ replyToMarkup = true;
+ }
+ else if (replyToMarkup) {
+ replyClear();
+ }
+ $scope.$broadcast('ui_keyboard_update');
+ }
+
+ function replyKeyboardToggle ($event) {
+ var replyKeyboard = $scope.historyState.replyKeyboard;
+ if (replyKeyboard) {
+ replyKeyboard.pFlags.hidden = !replyKeyboard.pFlags.hidden;
+ updateReplyKeyboard();
+ }
+ return cancelEvent($event);
+ }
+
function onMessageChange(newVal) {
// console.log('ctrl text changed', newVal);
// console.trace('ctrl text changed', newVal);
@@ -1916,6 +2145,17 @@ angular.module('myApp.controllers', ['myApp.i18n'])
}
delete $scope.draftMessage.sticker;
}
+
+ function onCommandSelected (command) {
+ if (!command) {
+ return;
+ }
+ AppMessagesManager.sendText($scope.curDialog.peerID, command);
+ delete $scope.draftMessage.sticker;
+ delete $scope.draftMessage.text;
+ $scope.$broadcast('ui_message_send');
+ $scope.$broadcast('ui_peer_draft');
+ }
})
.controller('AppLangSelectController', function ($scope, _, Storage, ErrorService, AppRuntimeManager) {
@@ -2156,8 +2396,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.nav = {};
$scope.canForward = true;
- var inputUser = AppUsersManager.getUserInput($scope.userID),
- list = [$scope.photoID],
+ var list = [$scope.photoID],
maxID = $scope.photoID,
preloaded = {},
myID = 0,
@@ -2165,7 +2404,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
updatePrevNext();
- AppPhotosManager.getUserPhotos(inputUser, 0, 1000).then(function (userpicCachedResult) {
+ AppPhotosManager.getUserPhotos($scope.userID, 0, 1000).then(function (userpicCachedResult) {
if (userpicCachedResult.photos.indexOf($scope.photoID) >= 0) {
list = userpicCachedResult.photos;
maxID = list[list.length - 1];
@@ -2234,7 +2473,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
function loadMore () {
if (loadingPromise) return loadingPromise;
- return loadingPromise = AppPhotosManager.getUserPhotos(inputUser, maxID).then(function (userpicResult) {
+ return loadingPromise = AppPhotosManager.getUserPhotos($scope.userID, maxID).then(function (userpicResult) {
if (userpicResult.photos.length) {
maxID = userpicResult.photos[userpicResult.photos.length - 1];
list = list.concat(userpicResult.photos);
@@ -2503,7 +2742,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
})
- .controller('UserModalController', function ($scope, $location, $rootScope, $modal, AppUsersManager, MtpApiManager, NotificationsManager, AppPhotosManager, AppMessagesManager, AppPeersManager, PeersSelectService, ErrorService) {
+ .controller('UserModalController', function ($scope, $location, $rootScope, AppProfileManager, $modal, AppUsersManager, MtpApiManager, NotificationsManager, AppPhotosManager, AppMessagesManager, AppPeersManager, PeersSelectService, ErrorService) {
var peerString = AppUsersManager.getUserString($scope.userID);
@@ -2513,23 +2752,10 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.settings = {notifications: true};
- MtpApiManager.invokeApi('users.getFullUser', {
- id: AppUsersManager.getUserInput($scope.userID)
- }).then(function (userFullResult) {
- if ($scope.override && $scope.override.phone_number) {
- userFullResult.user.phone = $scope.override.phone_number;
- if ($scope.override.first_name || $scope.override.last_name) {
- userFullResult.user.first_name = $scope.override.first_name;
- userFullResult.user.last_name = $scope.override.last_name;
- }
- AppUsersManager.saveApiUser(userFullResult.user);
- } else {
- AppUsersManager.saveApiUser(userFullResult.user, true);
- }
- AppPhotosManager.savePhoto(userFullResult.profile_photo);
- $scope.blocked = userFullResult.blocked;
+ AppProfileManager.getProfile($scope.userID, $scope.override).then(function (userFull) {
+ $scope.blocked = userFull.blocked;
+ $scope.bot_info = userFull.bot_info;
- NotificationsManager.savePeerSettings($scope.userID, userFullResult.notify_settings);
NotificationsManager.getPeerMuted($scope.userID).then(function (muted) {
$scope.settings.notifications = !muted;
@@ -2538,11 +2764,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
return false;
}
NotificationsManager.getPeerSettings($scope.userID).then(function (settings) {
- if (newValue) {
- settings.mute_until = 0;
- } else {
- settings.mute_until = 2000000000;
- }
+ settings.mute_until = newValue ? 0 : 2000000000;
NotificationsManager.updatePeerSettings($scope.userID, settings);
});
});
@@ -2588,6 +2810,26 @@ angular.module('myApp.controllers', ['myApp.i18n'])
});
};
+ $scope.inviteToGroup = function () {
+ PeersSelectService.selectPeer({
+ confirm_type: 'INVITE_TO_GROUP',
+ noUsers: true
+ }).then(function (peerString) {
+ var peerID = AppPeersManager.getPeerID(peerString);
+ var chatID = peerID < 0 ? -peerID : 0;
+ AppMessagesManager.startBot($scope.user.id, chatID).then(function () {
+ $rootScope.$broadcast('history_focus', {peerString: peerString});
+ });
+ });
+ };
+
+ $scope.sendCommand = function (command) {
+ AppMessagesManager.sendText($scope.userID, '/' + command);
+ $rootScope.$broadcast('history_focus', {
+ peerString: peerString
+ });
+ };
+
$scope.toggleBlock = function (block) {
MtpApiManager.invokeApi(block ? 'contacts.block' : 'contacts.unblock', {
id: AppUsersManager.getUserInput($scope.userID)
@@ -2690,11 +2932,9 @@ angular.module('myApp.controllers', ['myApp.i18n'])
};
$scope.kickFromGroup = function (userID) {
- var user = AppUsersManager.getUser(userID);
-
MtpApiManager.invokeApi('messages.deleteChatUser', {
chat_id: $scope.chatID,
- user_id: {_: 'inputUserForeign', user_id: userID, access_hash: user.access_hash || '0'}
+ user_id: AppUsersManager.getUserInput(userID)
}).then(onChatUpdated);
};
@@ -2783,7 +3023,9 @@ angular.module('myApp.controllers', ['myApp.i18n'])
id: {_: 'inputUserSelf'}
}).then(function (userFullResult) {
AppUsersManager.saveApiUser(userFullResult.user);
- AppPhotosManager.savePhoto(userFullResult.profile_photo);
+ AppPhotosManager.savePhoto(userFullResult.profile_photo, {
+ user_id: userFullResult.user.id
+ });
});
$scope.notify = {volume: 0.5};
@@ -2854,8 +3096,10 @@ angular.module('myApp.controllers', ['myApp.i18n'])
crop: {_: 'inputPhotoCropAuto'}
}).then(function (updateResult) {
AppUsersManager.saveApiUsers(updateResult.users);
- AppPhotosManager.savePhoto(updateResult.photo);
MtpApiManager.getUserID().then(function (id) {
+ AppPhotosManager.savePhoto(updateResult.photo, {
+ user_id: id
+ });
ApiUpdatesManager.processUpdateMessage({
_: 'updateShort',
update: {
diff --git a/app/js/directives.js b/app/js/directives.js
index 4314a4bf..b6dabd93 100755
--- a/app/js/directives.js
+++ b/app/js/directives.js
@@ -339,6 +339,16 @@ angular.module('myApp.directives', ['myApp.filters'])
};
function link ($scope, element, attrs) {
+ if (attrs.watch) {
+ $scope.$watch('replyMessage', function () {
+ checkMessage($scope, element);
+ });
+ } else {
+ checkMessage($scope, element);
+ }
+ }
+
+ function checkMessage ($scope, element) {
var message = $scope.replyMessage;
if (!message.loading) {
updateMessage($scope, element);
@@ -395,7 +405,7 @@ angular.module('myApp.directives', ['myApp.filters'])
var peerID = AppMessagesManager.getMessagePeer(message);
var peerString = AppPeersManager.getPeerString(peerID);
- $rootScope.$broadcast('history_focus', {peerString: peerString, messageID: message.id});
+ $rootScope.$broadcast('history_focus', {peerString: peerString, messageID: message.id});
})
}
@@ -403,6 +413,41 @@ angular.module('myApp.directives', ['myApp.filters'])
})
+ .directive('myReplyMarkup', function() {
+
+ return {
+ templateUrl: templateUrl('reply_markup'),
+ scope: {
+ 'replyMarkup': '=myReplyMarkup'
+ },
+ link: link
+ };
+
+ function link ($scope, element, attrs) {
+ var scrollable = $('.reply_markup', element);
+ var scroller = new Scroller(scrollable, {
+ classPrefix: 'reply_markup',
+ maxHeight: 170
+ });
+ $scope.buttonSend = function (button) {
+ $scope.$emit('reply_button_press', button);
+ }
+
+ $scope.$on('ui_keyboard_update', function () {
+ onContentLoaded(function () {
+ scroller.updateHeight();
+ scroller.scrollTo(0);
+ $scope.$emit('ui_panel_update');
+ })
+ });
+ onContentLoaded(function () {
+ scroller.updateHeight();
+ $scope.$emit('ui_panel_update');
+ });
+ }
+
+ })
+
.directive('myMessagePhoto', function(AppPhotosManager) {
return {
scope: {
@@ -563,7 +608,7 @@ angular.module('myApp.directives', ['myApp.filters'])
onContentLoaded(function () {
var selectedDialog = $(scrollableWrap).find('.active a.im_dialog')[0];
if (selectedDialog) {
- scrollToDialog(selectedDialog.parentNode);
+ scrollToNode(scrollableWrap, selectedDialog.parentNode, dialogsWrap);
}
});
});
@@ -621,7 +666,7 @@ angular.module('myApp.directives', ['myApp.filters'])
if (nextDialogWrap) {
$(nextDialogWrap).find('a').trigger('mousedown');
- scrollToDialog(nextDialogWrap);
+ scrollToNode(scrollableWrap, nextDialogWrap, dialogsWrap);
}
return cancelEvent(e);
@@ -681,29 +726,13 @@ angular.module('myApp.directives', ['myApp.filters'])
}
if (nextDialogWrap) {
- scrollToDialog(nextDialogWrap);
+ scrollToNode(scrollableWrap, nextDialogWrap, dialogsWrap);
}
return cancelEvent(e);
}
}
- function scrollToDialog(dialogWrap) {
- var elTop = dialogWrap.offsetTop - 15,
- elHeight = dialogWrap.offsetHeight + 30,
- scrollTop = scrollableWrap.scrollTop,
- viewportHeight = scrollableWrap.clientHeight;
-
- if (scrollTop > elTop) { // we are below the dialog to scroll
- scrollableWrap.scrollTop = elTop;
- $(dialogsWrap).nanoScroller({flash: true});
- }
- else if (scrollTop < elTop + elHeight - viewportHeight) { // we are over the dialog to scroll
- scrollableWrap.scrollTop = elTop + elHeight - viewportHeight;
- $(dialogsWrap).nanoScroller({flash: true});
- }
- }
-
}
@@ -1295,7 +1324,8 @@ angular.module('myApp.directives', ['myApp.filters'])
link: link,
scope: {
draftMessage: '=',
- mentions: '='
+ mentions: '=',
+ commands: '='
}
};
@@ -1363,8 +1393,8 @@ angular.module('myApp.directives', ['myApp.filters'])
getSendOnEnter: function () {
return sendOnEnter;
},
- getPeerImage: function (element, peerID) {
- if (cachedPeerPhotos[peerID]) {
+ getPeerImage: function (element, peerID, noReplace) {
+ if (cachedPeerPhotos[peerID] && !noReplace) {
element.replaceWith(cachedPeerPhotos[peerID]);
return;
}
@@ -1376,8 +1406,14 @@ angular.module('myApp.directives', ['myApp.filters'])
});
},
mentions: $scope.mentions,
+ commands: $scope.commands,
onMessageSubmit: onMessageSubmit,
- onFilePaste: onFilePaste
+ onFilePaste: onFilePaste,
+ onCommandSend: function (command) {
+ $scope.$apply(function () {
+ $scope.draftMessage.command = command;
+ });
+ }
});
var richTextarea = composer.richTextareaEl[0];
@@ -1465,6 +1501,9 @@ angular.module('myApp.directives', ['myApp.filters'])
if (!Config.Navigator.touch) {
composer.focus();
}
+ onContentLoaded(function () {
+ composer.checkAutocomplete(true);
+ });
if (emojiTooltip) {
emojiTooltip.hide();
}
@@ -1838,8 +1877,10 @@ angular.module('myApp.directives', ['myApp.filters'])
}
if ($scope.document.url) {
- $scope.isActive = !$scope.isActive;
- $scope.$emit('ui_height');
+ onContentLoaded(function () {
+ $scope.isActive = !$scope.isActive;
+ $scope.$emit('ui_height');
+ })
return;
}
@@ -1859,7 +1900,7 @@ angular.module('myApp.directives', ['myApp.filters'])
}
})
- .directive('myLoadSticker', function(MtpApiFileManager, FileManager) {
+ .directive('myLoadSticker', function(MtpApiFileManager, FileManager, AppStickersManager) {
var emptySrc = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
@@ -1876,13 +1917,7 @@ angular.module('myApp.directives', ['myApp.filters'])
.addClass(attrs.imgClass);
var setSrc = function (blob) {
- if (WebpManager.isWebpSupported()) {
- imgElement.attr('src', FileManager.getUrl(blob, 'image/webp'));
- return;
- }
- FileManager.getByteArray(blob).then(function (bytes) {
- imgElement.attr('src', WebpManager.getPngUrlFromData(bytes));
- });
+ imgElement.attr('src', FileManager.getUrl(blob));
};
imgElement.css({
@@ -1894,12 +1929,16 @@ angular.module('myApp.directives', ['myApp.filters'])
height: $scope.document.thumb.height
});
- var smallLocation = $scope.document.thumb.location;
+ var smallLocation = angular.copy($scope.document.thumb.location);
+ smallLocation.sticker = true;
+
var fullLocation = {
_: 'inputDocumentFileLocation',
id: $scope.document.id,
access_hash: $scope.document.access_hash,
- dc_id: $scope.document.dc_id
+ dc_id: $scope.document.dc_id,
+ file_name: $scope.document.file_name,
+ sticker: true
};
@@ -1932,6 +1971,14 @@ angular.module('myApp.directives', ['myApp.filters'])
console.log('Download sticker failed', e, fullLocation);
});
}
+
+ if (attrs.open && $scope.document.stickerSetInput) {
+ element
+ .addClass('clickable')
+ .on('click', function () {
+ AppStickersManager.openStickerset($scope.document.stickerSetInput);
+ });
+ }
}
})
@@ -2415,8 +2462,8 @@ angular.module('myApp.directives', ['myApp.filters'])
update = function () {
var user = AppUsersManager.getUser(userID);
element
- .html(statusFilter(user))
- .toggleClass('status_online', user.status && user.status._ == 'userStatusOnline');
+ .html(statusFilter(user, attrs.botChatPrivacy))
+ .toggleClass('status_online', user.status && user.status._ == 'userStatusOnline' || false);
};
$scope.$watch(attrs.myUserStatus, function (newUserID) {
@@ -2606,7 +2653,6 @@ angular.module('myApp.directives', ['myApp.filters'])
};
function link($scope, element, attrs) {
-
element.addClass('peer_photo_init');
var peerID, peer, peerPhoto;
@@ -2682,6 +2728,7 @@ angular.module('myApp.directives', ['myApp.filters'])
}
$scope.$watch(attrs.myPeerPhotolink, setPeerID);
+ setPeerID($scope.$eval(attrs.myPeerPhotolink));
if (attrs.watch) {
$scope.$on('user_update', function (e, updUserID) {
diff --git a/app/js/filters.js b/app/js/filters.js
index a17757bc..a76121a7 100644
--- a/app/js/filters.js
+++ b/app/js/filters.js
@@ -31,8 +31,11 @@ angular.module('myApp.filters', ['myApp.i18n'])
.filter('userStatus', function($filter, _) {
var relativeTimeFilter = $filter('relativeTime');
- return function (user) {
- var statusType = user && user.status && user.status._ || 'userStatusEmpty';
+ return function (user, botChatPrivacy) {
+ var statusType = user && user.status && user.status._;
+ if (!statusType) {
+ statusType = user.pFlags.bot ? 'userStatusBot' : 'userStatusEmpty';
+ }
switch (statusType) {
case 'userStatusOnline':
return _('user_status_online');
@@ -49,6 +52,16 @@ angular.module('myApp.filters', ['myApp.i18n'])
case 'userStatusLastMonth':
return _('user_status_last_month');
+ case 'userStatusBot':
+ if (botChatPrivacy) {
+ if (user.pFlags.botNoPrivacy) {
+ return _('user_status_bot_noprivacy');
+ } else {
+ return _('user_status_bot_privacy');
+ }
+ }
+ return _('user_status_bot');
+
case 'userStatusEmpty':
default:
return _('user_status_long_ago');
@@ -69,7 +82,9 @@ angular.module('myApp.filters', ['myApp.i18n'])
var dateFilter = $filter('date');
return function (timestamp, extended) {
-
+ if (!timestamp) {
+ return '';
+ }
var ticks = timestamp * 1000,
diff = Math.abs(tsNow() - ticks),
format = 'shortTime';
@@ -157,7 +172,7 @@ angular.module('myApp.filters', ['myApp.i18n'])
return size + ' b';
}
else if (size < 1048576) {
- return Math.round(size / 1024) + ' Kb';
+ return Math.round(size / 1024) + ' KB';
}
var mbs = size / 1048576;
if (progressing) {
diff --git a/app/js/lib/config.js b/app/js/lib/config.js
index 36f6d6ab..904e844d 100644
--- a/app/js/lib/config.js
+++ b/app/js/lib/config.js
@@ -42,10 +42,12 @@ Config.Navigator = {
(navigator.userAgent || '').toLowerCase().indexOf('mac') != -1,
retina: window.devicePixelRatio > 1,
ffos: navigator.userAgent.search(/mobi.+Gecko/i) != -1,
- touch: screen.width <= 768,
+ touch: screen.width <= 768 || ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch,
mobile: screen.width && screen.width < 480 || navigator.userAgent.search(/iOS|iPhone OS|Android|BlackBerry|BB10|Series ?[64]0|J2ME|MIDP|opera mini|opera mobi|mobi.+Gecko|Windows Phone/i) != -1
};
+// Touch detect: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
+
Config.I18n = {
locale: 'en-us',
supported: [
@@ -91,9 +93,9 @@ Config.Schema.MTProto = {"constructors":[{"id":"481674261","predicate":"vector",
// From https://github.com/stephenmathieson/node-tlds/blob/master/index.js
Config.TLD = ["abogado","ac","academy","accountants","active","actor","ad","adult","ae","aero","af","ag","agency","ai","airforce","al","allfinanz","alsace","am","amsterdam","an","android","ao","apartments","aq","aquarelle","ar","archi","army","arpa","as","asia","associates","at","attorney","au","auction","audio","autos","aw","ax","axa","az","ba","band","bank","bar","barclaycard","barclays","bargains","bayern","bb","bd","be","beer","berlin","best","bf","bg","bh","bi","bid","bike","bingo","bio","biz","bj","black","blackfriday","bloomberg","blue","bm","bmw","bn","bnpparibas","bo","boo","boutique","br","brussels","bs","bt","budapest","build","builders","business","buzz","bv","bw","by","bz","bzh","ca","cab","cal","camera","camp","cancerresearch","canon","capetown","capital","caravan","cards","care","career","careers","cartier","casa","cash","cat","catering","cc","cd","center","ceo","cern","cf","cg","ch","channel","chat","cheap","christmas","chrome","church","ci","citic","city","ck","cl","claims","cleaning","click","clinic","clothing","club","cm","cn","co","coach","codes","coffee","college","cologne","com","community","company","computer","condos","construction","consulting","contractors","cooking","cool","coop","country","cr","credit","creditcard","cricket","crs","cruises","cu","cuisinella","cv","cw","cx","cy","cymru","cz","dabur","dad","dance","dating","day","dclk","de","deals","degree","delivery","democrat","dental","dentist","desi","design","dev","diamonds","diet","digital","direct","directory","discount","dj","dk","dm","dnp","do","docs","domains","doosan","durban","dvag","dz","eat","ec","edu","education","ee","eg","email","emerck","energy","engineer","engineering","enterprises","equipment","er","es","esq","estate","et","eu","eurovision","eus","events","everbank","exchange","expert","exposed","fail","farm","fashion","feedback","fi","finance","financial","firmdale","fish","fishing","fit","fitness","fj","fk","flights","florist","flowers","flsmidth","fly","fm","fo","foo","forsale","foundation","fr","frl","frogans","fund","furniture","futbol","ga","gal","gallery","garden","gb","gbiz","gd","ge","gent","gf","gg","ggee","gh","gi","gift","gifts","gives","gl","glass","gle","global","globo","gm","gmail","gmo","gmx","gn","goog","google","gop","gov","gp","gq","gr","graphics","gratis","green","gripe","gs","gt","gu","guide","guitars","guru","gw","gy","hamburg","hangout","haus","healthcare","help","here","hermes","hiphop","hiv","hk","hm","hn","holdings","holiday","homes","horse","host","hosting","house","how","hr","ht","hu","ibm","id","ie","ifm","il","im","immo","immobilien","in","industries","info","ing","ink","institute","insure","int","international","investments","io","iq","ir","irish","is","it","iwc","jcb","je","jetzt","jm","jo","jobs","joburg","jp","juegos","kaufen","kddi","ke","kg","kh","ki","kim","kitchen","kiwi","km","kn","koeln","kp","kr","krd","kred","kw","ky","kyoto","kz","la","lacaixa","land","lat","latrobe","lawyer","lb","lc","lds","lease","legal","lgbt","li","lidl","life","lighting","limited","limo","link","lk","loans","london","lotte","lotto","lr","ls","lt","ltda","lu","luxe","luxury","lv","ly","ma","madrid","maison","management","mango","market","marketing","marriott","mc","md","me","media","meet","melbourne","meme","memorial","menu","mg","mh","miami","mil","mini","mk","ml","mm","mn","mo","mobi","moda","moe","monash","money","mormon","mortgage","moscow","motorcycles","mov","mp","mq","mr","ms","mt","mu","museum","mv","mw","mx","my","mz","na","nagoya","name","navy","nc","ne","net","network","neustar","new","nexus","nf","ng","ngo","nhk","ni","nico","ninja","nl","no","np","nr","nra","nrw","ntt","nu","nyc","nz","okinawa","om","one","ong","onl","ooo","org","organic","osaka","otsuka","ovh","pa","paris","partners","parts","party","pe","pf","pg","ph","pharmacy","photo","photography","photos","physio","pics","pictures","pink","pizza","pk","pl","place","plumbing","pm","pn","pohl","poker","porn","post","pr","praxi","press","pro","prod","productions","prof","properties","property","ps","pt","pub","pw","py","qa","qpon","quebec","re","realtor","recipes","red","rehab","reise","reisen","reit","ren","rentals","repair","report","republican","rest","restaurant","reviews","rich","rio","rip","ro","rocks","rodeo","rs","rsvp","ru","ruhr","rw","ryukyu","sa","saarland","sale","samsung","sarl","saxo","sb","sc","sca","scb","schmidt","schule","schwarz","science","scot","sd","se","services","sew","sexy","sg","sh","shiksha","shoes","shriram","si","singles","sj","sk","sky","sl","sm","sn","so","social","software","sohu","solar","solutions","soy","space","spiegel","sr","st","style","su","supplies","supply","support","surf","surgery","suzuki","sv","sx","sy","sydney","systems","sz","taipei","tatar","tattoo","tax","tc","td","technology","tel","temasek","tennis","tf","tg","th","tienda","tips","tires","tirol","tj","tk","tl","tm","tn","to","today","tokyo","tools","top","toshiba","town","toys","tp","tr","trade","training","travel","trust","tt","tui","tv","tw","tz","ua","ug","uk","university","uno","uol","us","uy","uz","va","vacations","vc","ve","vegas","ventures","versicherung","vet","vg","vi","viajes","video","villas","vision","vlaanderen","vn","vodka","vote","voting","voto","voyage","vu","wales","wang","watch","webcam","website","wed","wedding","wf","whoswho","wien","wiki","williamhill","wme","work","works","world","ws","wtc","wtf","佛山","集团","在线","한국","ভারত","八卦","موقع","公益","公司","移动","我爱你","москва","қаз","онлайн","сайт","срб","淡马锡","орг","삼성","சிங்கப்பூர்","商标","商店","商城","дети","мкд","中文网","中信","中国","中國","谷歌","భారత్","ලංකා","ભારત","भारत","网店","संगठन","网络","укр","香港","台湾","台灣","手机","мон","الجزائر","عمان","ایران","امارات","بازار","الاردن","بھارت","المغرب","السعودية","مليسيا","شبكة","გე","机构","组织机构","ไทย","سورية","рус","рф","تونس","みんな","グーグル","世界","ਭਾਰਤ","网址","游戏","vermögensberater","vermögensberatung","企业","مصر","قطر","广东","இலங்கை","இந்தியா","新加坡","فلسطين","政务","xxx","xyz","yachts","yandex","ye","yoga","yokohama","youtube","yt","za","zip","zm","zone","zuerich","zw"];
-Config.Schema.API = {"constructors":[{"id":"-1132882121","predicate":"boolFalse","params":[],"type":"Bool"},{"id":"-1720552011","predicate":"boolTrue","params":[],"type":"Bool"},{"id":"481674261","predicate":"vector","params":[],"type":"Vector t"},{"id":"-994444869","predicate":"error","params":[{"name":"code","type":"int"},{"name":"text","type":"string"}],"type":"Error"},{"id":"1450380236","predicate":"null","params":[],"type":"Null"},{"id":"2134579434","predicate":"inputPeerEmpty","params":[],"type":"InputPeer"},{"id":"2107670217","predicate":"inputPeerSelf","params":[],"type":"InputPeer"},{"id":"270785512","predicate":"inputPeerContact","params":[{"name":"user_id","type":"int"}],"type":"InputPeer"},{"id":"-1690012891","predicate":"inputPeerForeign","params":[{"name":"user_id","type":"int"},{"name":"access_hash","type":"long"}],"type":"InputPeer"},{"id":"396093539","predicate":"inputPeerChat","params":[{"name":"chat_id","type":"int"}],"type":"InputPeer"},{"id":"-1182234929","predicate":"inputUserEmpty","params":[],"type":"InputUser"},{"id":"-138301121","predicate":"inputUserSelf","params":[],"type":"InputUser"},{"id":"-2031530139","predicate":"inputUserContact","params":[{"name":"user_id","type":"int"}],"type":"InputUser"},{"id":"1700689151","predicate":"inputUserForeign","params":[{"name":"user_id","type":"int"},{"name":"access_hash","type":"long"}],"type":"InputUser"},{"id":"-208488460","predicate":"inputPhoneContact","params":[{"name":"client_id","type":"long"},{"name":"phone","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"}],"type":"InputContact"},{"id":"-181407105","predicate":"inputFile","params":[{"name":"id","type":"long"},{"name":"parts","type":"int"},{"name":"name","type":"string"},{"name":"md5_checksum","type":"string"}],"type":"InputFile"},{"id":"-1771768449","predicate":"inputMediaEmpty","params":[],"type":"InputMedia"},{"id":"-139464256","predicate":"inputMediaUploadedPhoto","params":[{"name":"file","type":"InputFile"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"-373312269","predicate":"inputMediaPhoto","params":[{"name":"id","type":"InputPhoto"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"-104578748","predicate":"inputMediaGeoPoint","params":[{"name":"geo_point","type":"InputGeoPoint"}],"type":"InputMedia"},{"id":"-1494984313","predicate":"inputMediaContact","params":[{"name":"phone_number","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"}],"type":"InputMedia"},{"id":"-515910468","predicate":"inputMediaUploadedVideo","params":[{"name":"file","type":"InputFile"},{"name":"duration","type":"int"},{"name":"w","type":"int"},{"name":"h","type":"int"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"-1761896484","predicate":"inputMediaUploadedThumbVideo","params":[{"name":"file","type":"InputFile"},{"name":"thumb","type":"InputFile"},{"name":"duration","type":"int"},{"name":"w","type":"int"},{"name":"h","type":"int"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"-1821749571","predicate":"inputMediaVideo","params":[{"name":"id","type":"InputVideo"},{"name":"caption","type":"string"}],"type":"InputMedia"},{"id":"480546647","predicate":"inputChatPhotoEmpty","params":[],"type":"InputChatPhoto"},{"id":"-1809496270","predicate":"inputChatUploadedPhoto","params":[{"name":"file","type":"InputFile"},{"name":"crop","type":"InputPhotoCrop"}],"type":"InputChatPhoto"},{"id":"-1293828344","predicate":"inputChatPhoto","params":[{"name":"id","type":"InputPhoto"},{"name":"crop","type":"InputPhotoCrop"}],"type":"InputChatPhoto"},{"id":"-457104426","predicate":"inputGeoPointEmpty","params":[],"type":"InputGeoPoint"},{"id":"-206066487","predicate":"inputGeoPoint","params":[{"name":"lat","type":"double"},{"name":"long","type":"double"}],"type":"InputGeoPoint"},{"id":"483901197","predicate":"inputPhotoEmpty","params":[],"type":"InputPhoto"},{"id":"-74070332","predicate":"inputPhoto","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputPhoto"},{"id":"1426648181","predicate":"inputVideoEmpty","params":[],"type":"InputVideo"},{"id":"-296249774","predicate":"inputVideo","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputVideo"},{"id":"342061462","predicate":"inputFileLocation","params":[{"name":"volume_id","type":"long"},{"name":"local_id","type":"int"},{"name":"secret","type":"long"}],"type":"InputFileLocation"},{"id":"1023632620","predicate":"inputVideoFileLocation","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"}],"type":"InputFileLocation"},{"id":"-1377390588","predicate":"inputPhotoCropAuto","params":[],"type":"InputPhotoCrop"},{"id":"-644787419","predicate":"inputPhotoCrop","params":[{"name":"crop_left","type":"double"},{"name":"crop_top","type":"double"},{"name":"crop_width","type":"double"}],"type":"InputPhotoCrop"},{"id":"1996904104","predicate":"inputAppEvent","params":[{"name":"time","type":"double"},{"name":"type","type":"string"},{"name":"peer","type":"long"},{"name":"data","type":"string"}],"type":"InputAppEvent"},{"id":"-1649296275","predicate":"peerUser","params":[{"name":"user_id","type":"int"}],"type":"Peer"},{"id":"-1160714821","predicate":"peerChat","params":[{"name":"chat_id","type":"int"}],"type":"Peer"},{"id":"-1432995067","predicate":"storage.fileUnknown","params":[],"type":"storage.FileType"},{"id":"8322574","predicate":"storage.fileJpeg","params":[],"type":"storage.FileType"},{"id":"-891180321","predicate":"storage.fileGif","params":[],"type":"storage.FileType"},{"id":"172975040","predicate":"storage.filePng","params":[],"type":"storage.FileType"},{"id":"-1373745011","predicate":"storage.filePdf","params":[],"type":"storage.FileType"},{"id":"1384777335","predicate":"storage.fileMp3","params":[],"type":"storage.FileType"},{"id":"1258941372","predicate":"storage.fileMov","params":[],"type":"storage.FileType"},{"id":"1086091090","predicate":"storage.filePartial","params":[],"type":"storage.FileType"},{"id":"-1278304028","predicate":"storage.fileMp4","params":[],"type":"storage.FileType"},{"id":"276907596","predicate":"storage.fileWebp","params":[],"type":"storage.FileType"},{"id":"2086234950","predicate":"fileLocationUnavailable","params":[{"name":"volume_id","type":"long"},{"name":"local_id","type":"int"},{"name":"secret","type":"long"}],"type":"FileLocation"},{"id":"1406570614","predicate":"fileLocation","params":[{"name":"dc_id","type":"int"},{"name":"volume_id","type":"long"},{"name":"local_id","type":"int"},{"name":"secret","type":"long"}],"type":"FileLocation"},{"id":"537022650","predicate":"userEmpty","params":[{"name":"id","type":"int"}],"type":"User"},{"id":"476112392","predicate":"userSelf","params":[{"name":"id","type":"int"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"username","type":"string"},{"name":"phone","type":"string"},{"name":"photo","type":"UserProfilePhoto"},{"name":"status","type":"UserStatus"}],"type":"User"},{"id":"-894214632","predicate":"userContact","params":[{"name":"id","type":"int"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"username","type":"string"},{"name":"access_hash","type":"long"},{"name":"phone","type":"string"},{"name":"photo","type":"UserProfilePhoto"},{"name":"status","type":"UserStatus"}],"type":"User"},{"id":"-640891665","predicate":"userRequest","params":[{"name":"id","type":"int"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"username","type":"string"},{"name":"access_hash","type":"long"},{"name":"phone","type":"string"},{"name":"photo","type":"UserProfilePhoto"},{"name":"status","type":"UserStatus"}],"type":"User"},{"id":"123533224","predicate":"userForeign","params":[{"name":"id","type":"int"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"username","type":"string"},{"name":"access_hash","type":"long"},{"name":"photo","type":"UserProfilePhoto"},{"name":"status","type":"UserStatus"}],"type":"User"},{"id":"-704549510","predicate":"userDeleted","params":[{"name":"id","type":"int"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"username","type":"string"}],"type":"User"},{"id":"1326562017","predicate":"userProfilePhotoEmpty","params":[],"type":"UserProfilePhoto"},{"id":"-715532088","predicate":"userProfilePhoto","params":[{"name":"photo_id","type":"long"},{"name":"photo_small","type":"FileLocation"},{"name":"photo_big","type":"FileLocation"}],"type":"UserProfilePhoto"},{"id":"164646985","predicate":"userStatusEmpty","params":[],"type":"UserStatus"},{"id":"-306628279","predicate":"userStatusOnline","params":[{"name":"expires","type":"int"}],"type":"UserStatus"},{"id":"9203775","predicate":"userStatusOffline","params":[{"name":"was_online","type":"int"}],"type":"UserStatus"},{"id":"-1683826688","predicate":"chatEmpty","params":[{"name":"id","type":"int"}],"type":"Chat"},{"id":"1855757255","predicate":"chat","params":[{"name":"id","type":"int"},{"name":"title","type":"string"},{"name":"photo","type":"ChatPhoto"},{"name":"participants_count","type":"int"},{"name":"date","type":"int"},{"name":"left","type":"Bool"},{"name":"version","type":"int"}],"type":"Chat"},{"id":"-83047359","predicate":"chatForbidden","params":[{"name":"id","type":"int"},{"name":"title","type":"string"},{"name":"date","type":"int"}],"type":"Chat"},{"id":"-891418735","predicate":"chatFull","params":[{"name":"id","type":"int"},{"name":"participants","type":"ChatParticipants"},{"name":"chat_photo","type":"Photo"},{"name":"notify_settings","type":"PeerNotifySettings"},{"name":"exported_invite","type":"ExportedChatInvite"}],"type":"ChatFull"},{"id":"-925415106","predicate":"chatParticipant","params":[{"name":"user_id","type":"int"},{"name":"inviter_id","type":"int"},{"name":"date","type":"int"}],"type":"ChatParticipant"},{"id":"265468810","predicate":"chatParticipantsForbidden","params":[{"name":"chat_id","type":"int"}],"type":"ChatParticipants"},{"id":"2017571861","predicate":"chatParticipants","params":[{"name":"chat_id","type":"int"},{"name":"admin_id","type":"int"},{"name":"participants","type":"Vector"},{"name":"version","type":"int"}],"type":"ChatParticipants"},{"id":"935395612","predicate":"chatPhotoEmpty","params":[],"type":"ChatPhoto"},{"id":"1632839530","predicate":"chatPhoto","params":[{"name":"photo_small","type":"FileLocation"},{"name":"photo_big","type":"FileLocation"}],"type":"ChatPhoto"},{"id":"-2082087340","predicate":"messageEmpty","params":[{"name":"id","type":"int"}],"type":"Message"},{"id":"-1481959023","predicate":"message","params":[{"name":"flags","type":"#"},{"name":"id","type":"int"},{"name":"from_id","type":"int"},{"name":"to_id","type":"Peer"},{"name":"fwd_from_id","type":"flags.2?int"},{"name":"fwd_date","type":"flags.2?int"},{"name":"reply_to_msg_id","type":"flags.3?int"},{"name":"date","type":"int"},{"name":"message","type":"string"},{"name":"media","type":"MessageMedia"}],"type":"Message"},{"id":"495384334","predicate":"messageService","params":[{"name":"flags","type":"int"},{"name":"id","type":"int"},{"name":"from_id","type":"int"},{"name":"to_id","type":"Peer"},{"name":"date","type":"int"},{"name":"action","type":"MessageAction"}],"type":"Message"},{"id":"1038967584","predicate":"messageMediaEmpty","params":[],"type":"MessageMedia"},{"id":"1032643901","predicate":"messageMediaPhoto","params":[{"name":"photo","type":"Photo"},{"name":"caption","type":"string"}],"type":"MessageMedia"},{"id":"1540298357","predicate":"messageMediaVideo","params":[{"name":"video","type":"Video"},{"name":"caption","type":"string"}],"type":"MessageMedia"},{"id":"1457575028","predicate":"messageMediaGeo","params":[{"name":"geo","type":"GeoPoint"}],"type":"MessageMedia"},{"id":"1585262393","predicate":"messageMediaContact","params":[{"name":"phone_number","type":"string"},{"name":"first_name","type":"string"},{"name":"last_name","type":"string"},{"name":"user_id","type":"int"}],"type":"MessageMedia"},{"id":"-1618676578","predicate":"messageMediaUnsupported","params":[],"type":"MessageMedia"},{"id":"-1230047312","predicate":"messageActionEmpty","params":[],"type":"MessageAction"},{"id":"-1503425638","predicate":"messageActionChatCreate","params":[{"name":"title","type":"string"},{"name":"users","type":"Vector"}],"type":"MessageAction"},{"id":"-1247687078","predicate":"messageActionChatEditTitle","params":[{"name":"title","type":"string"}],"type":"MessageAction"},{"id":"2144015272","predicate":"messageActionChatEditPhoto","params":[{"name":"photo","type":"Photo"}],"type":"MessageAction"},{"id":"-1780220945","predicate":"messageActionChatDeletePhoto","params":[],"type":"MessageAction"},{"id":"1581055051","predicate":"messageActionChatAddUser","params":[{"name":"user_id","type":"int"}],"type":"MessageAction"},{"id":"-1297179892","predicate":"messageActionChatDeleteUser","params":[{"name":"user_id","type":"int"}],"type":"MessageAction"},{"id":"-1042448310","predicate":"dialog","params":[{"name":"peer","type":"Peer"},{"name":"top_message","type":"int"},{"name":"read_inbox_max_id","type":"int"},{"name":"unread_count","type":"int"},{"name":"notify_settings","type":"PeerNotifySettings"}],"type":"Dialog"},{"id":"590459437","predicate":"photoEmpty","params":[{"name":"id","type":"long"}],"type":"Photo"},{"id":"-1014792074","predicate":"photo","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"},{"name":"user_id","type":"int"},{"name":"date","type":"int"},{"name":"geo","type":"GeoPoint"},{"name":"sizes","type":"Vector"}],"type":"Photo"},{"id":"236446268","predicate":"photoSizeEmpty","params":[{"name":"type","type":"string"}],"type":"PhotoSize"},{"id":"2009052699","predicate":"photoSize","params":[{"name":"type","type":"string"},{"name":"location","type":"FileLocation"},{"name":"w","type":"int"},{"name":"h","type":"int"},{"name":"size","type":"int"}],"type":"PhotoSize"},{"id":"-374917894","predicate":"photoCachedSize","params":[{"name":"type","type":"string"},{"name":"location","type":"FileLocation"},{"name":"w","type":"int"},{"name":"h","type":"int"},{"name":"bytes","type":"bytes"}],"type":"PhotoSize"},{"id":"-1056548696","predicate":"videoEmpty","params":[{"name":"id","type":"long"}],"type":"Video"},{"id":"-291550643","predicate":"video","params":[{"name":"id","type":"long"},{"name":"access_hash","type":"long"},{"name":"user_id","type":"int"},{"name":"date","type":"int"},{"name":"duration","type":"int"},{"name":"size","type":"int"},{"name":"thumb","type":"PhotoSize"},{"name":"dc_id","type":"int"},{"name":"w","type":"int"},{"name":"h","type":"int"}],"type":"Video"},{"id":"286776671","predicate":"geoPointEmpty","params":[],"type":"GeoPoint"},{"id":"541710092","predicate":"geoPoint","params":[{"name":"long","type":"double"},{"name":"lat","type":"double"}],"type":"GeoPoint"},{"id":"-2128698738","predicate":"auth.checkedPhone","params":[{"name":"phone_registered","type":"Bool"}],"type":"auth.CheckedPhone"},{"id":"-269659687","predicate":"auth.sentCode","params":[{"name":"phone_registered","type":"Bool"},{"name":"phone_code_hash","type":"string"},{"name":"send_call_timeout","type":"int"},{"name":"is_password","type":"Bool"}],"type":"auth.SentCode"},{"id":"-155815004","predicate":"auth.authorization","params":[{"name":"expires","type":"int"},{"name":"user","type":"User"}],"type":"auth.Authorization"},{"id":"-543777747","predicate":"auth.exportedAuthorization","params":[{"name":"id","type":"int"},{"name":"bytes","type":"bytes"}],"type":"auth.ExportedAuthorization"},{"id":"-1195615476","predicate":"inputNotifyPeer","params":[{"name":"peer","type":"InputPeer"}],"type":"InputNotifyPeer"},{"id":"423314455","predicate":"inputNotifyUsers","params":[],"type":"InputNotifyPeer"},{"id":"1251338318","predicate":"inputNotifyChats","params":[],"type":"InputNotifyPeer"},{"id":"-1540769658","predicate":"inputNotifyAll","params":[],"type":"InputNotifyPeer"},{"id":"-265263912","predicate":"inputPeerNotifyEventsEmpty","params":[],"type":"InputPeerNotifyEvents"},{"id":"-395694988","predicate":"inputPeerNotifyEventsAll","params":[],"type":"InputPeerNotifyEvents"},{"id":"1185074840","predicate":"inputPeerNotifySettings","params":[{"name":"mute_until","type":"int"},{"name":"sound","type":"string"},{"name":"show_previews","type":"Bool"},{"name":"events_mask","type":"int"}],"type":"InputPeerNotifySettings"},{"id":"-1378534221","predicate":"peerNotifyEventsEmpty","params":[],"type":"PeerNotifyEvents"},{"id":"1830677896","predicate":"peerNotifyEventsAll","params":[],"type":"PeerNotifyEvents"},{"id":"1889961234","predicate":"peerNotifySettingsEmpty","params":[],"type":"PeerNotifySettings"},{"id":"-1923214866","predicate":"peerNotifySettings","params":[{"name":"mute_until","type":"int"},{"name":"sound","type":"string"},{"name":"show_previews","type":"Bool"},{"name":"events_mask","type":"int"}],"type":"PeerNotifySettings"},{"id":"-860866985","predicate":"wallPaper","params":[{"name":"id","type":"int"},{"name":"title","type":"string"},{"name":"sizes","type":"Vector"},{"name":"color","type":"int"}],"type":"WallPaper"},{"id":"1997575642","predicate":"userFull","params":[{"name":"user","type":"User"},{"name":"link","type":"contacts.Link"},{"name":"profile_photo","type":"Photo"},{"name":"notify_settings","type":"PeerNotifySettings"},{"name":"blocked","type":"Bool"},{"name":"real_first_name","type":"string"},{"name":"real_last_name","type":"string"}],"type":"UserFull"},{"id":"-116274796","predicate":"contact","params":[{"name":"user_id","type":"int"},{"name":"mutual","type":"Bool"}],"type":"Contact"},{"id":"-805141448","predicate":"importedContact","params":[{"name":"user_id","type":"int"},{"name":"client_id","type":"long"}],"type":"ImportedContact"},{"id":"1444661369","predicate":"contactBlocked","params":[{"name":"user_id","type":"int"},{"name":"date","type":"int"}],"type":"ContactBlocked"},{"id":"1038193057","predicate":"contactSuggested","params":[{"name":"user_id","type":"int"},{"name":"mutual_contacts","type":"int"}],"type":"ContactSuggested"},{"id":"-748155807","predicate":"contactStatus","params":[{"name":"user_id","type":"int"},{"name":"status","type":"UserStatus"}],"type":"ContactStatus"},{"id":"909233996","predicate":"chatLocated","params":[{"name":"chat_id","type":"int"},{"name":"distance","type":"int"}],"type":"ChatLocated"},{"id":"986597452","predicate":"contacts.link","params":[{"name":"my_link","type":"ContactLink"},{"name":"foreign_link","type":"ContactLink"},{"name":"user","type":"User"}],"type":"contacts.Link"},{"id":"-1219778094","predicate":"contacts.contactsNotModified","params":[],"type":"contacts.Contacts"},{"id":"1871416498","predicate":"contacts.contacts","params":[{"name":"contacts","type":"Vector"},{"name":"users","type":"Vector"}],"type":"contacts.Contacts"},{"id":"-1387117803","predicate":"contacts.importedContacts","params":[{"name":"imported","type":"Vector"},{"name":"retry_contacts","type":"Vector"},{"name":"users","type":"Vector"}],"type":"contacts.ImportedContacts"},{"id":"471043349","predicate":"contacts.blocked","params":[{"name":"blocked","type":"Vector"},{"name":"users","type":"Vector"}],"type":"contacts.Blocked"},{"id":"-1878523231","predicate":"contacts.blockedSlice","params":[{"name":"count","type":"int"},{"name":"blocked","type":"Vector"},{"name":"users","type":"Vector"}],"type":"contacts.Blocked"},{"id":"1447681221","predicate":"contacts.suggested","params":[{"name":"results","type":"Vector"},{"name":"users","type":"Vector"}],"type":"contacts.Suggested"},{"id":"364538944","predicate":"messages.dialogs","params":[{"name":"dialogs","type":"Vector