Browse Source

Layer 33 draft

master
Igor Zhukov 9 years ago
parent
commit
97f0f80808
  1. 3
      app/index.html
  2. 5
      app/js/controllers.js
  3. 4
      app/js/lib/config.js
  4. 66
      app/js/lib/schema.tl.txt
  5. 17
      app/js/lib/utils.js
  6. 136
      app/js/services.js
  7. 8
      app/partials/desktop/user_modal.html
  8. 6
      app/partials/mobile/user_modal.html
  9. 10321
      app/vendor/libwebpjs/libwebp-0.1.13.js
  10. 2
      app/webogram.appcache

3
app/index.html

@ -64,7 +64,8 @@ @@ -64,7 +64,8 @@
<script type="text/javascript" src="vendor/zlib/gunzip.min.js"></script>
<script type="text/javascript" src="vendor/closure/long.js"></script>
<script type="text/javascript" src="vendor/leemon_bigint/bigint.js"></script>
<script type="text/javascript" src="vendor/libwebpjs/libwebp-0.2.0.min.js"></script>
<!--script type="text/javascript" src="vendor/libwebpjs/libwebp-0.2.0.min.js"></script-->
<script type="text/javascript" src="vendor/libwebpjs/libwebp-0.1.13.js"></script>
<script type="text/javascript" src="js/lib/utils.js"></script>

5
app/js/controllers.js

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

4
app/js/lib/config.js

File diff suppressed because one or more lines are too long

66
app/js/lib/schema.tl.txt

@ -9,14 +9,10 @@ null#56730bcc = Null; @@ -9,14 +9,10 @@ null#56730bcc = Null;
inputPeerEmpty#7f3b18ea = InputPeer;
inputPeerSelf#7da07ec9 = InputPeer;
inputPeerContact#1023dbe8 user_id:int = InputPeer;
inputPeerForeign#9b447325 user_id:int access_hash:long = InputPeer;
inputPeerChat#179be863 chat_id:int = InputPeer;
inputUserEmpty#b98886cf = InputUser;
inputUserSelf#f7c1b13f = InputUser;
inputUserContact#86e94f65 user_id:int = InputUser;
inputUserForeign#655e74ff user_id:int access_hash:long = InputUser;
inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact;
@ -70,11 +66,6 @@ fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileL @@ -70,11 +66,6 @@ fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileL
fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation;
userEmpty#200250ba id:int = User;
userSelf#1c60e608 id:int first_name:string last_name:string username:string phone:string photo:UserProfilePhoto status:UserStatus = User;
userContact#cab35e18 id:int first_name:string last_name:string username:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
userRequest#d9ccc4ef id:int first_name:string last_name:string username:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
userForeign#75cf7a8 id:int first_name:string last_name:string username:string access_hash:long photo:UserProfilePhoto status:UserStatus = User;
userDeleted#d6016d7a id:int first_name:string last_name:string username:string = User;
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto;
@ -87,7 +78,7 @@ chatEmpty#9ba2d800 id:int = Chat; @@ -87,7 +78,7 @@ chatEmpty#9ba2d800 id:int = Chat;
chat#6e9c9bc7 id:int title:string photo:ChatPhoto participants_count:int date:int left:Bool version:int = Chat;
chatForbidden#fb0ccc41 id:int title:string date:int = Chat;
chatFull#cade0791 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite = ChatFull;
chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> = ChatFull;
chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant;
@ -98,7 +89,7 @@ chatPhotoEmpty#37c1011c = ChatPhoto; @@ -98,7 +89,7 @@ chatPhotoEmpty#37c1011c = ChatPhoto;
chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto;
messageEmpty#83e5de54 id:int = Message;
message#a7ab1991 flags:# id:int from_id:int to_id:Peer fwd_from_id:flags.2?int fwd_date:flags.2?int reply_to_msg_id:flags.3?int date:int message:string media:MessageMedia = Message;
message#c3060325 flags:# id:int from_id:int to_id:Peer fwd_from_id:flags.2?int fwd_date:flags.2?int reply_to_msg_id:flags.3?int date:int message:string media:MessageMedia reply_markup:flags.6?ReplyMarkup = Message;
messageService#1d86f70e flags:int id:int from_id:int to_id:Peer date:int action:MessageAction = Message;
messageMediaEmpty#3ded6320 = MessageMedia;
@ -119,14 +110,14 @@ messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; @@ -119,14 +110,14 @@ messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction;
dialog#c1dd804a peer:Peer top_message:int read_inbox_max_id:int unread_count:int notify_settings:PeerNotifySettings = Dialog;
photoEmpty#2331b22d id:long = Photo;
photo#c3838076 id:long access_hash:long user_id:int date:int geo:GeoPoint sizes:Vector<PhotoSize> = Photo;
photo#690cc3a6 id:long access_hash:long sizes:Vector<PhotoSize> = Photo;
photoSizeEmpty#e17e23c type:string = PhotoSize;
photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize;
photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize;
videoEmpty#c10658a8 id:long = Video;
video#ee9f4a4d id:long access_hash:long user_id:int date:int duration:int size:int thumb:PhotoSize dc_id:int w:int h:int = Video;
video#954cc1cc id:long access_hash:long duration:int mime_type:string size:int thumb:PhotoSize dc_id:int w:int h:int = Video;
geoPointEmpty#1117dd5f = GeoPoint;
geoPoint#2049d70c long:double lat:double = GeoPoint;
@ -135,7 +126,7 @@ auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; @@ -135,7 +126,7 @@ auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone;
auth.sentCode#efed51d9 phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode;
auth.authorization#f6b673a4 expires:int user:User = auth.Authorization;
auth.authorization#ff036af1 user:User = auth.Authorization;
auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization;
@ -157,7 +148,7 @@ peerNotifySettings#8d5e11ee mute_until:int sound:string show_previews:Bool event @@ -157,7 +148,7 @@ peerNotifySettings#8d5e11ee mute_until:int sound:string show_previews:Bool event
wallPaper#ccb03657 id:int title:string sizes:Vector<PhotoSize> color:int = WallPaper;
userFull#771095da user:User link:contacts.Link profile_photo:Photo notify_settings:PeerNotifySettings blocked:Bool real_first_name:string real_last_name:string = UserFull;
userFull#5a89ac5b user:User link:contacts.Link profile_photo:Photo notify_settings:PeerNotifySettings blocked:Bool bot_info:BotInfo = UserFull;
contact#f911c994 user_id:int mutual:Bool = Contact;
@ -206,6 +197,7 @@ inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; @@ -206,6 +197,7 @@ inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter;
inputMessagesFilterPhotoVideoDocuments#d95e73bb = MessagesFilter;
inputMessagesFilterDocument#9eddf188 = MessagesFilter;
inputMessagesFilterAudio#cfc87522 = MessagesFilter;
inputMessagesFilterAudioDocuments#5afbf764 = MessagesFilter;
updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update;
updateMessageID#4e90bfd6 id:int random_id:long = Update;
@ -240,7 +232,7 @@ photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo; @@ -240,7 +232,7 @@ photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo;
upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;
dcOption#2ec2a43c id:int hostname:string ip_address:string port:int = DcOption;
dcOption#5d8c6cc flags:# id:int ip_address:string port:int = DcOption;
config#4e32b894 date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_size_max:int broadcast_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int disabled_features:Vector<DisabledFeature> = Config;
@ -335,10 +327,10 @@ inputAudioFileLocation#74dc404d id:long access_hash:long = InputFileLocation; @@ -335,10 +327,10 @@ inputAudioFileLocation#74dc404d id:long access_hash:long = InputFileLocation;
inputDocumentFileLocation#4e45abe9 id:long access_hash:long = InputFileLocation;
audioEmpty#586988d8 id:long = Audio;
audio#c7ac6496 id:long access_hash:long user_id:int date:int duration:int mime_type:string size:int dc_id:int = Audio;
audio#a5e11d9c id:long access_hash:long duration:int mime_type:string size:int dc_id:int = Audio;
documentEmpty#36f8c871 id:long = Document;
document#f9a39f4f id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector<DocumentAttribute> = Document;
document#902db111 id:long access_hash:long mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector<DocumentAttribute> = Document;
help.support#17c6b5f6 phone_number:string user:User = help.Support;
@ -405,7 +397,7 @@ documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; @@ -405,7 +397,7 @@ documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;
documentAttributeAnimated#11b58939 = DocumentAttribute;
documentAttributeSticker#3a556302 alt:string stickerset:InputStickerSet = DocumentAttribute;
documentAttributeVideo#5910cccb duration:int w:int h:int = DocumentAttribute;
documentAttributeAudio#51448e5 duration:int = DocumentAttribute;
documentAttributeAudio#ded218e0 duration:int title:string performer:string = DocumentAttribute;
documentAttributeFilename#15590068 file_name:string = DocumentAttribute;
messages.stickersNotModified#f1749a22 = messages.Stickers;
@ -414,7 +406,7 @@ messages.stickers#8a8ecd32 hash:string stickers:Vector<Document> = messages.Stic @@ -414,7 +406,7 @@ messages.stickers#8a8ecd32 hash:string stickers:Vector<Document> = messages.Stic
stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack;
messages.allStickersNotModified#e86602c3 = messages.AllStickers;
messages.allStickers#5ce352ec hash:string packs:Vector<StickerPack> sets:Vector<StickerSet> documents:Vector<Document> = messages.AllStickers;
messages.allStickers#d51dafdb hash:string sets:Vector<StickerSet> = messages.AllStickers;
disabledFeature#ae636f24 feature:string description:string = DisabledFeature;
@ -469,10 +461,29 @@ inputStickerSetEmpty#ffb62b95 = InputStickerSet; @@ -469,10 +461,29 @@ inputStickerSetEmpty#ffb62b95 = InputStickerSet;
inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
stickerSet#a7a43b17 id:long access_hash:long title:string short_name:string = StickerSet;
stickerSet#cd303b41 flags:# id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet;
messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
user#22e49072 flags:# id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int = User;
botCommand#c27ac8c7 command:string description:string = BotCommand;
botInfoEmpty#bb2e37ce = BotInfo;
botInfo#9cf585d user_id:int version:int share_text:string description:string commands:Vector<BotCommand> = BotInfo;
keyboardButton#a2fa4880 text:string = KeyboardButton;
keyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow;
replyKeyboardHide#a03e5b85 flags:# = ReplyMarkup;
replyKeyboardForceReply#f4108aa0 flags:# = ReplyMarkup;
replyKeyboardMarkup#3502758c flags:# rows:Vector<KeyboardButtonRow> = ReplyMarkup;
inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer;
inputUser#d8292816 user_id:int access_hash:long = InputUser;
---functions---
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
@ -524,8 +535,8 @@ messages.deleteHistory#f4f8fb61 peer:InputPeer offset:int = messages.AffectedHis @@ -524,8 +535,8 @@ messages.deleteHistory#f4f8fb61 peer:InputPeer offset:int = messages.AffectedHis
messages.deleteMessages#a5f18925 id:Vector<int> = messages.AffectedMessages;
messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
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.sendMessage#fc55e6b5 flags:# peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup = messages.SentMessage;
messages.sendMedia#c8f16791 flags:# peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = 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;
@ -551,7 +562,7 @@ help.getAppUpdate#c812ac7e device_model:string system_version:string app_version @@ -551,7 +562,7 @@ help.getAppUpdate#c812ac7e device_model:string system_version:string app_version
help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool;
help.getInviteText#a4a95186 lang_code:string = help.InviteText;
photos.getUserPhotos#b7ee553c user_id:InputUser offset:int max_id:int limit:int = photos.Photos;
photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos;
messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates;
messages.sendBroadcast#bf73f4da contacts:Vector<InputUser> random_id:Vector<long> message:string media:InputMedia = Updates;
@ -613,6 +624,8 @@ messages.getAllStickers#aa3bc868 hash:string = messages.AllStickers; @@ -613,6 +624,8 @@ messages.getAllStickers#aa3bc868 hash:string = messages.AllStickers;
account.updateDeviceLocked#38df3532 period:int = Bool;
auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization;
messages.getWebPagePreview#25223e24 message:string = MessageMedia;
account.getAuthorizations#e320c158 = account.Authorizations;
@ -631,5 +644,6 @@ messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; @@ -631,5 +644,6 @@ messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite;
messages.checkChatInvite#3eadb1bb hash:string = ChatInvite;
messages.importChatInvite#6c50051c hash:string = Updates;
messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;
messages.installStickerSet#efbbfae9 stickerset:InputStickerSet = Bool;
messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool;
messages.installStickerSet#7b30c3a6 stickerset:InputStickerSet disabled:Bool = Bool;
messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool;
messages.startBot#1b3e0ffc bot:InputUser chat_id:int random_id:long start_param:string = Updates;

17
app/js/lib/utils.js

@ -463,18 +463,30 @@ function versionCompare (ver1, ver2) { @@ -463,18 +463,30 @@ function versionCompare (ver1, ver2) {
image.onerror = function () {
nativeWebpSupport = false;
};
image.src = 'data:image/webp;base64,UklGRjIAAABXRUJQVlA4ICYAAACyAgCdASoCAAEALmk0mk0iIiIiIgBoSygABc6zbAAA/v56QAAAAA==';
// image.src = 'data:image/webp;base64,UklGRjIAAABXRUJQVlA4ICYAAACyAgCdASoCAAEALmk0mk0iIiIiIgBoSygABc6zbAAA/v56QAAAAA==';
var canvas, context;
function convertBinaryToArray (a) {
var b = new Array();
var c = a.length;
for (i = 0; i < c; ++i) b.push(a.charCodeAt(i));
return b
}
function getPngUrlFromData(data) {
console.log(data);
data = convertBinaryToArray(data);
var start = tsNow();
var decoder = new WebPDecoder();
var config = decoder.WebPDecoderConfig;
var buffer = config.j;
var buffer = config.output;
// var buffer = config.j;
var bitstream = config.input;
if (!decoder.WebPInitDecoderConfig(config)) {
@ -490,6 +502,7 @@ function versionCompare (ver1, ver2) { @@ -490,6 +502,7 @@ function versionCompare (ver1, ver2) {
}
var mode = decoder.WEBP_CSP_MODE;
buffer.colorspace = mode.MODE_RGBA;
buffer.J = 4;
try {

136
app/js/services.js

@ -127,6 +127,16 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -127,6 +127,16 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
apiUser.sortName = SearchIndexManager.cleanSearchText(apiUser.first_name + ' ' + (apiUser.last_name || ''));
apiUser.pFlags = {
self: (apiUser.flags & (1 << 10)) > 0,
contact: (apiUser.flags & (1 << 11)) > 0,
mutual: (apiUser.flags & (1 << 12)) > 0,
deleted: (apiUser.flags & (1 << 13)) > 0,
bot: (apiUser.flags & (1 << 14)) > 0,
botNoPrivacy: (apiUser.flags & (1 << 15)) > 0,
botNoGroups: (apiUser.flags & (1 << 16)) > 0
};
var nameWords = apiUser.sortName.split(' ');
var firstWord = nameWords.shift();
var lastWord = nameWords.pop();
@ -160,8 +170,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -160,8 +170,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
return tsNow(true) + serverTimeOffset - 86400 * 3;
case 'userStatusLastWeek':
return tsNow(true) + serverTimeOffset - 86400 * 7;
case 'userStatusLastMonth':
return tsNow(true) + serverTimeOffset - 86400 * 30;
case 'userStatusLastMonth':
return tsNow(true) + serverTimeOffset - 86400 * 30;
}
}
@ -210,11 +220,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -210,11 +220,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
function getUserInput (id) {
var user = getUser(id);
if (user._ == 'userSelf') {
if (user.pFlags.self) {
return {_: 'inputUserSelf'};
}
return {
_: 'inputUserForeign',
_: 'inputUser',
user_id: id,
access_hash: user.access_hash || 0
};
@ -332,7 +342,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -332,7 +342,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
function deleteContacts (userIDs) {
var ids = []
angular.forEach(userIDs, function (userID) {
ids.push({_: 'inputUserContact', user_id: userID})
ids.push(getUserInput(userID))
});
return MtpApiManager.invokeApi('contacts.deleteContacts', {
id: ids
@ -750,13 +760,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -750,13 +760,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
peerParams = peerString.substr(1).split('_');
return isUser
? {_: 'inputPeerForeign', user_id: peerParams[0], access_hash: peerParams[1]}
? {_: 'inputPeerUser', user_id: peerParams[0], access_hash: peerParams[1]}
: {_: 'inputPeerChat', chat_id: peerParams[0]};
},
getInputPeerByID: function (peerID) {
if (peerID > 0) {
return {
_: 'inputPeerForeign',
_: 'inputPeerUser',
user_id: peerID,
access_hash: AppUsersManager.getUser(peerID).access_hash || 0
};
@ -3337,8 +3347,12 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -3337,8 +3347,12 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
case 'documentAttributeFilename':
apiDoc.file_name = attribute.file_name;
break;
case 'documentAttributeVideo':
case 'documentAttributeAudio':
apiDoc.duration = attribute.duration;
apiDoc.audioTitle = attribute.title;
apiDoc.audioPerformer = attribute.performer;
break;
case 'documentAttributeVideo':
apiDoc.duration = attribute.duration;
break;
case 'documentAttributeSticker':
@ -3677,38 +3691,33 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -3677,38 +3691,33 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
function processRawStickers(stickers) {
if (applied !== stickers.hash) {
applied = stickers.hash;
var i, j, len1, len2, doc, setID, set;
var i, j, len1, len2, doc, set, setItems, fullSet;
len1 = stickers.documents.length;
currentStickersets = [];
currentStickers = [];
stickersetItems = {};
len1 = stickers.sets.length;
for (i = 0; i < len1; i++) {
doc = stickers.documents[i];
AppDocsManager.saveDoc(doc);
currentStickers.push(doc.id);
setID = doc.stickerSetID || 0;
if (stickersetItems[setID] === undefined) {
stickersetItems[setID] = [];
set = stickers.sets[i];
fullSet = stickers.fullSets[set.id];
len2 = fullSet.documents.length;
setItems = [];
for (j = 0; j < len2; j++) {
doc = fullSet.documents[j];
AppDocsManager.saveDoc(doc);
currentStickers.push(doc.id);
setItems.push(doc.id);
}
stickersetItems[setID].push(doc.id);
}
currentStickersets = [];
if (stickersetItems[0] !== undefined) {
currentStickersets.push({
_: 'stickerSetDefault',
id: 0,
docIDs: stickersetItems[0]
id: set.id,
title: set.title,
short_name: set.short_name,
installed: (set.flags & (1 << 0)) > 0,
disabled: (set.flags & (1 << 1)) > 0,
official: (set.flags & (1 << 2)) > 0,
docIDs: setItems
});
}
len1 = stickers.sets.length;
for (i = 0; i < len1; i++) {
set = stickers.sets[i];
installedStickersets[set.id] = true;
set.docIDs = stickersetItems[set.id] || [];
currentStickersets.push(set);
}
}
return currentStickersets;
@ -3726,19 +3735,52 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -3726,19 +3735,52 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
return MtpApiManager.invokeApi('messages.getAllStickers', {
hash: stickers && stickers.hash || ''
}).then(function (newStickers) {
if (newStickers._ == 'messages.allStickersNotModified') {
var notModified = newStickers._ == 'messages.allStickersNotModified';
if (notModified) {
newStickers = stickers;
}
newStickers.date = tsNow(true) + 3600;
newStickers.layer = layer;
delete newStickers._;
Storage.set({all_stickers: newStickers});
return processRawStickers(newStickers);
if (notModified) {
Storage.set({all_stickers: newStickers});
return processRawStickers(newStickers);
}
return getStickerSets(newStickers).then(function () {
Storage.set({all_stickers: newStickers});
return processRawStickers(newStickers);
});
});
})
}
function getStickerSets (allStickers) {
var promises = [];
var cachedSets = allStickers.fullSets || {};
allStickers.fullSets = {};
angular.forEach(allStickers.sets, function (shortSet) {
var fullSet = cachedSets[shortSet.id];
if (fullSet && fullSet.set.hash == shortSet.hash) {
allStickers.fullSets[shortSet.id] = fullSet;
} else {
var promise = MtpApiManager.invokeApi('messages.getStickerSet', {
stickerset: {
_: 'inputStickerSetID',
id: shortSet.id,
access_hash: shortSet.access_hash
}
}).then(function (fullSet) {
allStickers.fullSets[shortSet.id] = fullSet;
});
promises.push(promise);
}
});
return $q.all(promises);
}
function downloadStickerThumb (docID) {
var doc = AppDocsManager.getDoc(docID);
return MtpApiFileManager.downloadSmallFile(doc.thumb.location).then(function (blob) {
@ -3750,10 +3792,25 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -3750,10 +3792,25 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
return FileManager.getByteArray(blob).then(function (bytes) {
return {
id: doc.id,
src: WebpManager.getPngUrlFromData(bytes)
var deferred = $q.defer();
var freader = new FileReader();
freader.onload = function (evt) {
return {
id: doc.id,
src: WebpManager.getPngUrlFromData(evt.target.result)
};
// WebPDecodeAndDraw(evt.target.result)
};
freader.readAsBinaryString(bytes);
return deferred.promise;
// return {
// id: doc.id,
// src: WebpManager.getPngUrlFromData(bytes)
// };
});
});
}
@ -3788,7 +3845,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -3788,7 +3845,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
access_hash: set.access_hash
};
return MtpApiManager.invokeApi(method, {
stickerset: inputStickerset
stickerset: inputStickerset,
disabled: false
}).then(function (result) {
if (uninstall) {
delete installedStickersets[set.id];

8
app/partials/desktop/user_modal.html

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
<div class="md_modal_title_wrap">
<div class="md_modal_actions_wrap clearfix">
<a class="md_modal_action md_modal_action_close" ng-click="$close()" my-i18n="modal_close"></a>
<a class="md_modal_action" ng-if="user._ == 'userContact'" ng-click="importContact(true)" my-i18n="modal_edit"></a>
<a class="md_modal_action" ng-if="user.pFlags.contact" ng-click="importContact(true)" my-i18n="modal_edit"></a>
</div>
<div class="md_modal_title" my-i18n="user_modal_contact_info"></div>
</div>
@ -62,7 +62,7 @@ @@ -62,7 +62,7 @@
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_link" ng-init="f.showMoreActions = !user.phone.length">
<i class="md_modal_section_icon md_modal_section_icon_more"></i>
<div class="md_modal_section_link_wrap" ng-if="user.phone.length > 0 &amp;&amp; user._ != 'userContact' &amp;&amp; user._ != 'userSelf'">
<div class="md_modal_section_link_wrap" ng-if="user.phone.length > 0 &amp;&amp; !user.pFlags.contact &amp;&amp; !user.pFlags.self">
<a class="md_modal_section_link" ng-click="importContact()" my-i18n="user_modal_add_contact"></a>
</div>
@ -70,12 +70,12 @@ @@ -70,12 +70,12 @@
<a class="md_modal_section_link" ng-click="shareContact()" my-i18n="user_modal_share_contact"></a>
</div>
<div class="md_modal_section_link_wrap" ng-if="f.showMoreActions &amp;&amp; user._ == 'userContact'">
<div class="md_modal_section_link_wrap" ng-if="f.showMoreActions &amp;&amp; user.pFlags.contact">
<a class="md_modal_section_link" ng-click="deleteContact()" my-i18n="user_modal_delete_contact"></a>
</div>
<div class="md_modal_section_link_wrap" ng-if="f.showMoreActions &amp;&amp; user._ != 'userSelf'">
<div class="md_modal_section_link_wrap" ng-if="f.showMoreActions &amp;&amp; !user.pFlags.self">
<a class="md_modal_section_link" ng-click="toggleBlock(!blocked)" ng-switch="blocked">
<my-i18n ng-switch-when="true" msgid="user_modal_unblock_user"></my-i18n>
<my-i18n ng-switch-default msgid="user_modal_block_user"></my-i18n>

6
app/partials/mobile/user_modal.html

@ -11,13 +11,13 @@ @@ -11,13 +11,13 @@
<span class="icon-bar"></span>
</a>
<ul class="dropdown-menu">
<li ng-if="user._ == 'userContact'">
<li ng-if="user.pFlags.contact">
<a ng-click="importContact(true)" my-i18n="user_modal_edit_contact"></a>
</li>
<li ng-if="user._ == 'userContact'">
<li ng-if="user.pFlags.contact">
<a ng-click="deleteContact()" my-i18n="user_modal_delete_contact"></a>
</li>
<li ng-if="user.phone.length > 0 &amp;&amp; user._ != 'userContact' &amp;&amp; user._ != 'userSelf'">
<li ng-if="user.phone.length > 0 &amp;&amp; !user.pFlags.contact &amp;&amp; !user.pFlags.self">
<a ng-click="importContact()" my-i18n="user_modal_add_contact"></a>
</li>
<li>

10321
app/vendor/libwebpjs/libwebp-0.1.13.js vendored

File diff suppressed because one or more lines are too long

2
app/webogram.appcache

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
CACHE MANIFEST
# 61
# 63
NETWORK:
*

Loading…
Cancel
Save