|
|
@ -2284,7 +2284,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
case 'messageMediaDocument': |
|
|
|
case 'messageMediaDocument': |
|
|
|
if (message.media.document.sticker) { |
|
|
|
if (message.media.document.sticker) { |
|
|
|
notificationMessage = _('conversation_media_sticker'); |
|
|
|
notificationMessage = _('conversation_media_sticker'); |
|
|
|
var stickerEmoji = EmojiHelper.stickers[message.media.document.id]; |
|
|
|
var stickerEmoji = message.media.document.stickerEmojiRaw; |
|
|
|
if (stickerEmoji !== undefined) { |
|
|
|
if (stickerEmoji !== undefined) { |
|
|
|
notificationMessage = RichTextProcessor.wrapPlainText(stickerEmoji) + ' (' + notificationMessage + ')'; |
|
|
|
notificationMessage = RichTextProcessor.wrapPlainText(stickerEmoji) + ' (' + notificationMessage + ')'; |
|
|
|
} |
|
|
|
} |
|
|
@ -3343,10 +3343,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'documentAttributeSticker': |
|
|
|
case 'documentAttributeSticker': |
|
|
|
apiDoc.sticker = 1; |
|
|
|
apiDoc.sticker = 1; |
|
|
|
var stickerEmoji = attribute.alt || EmojiHelper.stickers[apiDoc.id]; |
|
|
|
if (attribute.alt !== undefined) { |
|
|
|
if (stickerEmoji !== undefined) { |
|
|
|
|
|
|
|
apiDoc.sticker = 2; |
|
|
|
apiDoc.sticker = 2; |
|
|
|
apiDoc.stickerEmoji = RichTextProcessor.wrapRichText(stickerEmoji, {noLinks: true, noLinebreaks: true}); |
|
|
|
apiDoc.stickerEmojiRaw = attribute.alt; |
|
|
|
|
|
|
|
apiDoc.stickerEmoji = RichTextProcessor.wrapRichText(apiDoc.stickerEmojiRaw, {noLinks: true, noLinebreaks: true}); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'documentAttributeImageSize': |
|
|
|
case 'documentAttributeImageSize': |
|
|
@ -3640,17 +3640,18 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.service('AppStickersManager', function ($q, FileManager, MtpApiManager, MtpApiFileManager, AppDocsManager, Storage) { |
|
|
|
.service('AppStickersManager', function ($q, $rootScope, $modal, FileManager, MtpApiManager, MtpApiFileManager, AppDocsManager, Storage) { |
|
|
|
|
|
|
|
|
|
|
|
var stickersToEmoji = {}; |
|
|
|
|
|
|
|
var currentStickers = []; |
|
|
|
var currentStickers = []; |
|
|
|
|
|
|
|
var installedStickersets = {}; |
|
|
|
var applied = false; |
|
|
|
var applied = false; |
|
|
|
var started = false; |
|
|
|
var started = false; |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
start: start, |
|
|
|
start: start, |
|
|
|
getStickerEmoji: getStickerEmoji, |
|
|
|
openStickersetLink: openStickersetLink, |
|
|
|
getStickers: getStickers, |
|
|
|
getStickers: getStickers, |
|
|
|
|
|
|
|
getStickerset: getStickerset, |
|
|
|
getStickersImages: getStickersImages |
|
|
|
getStickersImages: getStickersImages |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -3666,38 +3667,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
getStickers().then(getStickersImages); |
|
|
|
getStickers().then(getStickersImages); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getStickerEmoji(docID) { |
|
|
|
|
|
|
|
return EmojiHelper.stickers[docID] || false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function processRawStickers(stickers) { |
|
|
|
function processRawStickers(stickers) { |
|
|
|
if (applied !== stickers.hash) { |
|
|
|
if (applied !== stickers.hash) { |
|
|
|
applied = stickers.hash; |
|
|
|
applied = stickers.hash; |
|
|
|
var i, j, len1, len2; |
|
|
|
var i, j, len1, len2, doc; |
|
|
|
|
|
|
|
|
|
|
|
len1 = stickers.documents.length; |
|
|
|
len1 = stickers.documents.length; |
|
|
|
for (i = 0; i < len1; i++) { |
|
|
|
|
|
|
|
AppDocsManager.saveDoc(stickers.documents[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var pack, emoticon, docID; |
|
|
|
|
|
|
|
var doneDocIDs = {}; |
|
|
|
|
|
|
|
currentStickers = []; |
|
|
|
currentStickers = []; |
|
|
|
len1 = stickers.packs.length; |
|
|
|
|
|
|
|
for (i = 0; i < len1; i++) { |
|
|
|
for (i = 0; i < len1; i++) { |
|
|
|
pack = stickers.packs[i]; |
|
|
|
doc = stickers.documents[i]; |
|
|
|
emoticon = pack.emoticon; |
|
|
|
AppDocsManager.saveDoc(doc); |
|
|
|
len2 = pack.documents.length; |
|
|
|
currentStickers.push(doc.id); |
|
|
|
for (j = 0; j < len2; j++) { |
|
|
|
|
|
|
|
docID = pack.documents[j]; |
|
|
|
|
|
|
|
if (EmojiHelper.stickers[docID] === undefined) { |
|
|
|
|
|
|
|
EmojiHelper.stickers[docID] = emoticon; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (doneDocIDs[docID] === undefined) { |
|
|
|
|
|
|
|
doneDocIDs[docID] = true; |
|
|
|
|
|
|
|
currentStickers.push(docID); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return currentStickers; |
|
|
|
return currentStickers; |
|
|
@ -3728,29 +3708,57 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getStickersImages () { |
|
|
|
function downloadStickerThumb (docID) { |
|
|
|
var promises = []; |
|
|
|
|
|
|
|
angular.forEach(currentStickers, function (docID) { |
|
|
|
|
|
|
|
var doc = AppDocsManager.getDoc(docID); |
|
|
|
var doc = AppDocsManager.getDoc(docID); |
|
|
|
var promise = MtpApiFileManager.downloadSmallFile(doc.thumb.location).then(function (blob) { |
|
|
|
return MtpApiFileManager.downloadSmallFile(doc.thumb.location).then(function (blob) { |
|
|
|
if (WebpManager.isWebpSupported()) { |
|
|
|
if (WebpManager.isWebpSupported()) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
id: docID, |
|
|
|
id: doc.id, |
|
|
|
src: FileManager.getUrl(blob, 'image/webp') |
|
|
|
src: FileManager.getUrl(blob, 'image/webp') |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return FileManager.getByteArray(blob).then(function (bytes) { |
|
|
|
return FileManager.getByteArray(blob).then(function (bytes) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
id: docID, |
|
|
|
id: doc.id, |
|
|
|
src: WebpManager.getPngUrlFromData(bytes) |
|
|
|
src: WebpManager.getPngUrlFromData(bytes) |
|
|
|
}; |
|
|
|
}; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
promises.push(promise); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getStickersImages () { |
|
|
|
|
|
|
|
var promises = []; |
|
|
|
|
|
|
|
angular.forEach(currentStickers, function (docID) { |
|
|
|
|
|
|
|
promises.push(downloadStickerThumb (docID)); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return $q.all(promises); |
|
|
|
return $q.all(promises); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getStickerset (inputStickerset) { |
|
|
|
|
|
|
|
return MtpApiManager.invokeApi('messages.getStickerSet', { |
|
|
|
|
|
|
|
stickerset: inputStickerset |
|
|
|
|
|
|
|
}).then(function (result) { |
|
|
|
|
|
|
|
for (var i = 0; i < result.documents.length; i++) { |
|
|
|
|
|
|
|
AppDocsManager.saveDoc(result.documents[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function openStickersetLink (shortName) { |
|
|
|
|
|
|
|
var scope = $rootScope.$new(true); |
|
|
|
|
|
|
|
scope.inputStickerset = { |
|
|
|
|
|
|
|
_: 'inputStickerSetShortName', |
|
|
|
|
|
|
|
short_name: shortName |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
var modal = $modal.open({ |
|
|
|
|
|
|
|
templateUrl: templateUrl('stickerset_modal'), |
|
|
|
|
|
|
|
controller: 'StickersetModalController', |
|
|
|
|
|
|
|
scope: scope/*, |
|
|
|
|
|
|
|
windowClass: 'error_modal_window'*/ |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.service('ApiUpdatesManager', function ($rootScope, MtpNetworkerFactory, AppUsersManager, AppChatsManager, AppPeersManager, MtpApiManager) { |
|
|
|
.service('ApiUpdatesManager', function ($rootScope, MtpNetworkerFactory, AppUsersManager, AppChatsManager, AppPeersManager, MtpApiManager) { |
|
|
@ -4278,6 +4286,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
case 'joinchat': |
|
|
|
case 'joinchat': |
|
|
|
url = 'tg://join?invite=' + path[1]; |
|
|
|
url = 'tg://join?invite=' + path[1]; |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case 'addstickers': |
|
|
|
|
|
|
|
url = 'tg://addstickers?set=' + path[1]; |
|
|
|
|
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
url = 'tg://resolve?domain=' + path[0]; |
|
|
|
url = 'tg://resolve?domain=' + path[0]; |
|
|
|
} |
|
|
|
} |
|
|
@ -5361,7 +5372,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.service('LocationParamsService', function ($rootScope, $routeParams, AppUsersManager, AppMessagesManager) { |
|
|
|
.service('LocationParamsService', function ($rootScope, $routeParams, AppUsersManager, AppMessagesManager, AppStickersManager) { |
|
|
|
|
|
|
|
|
|
|
|
var tgAddrRegEx = /^(web\+)?tg:(\/\/)?(.+)/; |
|
|
|
var tgAddrRegEx = /^(web\+)?tg:(\/\/)?(.+)/; |
|
|
|
|
|
|
|
|
|
|
@ -5391,6 +5402,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (matches = url.match(/^addstickers\?set=(.+)$/)) { |
|
|
|
|
|
|
|
AppStickersManager.openStickersetLink(matches[1]); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|