|
|
@ -1880,6 +1880,31 @@ angular.module('myApp.services', []) |
|
|
|
return photo; |
|
|
|
return photo; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function preloadPhoto (photoID) { |
|
|
|
|
|
|
|
if (!photos[photoID]) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var photo = photos[photoID], |
|
|
|
|
|
|
|
fullWidth = $(window).width() - 36, |
|
|
|
|
|
|
|
fullHeight = $($window).height() - 150, |
|
|
|
|
|
|
|
fullPhotoSize = choosePhotoSize(photo, fullWidth, fullHeight); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (fullPhotoSize && !fullPhotoSize.preloaded) { |
|
|
|
|
|
|
|
fullPhotoSize.preloaded = true; |
|
|
|
|
|
|
|
if (fullPhotoSize.size) { |
|
|
|
|
|
|
|
MtpApiFileManager.downloadFile(fullPhotoSize.location.dc_id, { |
|
|
|
|
|
|
|
_: 'inputFileLocation', |
|
|
|
|
|
|
|
volume_id: fullPhotoSize.location.volume_id, |
|
|
|
|
|
|
|
local_id: fullPhotoSize.location.local_id, |
|
|
|
|
|
|
|
secret: fullPhotoSize.location.secret |
|
|
|
|
|
|
|
}, fullPhotoSize.size); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
MtpApiFileManager.downloadSmallFile(fullPhotoSize.location); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
$rootScope.preloadPhoto = preloadPhoto; |
|
|
|
|
|
|
|
|
|
|
|
function wrapForFull (photoID) { |
|
|
|
function wrapForFull (photoID) { |
|
|
|
var photo = wrapForHistory(photoID), |
|
|
|
var photo = wrapForHistory(photoID), |
|
|
|
fullWidth = $(window).width() - 36, |
|
|
|
fullWidth = $(window).width() - 36, |
|
|
@ -1940,6 +1965,7 @@ angular.module('myApp.services', []) |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
savePhoto: savePhoto, |
|
|
|
savePhoto: savePhoto, |
|
|
|
|
|
|
|
preloadPhoto: preloadPhoto, |
|
|
|
wrapForHistory: wrapForHistory, |
|
|
|
wrapForHistory: wrapForHistory, |
|
|
|
wrapForFull: wrapForFull, |
|
|
|
wrapForFull: wrapForFull, |
|
|
|
openPhoto: openPhoto |
|
|
|
openPhoto: openPhoto |
|
|
|