Supported 26th layer schema
This commit is contained in:
parent
48b9d94289
commit
c5a7401e4a
@ -1524,7 +1524,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, ApiUpdatesManager, MtpApiFileManager) {
|
||||
.controller('AppImSendController', function ($scope, $timeout, MtpApiManager, Storage, AppChatsManager, AppUsersManager, AppPeersManager, AppDocsManager, AppMessagesManager, MtpApiFileManager) {
|
||||
|
||||
$scope.$watch('curDialog.peer', resetDraft);
|
||||
$scope.$on('user_update', angular.noop);
|
||||
@ -1695,7 +1695,10 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
access_hash: doc.access_hash
|
||||
}
|
||||
}
|
||||
AppMessagesManager.sendOther($scope.curDialog.peerID, inputMedia);
|
||||
var options = {
|
||||
replyToMsgID: $scope.draftMessage.replyToMessage && $scope.draftMessage.replyToMessage.id
|
||||
};
|
||||
AppMessagesManager.sendOther($scope.curDialog.peerID, inputMedia, options);
|
||||
$scope.$broadcast('ui_message_send');
|
||||
}
|
||||
delete $scope.draftMessage.sticker;
|
||||
@ -2162,8 +2165,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
MtpApiManager.invokeApi('messages.editChatPhoto', {
|
||||
chat_id: $scope.chatID,
|
||||
photo: {_: 'inputChatPhotoEmpty'}
|
||||
}).then(function (updateResult) {
|
||||
AppMessagesManager.onStatedMessage(updateResult);
|
||||
}).then(function (updates) {
|
||||
ApiUpdatesManager.processUpdateMessage(updates);
|
||||
$modalInstance.dismiss();
|
||||
$rootScope.$broadcast('history_focus', {peerString: AppChatsManager.getChatString($scope.chatID)});
|
||||
})['finally'](function () {
|
||||
@ -2398,8 +2401,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
});
|
||||
|
||||
|
||||
function onStatedMessage (statedMessage) {
|
||||
AppMessagesManager.onStatedMessage(statedMessage);
|
||||
function onChatUpdated (updates) {
|
||||
ApiUpdatesManager.processUpdateMessage(updates);
|
||||
$rootScope.$broadcast('history_focus', {peerString: $scope.chatFull.peerString});
|
||||
}
|
||||
|
||||
@ -2408,14 +2411,14 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
MtpApiManager.invokeApi('messages.deleteChatUser', {
|
||||
chat_id: $scope.chatID,
|
||||
user_id: {_: 'inputUserSelf'}
|
||||
}).then(onStatedMessage);
|
||||
}).then(onChatUpdated);
|
||||
};
|
||||
|
||||
$scope.returnToGroup = function () {
|
||||
MtpApiManager.invokeApi('messages.addChatUser', {
|
||||
chat_id: $scope.chatID,
|
||||
user_id: {_: 'inputUserSelf'}
|
||||
}).then(onStatedMessage);
|
||||
}).then(onChatUpdated);
|
||||
};
|
||||
|
||||
|
||||
@ -2431,19 +2434,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
chat_id: $scope.chatID,
|
||||
user_id: AppUsersManager.getUserInput(userID),
|
||||
fwd_limit: 100
|
||||
}).then(function (addResult) {
|
||||
ApiUpdatesManager.processUpdateMessage({
|
||||
_: 'updates',
|
||||
users: addResult.users,
|
||||
chats: addResult.chats,
|
||||
seq: 0,
|
||||
updates: [{
|
||||
_: 'updateNewMessage',
|
||||
message: addResult.message,
|
||||
pts: addResult.pts,
|
||||
pts_count: addResult.pts_count
|
||||
}]
|
||||
});
|
||||
}).then(function (updates) {
|
||||
ApiUpdatesManager.processUpdateMessage(updates);
|
||||
});
|
||||
});
|
||||
|
||||
@ -2457,7 +2449,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
MtpApiManager.invokeApi('messages.deleteChatUser', {
|
||||
chat_id: $scope.chatID,
|
||||
user_id: {_: 'inputUserForeign', user_id: userID, access_hash: user.access_hash || '0'}
|
||||
}).then(onStatedMessage);
|
||||
}).then(onChatUpdated);
|
||||
};
|
||||
|
||||
|
||||
@ -2488,9 +2480,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
file: inputFile,
|
||||
crop: {_: 'inputPhotoCropAuto'}
|
||||
}
|
||||
}).then(function (updateResult) {
|
||||
onStatedMessage(updateResult);
|
||||
});
|
||||
}).then(onChatUpdated);
|
||||
})['finally'](function () {
|
||||
$scope.photo.updating = false;
|
||||
});
|
||||
@ -2501,9 +2491,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
MtpApiManager.invokeApi('messages.editChatPhoto', {
|
||||
chat_id: $scope.chatID,
|
||||
photo: {_: 'inputChatPhotoEmpty'}
|
||||
}).then(function (updateResult) {
|
||||
onStatedMessage(updateResult);
|
||||
})['finally'](function () {
|
||||
}).then(onChatUpdated)['finally'](function () {
|
||||
$scope.photo.updating = false;
|
||||
});
|
||||
};
|
||||
@ -3115,19 +3103,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
return MtpApiManager.invokeApi('messages.editChatTitle', {
|
||||
chat_id: $scope.chatID,
|
||||
title: $scope.group.name
|
||||
}).then(function (editResult) {
|
||||
ApiUpdatesManager.processUpdateMessage({
|
||||
_: 'updates',
|
||||
users: editResult.users,
|
||||
chats: editResult.chats,
|
||||
seq: 0,
|
||||
updates: [{
|
||||
_: 'updateNewMessage',
|
||||
message: editResult.message,
|
||||
pts: editResult.pts,
|
||||
pts_count: editResult.pts_count
|
||||
}]
|
||||
});
|
||||
}).then(function (updates) {
|
||||
ApiUpdatesManager.processUpdateMessage(updates);
|
||||
|
||||
var peerString = AppChatsManager.getChatString($scope.chatID);
|
||||
$rootScope.$broadcast('history_focus', {peerString: peerString});
|
||||
|
File diff suppressed because one or more lines are too long
@ -501,8 +501,8 @@ messages.deleteHistory#f4f8fb61 peer:InputPeer offset:int = messages.AffectedHis
|
||||
messages.deleteMessages#a5f18925 id:Vector<int> = messages.AffectedMessages;
|
||||
messages.receivedMessages#28abcb68 max_id:int = Vector<int>;
|
||||
messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
|
||||
messages.sendMessage#1ca852a1 peer:InputPeer reply_to_msg_id:int message:string random_id:long = messages.SentMessage;
|
||||
messages.sendMedia#33f6d58c peer:InputPeer reply_to_msg_id:int media:InputMedia random_id:long = Updates;
|
||||
messages.sendMessage#9add8f26 flags:# peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long = messages.SentMessage;
|
||||
messages.sendMedia#2d7923b1 flags:# peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long = Updates;
|
||||
messages.forwardMessages#55e1728d peer:InputPeer id:Vector<int> random_id:Vector<long> = Updates;
|
||||
messages.getChats#3c6aa187 id:Vector<int> = messages.Chats;
|
||||
messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull;
|
||||
@ -589,6 +589,9 @@ messages.getStickers#ae22e045 emoticon:string hash:string = messages.Stickers;
|
||||
messages.getAllStickers#aa3bc868 hash:string = messages.AllStickers;
|
||||
|
||||
account.updateDeviceLocked#38df3532 period:int = Bool;
|
||||
|
||||
messages.getWebPagePreview#25223e24 message:string = MessageMedia;
|
||||
|
||||
account.getAuthorizations#e320c158 = account.Authorizations;
|
||||
account.resetAuthorization#df77f3bc hash:long = Bool;
|
||||
account.getPassword#548a30f5 = account.Password;
|
||||
|
@ -222,7 +222,17 @@ TLSerialization.prototype.storeMethod = function (methodName, params) {
|
||||
|
||||
var self = this;
|
||||
angular.forEach(methodData.params, function (param) {
|
||||
self.storeObject(params[param.name], param.type, methodName + '[' + param.name + ']');
|
||||
var type = param.type;
|
||||
if (type.indexOf('?') !== -1) {
|
||||
var condType = type.split('?');
|
||||
var fieldBit = condType[0].split('.');
|
||||
if (!(params[fieldBit[0]] & (1 << fieldBit[1]))) {
|
||||
return;
|
||||
}
|
||||
type = condType[1];
|
||||
}
|
||||
|
||||
self.storeObject(params[param.name], type, methodName + '[' + param.name + ']');
|
||||
});
|
||||
|
||||
return methodData.type;
|
||||
@ -230,6 +240,7 @@ TLSerialization.prototype.storeMethod = function (methodName, params) {
|
||||
|
||||
TLSerialization.prototype.storeObject = function (obj, type, field) {
|
||||
switch (type) {
|
||||
case '#':
|
||||
case 'int': return this.storeInt(obj, field);
|
||||
case 'long': return this.storeLong(obj, field);
|
||||
case 'int128': return this.storeIntBytes(obj, 128, field);
|
||||
@ -293,7 +304,17 @@ TLSerialization.prototype.storeObject = function (obj, type, field) {
|
||||
|
||||
var self = this;
|
||||
angular.forEach(constructorData.params, function (param) {
|
||||
self.storeObject(obj[param.name], param.type, field + '[' + predicate + '][' + param.name + ']');
|
||||
var type = param.type;
|
||||
if (type.indexOf('?') !== -1) {
|
||||
var condType = type.split('?');
|
||||
var fieldBit = condType[0].split('.');
|
||||
if (!(obj[fieldBit[0]] & (1 << fieldBit[1]))) {
|
||||
return;
|
||||
}
|
||||
type = condType[1];
|
||||
}
|
||||
|
||||
self.storeObject(obj[param.name], type, field + '[' + predicate + '][' + param.name + ']');
|
||||
});
|
||||
|
||||
return constructorData.type;
|
||||
|
@ -1477,7 +1477,12 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
if (pendingAfterMsgs[peerID]) {
|
||||
sentRequestOptions.afterMessageID = pendingAfterMsgs[peerID].messageID;
|
||||
}
|
||||
var flags = 0;
|
||||
if (replyToMsgID) {
|
||||
flags |= 1;
|
||||
}
|
||||
MtpApiManager.invokeApi('messages.sendMessage', {
|
||||
flags: flags,
|
||||
peer: inputPeer,
|
||||
message: text,
|
||||
random_id: randomID,
|
||||
@ -1638,32 +1643,18 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
{_: 'documentAttributeFilename', file_name: file.name}
|
||||
]};
|
||||
}
|
||||
var flags = 0;
|
||||
if (replyToMsgID) {
|
||||
flags |= 1;
|
||||
}
|
||||
MtpApiManager.invokeApi('messages.sendMedia', {
|
||||
flags: flags,
|
||||
peer: inputPeer,
|
||||
media: inputMedia,
|
||||
random_id: randomID,
|
||||
reply_to_msg_id: replyToMsgID
|
||||
}).then(function (statedMessage) {
|
||||
message.date = statedMessage.message.date;
|
||||
message.id = statedMessage.message.id;
|
||||
message.media = statedMessage.message.media;
|
||||
|
||||
ApiUpdatesManager.processUpdateMessage({
|
||||
_: 'updates',
|
||||
users: statedMessage.users,
|
||||
chats: statedMessage.chats,
|
||||
seq: 0,
|
||||
updates: [{
|
||||
_: 'updateMessageID',
|
||||
random_id: randomIDS,
|
||||
id: statedMessage.message.id
|
||||
}, {
|
||||
_: 'updateNewMessage',
|
||||
message: message,
|
||||
pts: statedMessage.pts,
|
||||
pts_count: statedMessage.pts_count
|
||||
}]
|
||||
});
|
||||
}).then(function (updates) {
|
||||
ApiUpdatesManager.processUpdateMessage(updates);
|
||||
}, function (error) {
|
||||
if (attachType == 'photo' &&
|
||||
error.code == 400 &&
|
||||
@ -1710,12 +1701,15 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
pendingByRandomID[randomIDS] = [peerID, messageID];
|
||||
}
|
||||
|
||||
function sendOther(peerID, inputMedia) {
|
||||
function sendOther(peerID, inputMedia, options) {
|
||||
options = options || {};
|
||||
|
||||
var messageID = tempID--,
|
||||
randomID = [nextRandomInt(0xFFFFFFFF), nextRandomInt(0xFFFFFFFF)],
|
||||
randomIDS = bigint(randomID[0]).shiftLeft(32).add(bigint(randomID[1])).toString(),
|
||||
historyStorage = historiesStorage[peerID],
|
||||
inputPeer = AppPeersManager.getInputPeerByID(peerID);
|
||||
inputPeer = AppPeersManager.getInputPeerByID(peerID),
|
||||
replyToMsgID = options.replyToMsgID;
|
||||
|
||||
if (historyStorage === undefined) {
|
||||
historyStorage = historiesStorage[peerID] = {count: null, history: [], pending: []};
|
||||
@ -1773,32 +1767,18 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
}
|
||||
|
||||
message.send = function () {
|
||||
var flags = 0;
|
||||
if (replyToMsgID) {
|
||||
flags |= 1;
|
||||
}
|
||||
MtpApiManager.invokeApi('messages.sendMedia', {
|
||||
flags: flags,
|
||||
peer: inputPeer,
|
||||
media: inputMedia,
|
||||
random_id: randomID,
|
||||
reply_to_msg_id: 0
|
||||
}).then(function (statedMessage) {
|
||||
message.date = statedMessage.message.date;
|
||||
message.id = statedMessage.message.id;
|
||||
message.media = statedMessage.message.media;
|
||||
|
||||
ApiUpdatesManager.processUpdateMessage({
|
||||
_: 'updates',
|
||||
users: statedMessage.users,
|
||||
chats: statedMessage.chats,
|
||||
seq: 0,
|
||||
updates: [{
|
||||
_: 'updateMessageID',
|
||||
random_id: randomIDS,
|
||||
id: statedMessage.message.id
|
||||
}, {
|
||||
_: 'updateNewMessage',
|
||||
message: message,
|
||||
pts: statedMessage.pts,
|
||||
pts_count: statedMessage.pts_count
|
||||
}]
|
||||
});
|
||||
reply_to_msg_id: replyToMsgID
|
||||
}).then(function (updates) {
|
||||
ApiUpdatesManager.processUpdateMessage(updates);
|
||||
}, function (error) {
|
||||
toggleError(true);
|
||||
});
|
||||
@ -1828,24 +1808,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
peer: AppPeersManager.getInputPeerByID(peerID),
|
||||
id: msgIDs,
|
||||
random_id: randomIDs
|
||||
}).then(function (statedMessages) {
|
||||
var updates = [];
|
||||
angular.forEach(statedMessages.messages, function(apiMessage) {
|
||||
updates.push({
|
||||
_: 'updateNewMessage',
|
||||
message: apiMessage,
|
||||
pts: statedMessages.pts,
|
||||
pts_count: statedMessages.pts_count
|
||||
});
|
||||
});
|
||||
|
||||
ApiUpdatesManager.processUpdateMessage({
|
||||
_: 'updates',
|
||||
users: statedMessages.users,
|
||||
chats: statedMessages.chats,
|
||||
seq: 0,
|
||||
updates: updates
|
||||
});
|
||||
}).then(function (updates) {
|
||||
ApiUpdatesManager.processUpdateMessage(updates);
|
||||
});
|
||||
};
|
||||
|
||||
@ -1924,21 +1888,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
return false;
|
||||
}
|
||||
|
||||
function onStatedMessage (statedMessage) {
|
||||
ApiUpdatesManager.processUpdateMessage({
|
||||
_: 'updates',
|
||||
users: statedMessage.users,
|
||||
chats: statedMessage.chats,
|
||||
seq: 0,
|
||||
updates: [{
|
||||
_: 'updateNewMessage',
|
||||
message: statedMessage.message,
|
||||
pts: statedMessage.pts,
|
||||
pts_count: statedMessage.pts_count
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
function getMessagePeer (message) {
|
||||
var toID = message.to_id && AppPeersManager.getPeerID(message.to_id) || 0;
|
||||
|
||||
@ -2596,7 +2545,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
sendFile: sendFile,
|
||||
sendOther: sendOther,
|
||||
forwardMessages: forwardMessages,
|
||||
onStatedMessage: onStatedMessage,
|
||||
getMessagePeer: getMessagePeer,
|
||||
wrapForDialog: wrapForDialog,
|
||||
wrapForHistory: wrapForHistory,
|
||||
|
Loading…
Reference in New Issue
Block a user