Browse Source

Added stickers emoji to UI

master
Igor Zhukov 10 years ago
parent
commit
b77ac43b76
  1. 2
      app/js/message_composer.js
  2. 20
      app/js/services.js
  3. 6
      app/partials/desktop/dialog.html
  4. 6
      app/partials/mobile/dialog.html

2
app/js/message_composer.js

@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
var emojis = {};
var shortcuts = {};
var spritesheetPositions = {};
var stickers = {};
var index = false;
var popular = 'joy,kissing_heart,heart,heart_eyes,blush,grin,+1,relaxed,pensive,smile,sob,kiss,unamused,flushed,stuck_out_tongue_winking_eye,see_no_evil,wink,smiley,cry,stuck_out_tongue_closed_eyes,scream,rage,smirk,disappointed,sweat_smile,kissing_closed_eyes,speak_no_evil,relieved,grinning,yum,laughing,ok_hand,neutral_face,confused'.split(',');
@ -119,6 +120,7 @@ @@ -119,6 +120,7 @@
emojis: emojis,
shortcuts: shortcuts,
spritesheetPositions: spritesheetPositions,
stickers: stickers,
getPopularEmoji: getPopularEmoji,
pushPopularEmoji: pushPopularEmoji,
indexEmojis: indexEmojis,

20
app/js/services.js

@ -1981,6 +1981,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -1981,6 +1981,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
case 'messageMediaDocument':
if (message.media.document.sticker) {
notificationMessage = _('conversation_media_sticker');
var stickerEmoji = EmojiHelper.stickers[message.media.document.id];
if (stickerEmoji !== undefined) {
notificationMessage = RichTextProcessor.wrapPlainText(stickerEmoji) + ' (' + notificationMessage + ')';
}
} else {
notificationMessage = message.media.document.file_name || _('conversation_media_document_raw');
}
@ -2726,7 +2730,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -2726,7 +2730,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
})
.service('AppDocsManager', function ($sce, $rootScope, $modal, $window, $q, MtpApiFileManager, FileManager) {
.service('AppDocsManager', function ($sce, $rootScope, $modal, $window, $q, RichTextProcessor, MtpApiFileManager, FileManager) {
var docs = {},
docsForHistory = {},
windowW = $(window).width(),
@ -2753,7 +2757,12 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -2753,7 +2757,12 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
apiDoc.duration = attribute.duration;
break;
case 'documentAttributeSticker':
apiDoc.sticker = true;
apiDoc.sticker = 1;
var stickerEmoji = EmojiHelper.stickers[apiDoc.id];
if (stickerEmoji !== undefined) {
apiDoc.sticker = 2;
apiDoc.stickerEmoji = RichTextProcessor.wrapRichText(stickerEmoji, {noLinks: true, noLinebreaks: true});
}
break;
case 'documentAttributeImageSize':
apiDoc.w = attribute.w;
@ -3067,7 +3076,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -3067,7 +3076,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
function getStickerEmoji(docID) {
return stickersToEmoji[docID] || false;
return EmojiHelper.stickers[docID] || false;
}
function processRawStickers(stickers) {
@ -3082,7 +3091,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -3082,7 +3091,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
var pack, emoticon, docID;
var doneDocIDs = {};
stickersToEmoji = {};
currentStickers = [];
len1 = stickers.packs.length;
for (i = 0; i < len1; i++) {
@ -3091,8 +3099,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -3091,8 +3099,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
len2 = pack.documents.length;
for (j = 0; j < len2; j++) {
docID = pack.documents[j];
if (stickersToEmoji[docID] === undefined) {
stickersToEmoji[docID] = emoticon;
if (EmojiHelper.stickers[docID] === undefined) {
EmojiHelper.stickers[docID] = emoticon;
}
if (doneDocIDs[docID] === undefined) {
doneDocIDs[docID] = true;

6
app/partials/desktop/dialog.html

@ -45,7 +45,11 @@ @@ -45,7 +45,11 @@
<span ng-switch-when="messageMediaPhoto" my-i18n="conversation_media_photo"></span>
<span ng-switch-when="messageMediaVideo" my-i18n="conversation_media_video"></span>
<span ng-switch-when="messageMediaDocument" ng-switch="::dialogMessage.media.document.sticker || false">
<span ng-switch-when="true" my-i18n="conversation_media_sticker"></span>
<span ng-switch-when="1" my-i18n="conversation_media_sticker"></span>
<span ng-switch-when="2">
<span ng-bind-html="dialogMessage.media.document.stickerEmoji"></span>
(<my-i18n msgid="conversation_media_sticker"></my-i18n>)
</span>
<span ng-switch-default ng-bind="dialogMessage.media.document.file_name"></span>
</span>
<span ng-switch-when="messageMediaAudio" my-i18n="conversation_media_audio"></span>

6
app/partials/mobile/dialog.html

@ -52,7 +52,11 @@ @@ -52,7 +52,11 @@
<span ng-switch-when="messageMediaPhoto" my-i18n="conversation_media_photo"></span>
<span ng-switch-when="messageMediaVideo" my-i18n="conversation_media_video"></span>
<span ng-switch-when="messageMediaDocument" ng-switch="::dialogMessage.media.document.sticker || false">
<span ng-switch-when="true" my-i18n="conversation_media_sticker"></span>
<span ng-switch-when="1" my-i18n="conversation_media_sticker"></span>
<span ng-switch-when="2">
<span ng-bind-html="dialogMessage.media.document.stickerEmoji"></span>
(<my-i18n msgid="conversation_media_sticker"></my-i18n>)
</span>
<span ng-switch-default ng-bind="dialogMessage.media.document.file_name"></span>
</span>
<span ng-switch-when="messageMediaAudio" my-i18n="conversation_media_audio"></span>

Loading…
Cancel
Save