Open stickerset on click

Closes #820
This commit is contained in:
Igor Zhukov 2015-07-09 12:09:44 +03:00
parent 47e4124cb0
commit 2a28adb6e5
6 changed files with 32 additions and 10 deletions

View File

@ -1415,6 +1415,10 @@ angular.module('myApp.controllers', ['myApp.i18n'])
target.getAttribute('ng-click')) { target.getAttribute('ng-click')) {
return false; return false;
} }
var events = $._data(target, 'events');
if (events && (events.click || events.mousedown)) {
return false;
}
target = target.parentNode; target = target.parentNode;
} }
} }

View File

@ -1898,7 +1898,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'; var emptySrc = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
@ -1969,6 +1969,14 @@ angular.module('myApp.directives', ['myApp.filters'])
console.log('Download sticker failed', e, fullLocation); console.log('Download sticker failed', e, fullLocation);
}); });
} }
if (attrs.open && $scope.document.stickerSetInput) {
element
.addClass('clickable')
.on('click', function () {
AppStickersManager.openStickerset($scope.document.stickerSetInput);
});
}
} }
}) })

View File

@ -3707,9 +3707,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
apiDoc.stickerEmojiRaw = attribute.alt; apiDoc.stickerEmojiRaw = attribute.alt;
apiDoc.stickerEmoji = RichTextProcessor.wrapRichText(apiDoc.stickerEmojiRaw, {noLinks: true, noLinebreaks: true}); apiDoc.stickerEmoji = RichTextProcessor.wrapRichText(apiDoc.stickerEmojiRaw, {noLinks: true, noLinebreaks: true});
} }
if (attribute.stickerset && if (attribute.stickerset) {
attribute.stickerset._ == 'inputStickerSetID') { if (attribute.stickerset._ == 'inputStickerSetEmpty') {
apiDoc.stickerSetID = attribute.stickerset.id; delete attribute.stickerset;
}
else if (attribute.stickerset._ == 'inputStickerSetID') {
apiDoc.stickerSetInput = attribute.stickerset;
}
} }
break; break;
case 'documentAttributeImageSize': case 'documentAttributeImageSize':
@ -4017,6 +4021,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
return { return {
start: start, start: start,
openStickersetLink: openStickersetLink, openStickersetLink: openStickersetLink,
openStickerset: openStickerset,
installStickerset: installStickerset, installStickerset: installStickerset,
getStickers: getStickers, getStickers: getStickers,
getStickerset: getStickerset, getStickerset: getStickerset,
@ -4178,11 +4183,15 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
} }
function openStickersetLink (shortName) { function openStickersetLink (shortName) {
var scope = $rootScope.$new(true); return openStickerset({
scope.inputStickerset = {
_: 'inputStickerSetShortName', _: 'inputStickerSetShortName',
short_name: shortName short_name: shortName
}; });
}
function openStickerset (inputStickerset) {
var scope = $rootScope.$new(true);
scope.inputStickerset = inputStickerset;
var modal = $modal.open({ var modal = $modal.open({
templateUrl: templateUrl('stickerset_modal'), templateUrl: templateUrl('stickerset_modal'),
controller: 'StickersetModalController', controller: 'StickersetModalController',

View File

@ -1660,7 +1660,8 @@ div.im_message_video_thumb {
} }
.im_history_select_active { .im_history_select_active {
a { a,
.clickable {
pointer-events: none; pointer-events: none;
} }
} }

View File

@ -2,7 +2,7 @@
<div ng-switch-when="gif" my-load-gif document="document"></div> <div ng-switch-when="gif" my-load-gif document="document"></div>
<div ng-switch-when="sticker" my-load-sticker document="document"></div> <div ng-switch-when="sticker" my-load-sticker document="document" open="true"></div>
<div ng-switch-when="audio" class="im_message_audio"> <div ng-switch-when="audio" class="im_message_audio">
<div my-audio-player audio="document"></div> <div my-audio-player audio="document"></div>

View File

@ -2,7 +2,7 @@
<div ng-switch-when="gif" my-load-gif document="document"></div> <div ng-switch-when="gif" my-load-gif document="document"></div>
<div ng-switch-when="sticker" my-load-sticker document="document"></div> <div ng-switch-when="sticker" my-load-sticker document="document" open="true"></div>
<div ng-switch-when="audio" class="im_message_audio"> <div ng-switch-when="audio" class="im_message_audio">
<div my-audio-player audio="document"></div> <div my-audio-player audio="document"></div>