Improve gif support
This commit is contained in:
parent
d277a59094
commit
27dcf761ab
@ -1556,7 +1556,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.service('AppWebPagesManager', function ($modal, $sce, $window, $rootScope, MtpApiManager, AppPhotosManager, RichTextProcessor) {
|
.service('AppWebPagesManager', function ($modal, $sce, $window, $rootScope, MtpApiManager, AppPhotosManager, AppDocsManager, RichTextProcessor) {
|
||||||
|
|
||||||
var webpages = {};
|
var webpages = {};
|
||||||
var pendingWebPages = {};
|
var pendingWebPages = {};
|
||||||
@ -1567,6 +1567,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
} else {
|
} else {
|
||||||
delete apiWebPage.photo;
|
delete apiWebPage.photo;
|
||||||
}
|
}
|
||||||
|
if (apiWebPage.document && apiWebPage.document._ === 'document') {
|
||||||
|
AppDocsManager.saveDoc(apiWebPage.document, mediaContext);
|
||||||
|
} else {
|
||||||
|
delete apiWebPage.document;
|
||||||
|
}
|
||||||
|
|
||||||
apiWebPage.rTitle = RichTextProcessor.wrapRichText(
|
apiWebPage.rTitle = RichTextProcessor.wrapRichText(
|
||||||
apiWebPage.title || apiWebPage.author,
|
apiWebPage.title || apiWebPage.author,
|
||||||
@ -1635,6 +1640,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
if (webPage.photo && webPage.photo.id) {
|
if (webPage.photo && webPage.photo.id) {
|
||||||
webPage.photo = AppPhotosManager.wrapForHistory(webPage.photo.id, {website: webPage.type != 'photo' && webPage.type != 'video'});
|
webPage.photo = AppPhotosManager.wrapForHistory(webPage.photo.id, {website: webPage.type != 'photo' && webPage.type != 'video'});
|
||||||
}
|
}
|
||||||
|
if (webPage.document && webPage.document.id) {
|
||||||
|
webPage.document = AppDocsManager.wrapForHistory(webPage.document.id);
|
||||||
|
}
|
||||||
|
|
||||||
return webPage;
|
return webPage;
|
||||||
}
|
}
|
||||||
@ -1967,11 +1975,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
isGif = doc.mime_type == 'image/gif',
|
isGif = doc.mime_type == 'image/gif',
|
||||||
isSticker = doc.mime_type == 'image/webp' && doc.sticker,
|
isSticker = doc.mime_type == 'image/webp' && doc.sticker,
|
||||||
thumbPhotoSize = doc.thumb,
|
thumbPhotoSize = doc.thumb,
|
||||||
width, height;
|
width, height, thumb, dim;
|
||||||
|
|
||||||
if (isGif) {
|
if (isGif) {
|
||||||
width = Math.min(windowW - 80, 260);
|
width = Math.min(windowW - 80, Config.Mobile ? 210 : 260);
|
||||||
height = Math.min(windowH - 100, 260);
|
height = Math.min(windowH - 100, Config.Mobile ? 210 : 260);
|
||||||
}
|
}
|
||||||
else if (isSticker) {
|
else if (isSticker) {
|
||||||
width = Math.min(windowW - 80, Config.Mobile ? 128 : 192);
|
width = Math.min(windowW - 80, Config.Mobile ? 128 : 192);
|
||||||
@ -1980,18 +1988,14 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
width = height = 100;
|
width = height = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
var thumb = {
|
thumb = {
|
||||||
width: width,
|
width: width,
|
||||||
height: height
|
height: height
|
||||||
};
|
};
|
||||||
var dim;
|
|
||||||
|
|
||||||
if (thumbPhotoSize && thumbPhotoSize._ != 'photoSizeEmpty') {
|
if (thumbPhotoSize && thumbPhotoSize._ != 'photoSizeEmpty') {
|
||||||
if (isGif && doc.w && doc.h) {
|
if (isGif && doc.w && doc.h) {
|
||||||
dim = {
|
dim = calcImageInBox(doc.w, doc.h, width, height);
|
||||||
w: doc.w,
|
|
||||||
h: doc.h
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
dim = calcImageInBox(thumbPhotoSize.w, thumbPhotoSize.h, width, height);
|
dim = calcImageInBox(thumbPhotoSize.w, thumbPhotoSize.h, width, height);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,14 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div ng-switch-when="document" class="im_message_webpage_document">
|
||||||
|
<div my-message-document="webpage.document" message-id="messageId"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-switch-when="gif" class="im_message_webpage_gif">
|
||||||
|
<div my-message-document="webpage.document" message-id="messageId"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div ng-switch-default class="im_message_webpage_article">
|
<div ng-switch-default class="im_message_webpage_article">
|
||||||
<a ng-if="webpage.photo" href="{{webpage.url}}" target="_blank" class="im_message_webpage_article_photo pull-right">
|
<a ng-if="webpage.photo" href="{{webpage.url}}" target="_blank" class="im_message_webpage_article_photo pull-right">
|
||||||
<img
|
<img
|
||||||
|
Loading…
x
Reference in New Issue
Block a user