bug fix for all photos images fetch

This commit is contained in:
Ran Greenberg 2016-06-19 16:08:55 +03:00
parent b5bc6dcab9
commit 65ffe84475
1 changed files with 10 additions and 12 deletions

View File

@ -11,29 +11,28 @@ async function getAlbumsWithThumbnails() {
return albums; return albums;
} }
async function getThumbnailForAlbumName(albumName) { async function getThumbnailForAlbumName(albumName) {
const albumsThumbnail = await CKGallery.getThumbnailForAlbumName(albumName); const albumsThumbnail = await CKGallery.getThumbnailForAlbumName(albumName);
return albumsThumbnail; return albumsThumbnail;
} }
function getPhotosForAlbum(albumName, numberOfPhotos, callback, error) { function getPhotosForAlbum(albumName, numberOfPhotos, callback, error) {
let groupType = (albumName === 'All Photos') ? 'SavedPhotos' : 'All'; let groupType = (albumName.toLowerCase() === 'all photos') ? 'SavedPhotos' : 'All';
//const photoStream = ['Bursts', 'Recently Added', 'Selfies', 'Recently Added', 'Screenshots', 'My Photo Stream'];
//if (_.include(photoStream, albumName)) {
// groupType = 'PhotoStream';
//}
const fetchParams = { const fetchParams = {
first: numberOfPhotos, first: numberOfPhotos,
//groupName: albumName, groupTypes: groupType
groupTypes: groupType,
}; };
if (albumName.toLowerCase() !== 'all photos') {
fetchParams.groupName = albumName;
}
CameraRoll.getPhotos(fetchParams) CameraRoll.getPhotos(fetchParams)
.then((data) => callback(data), (e) => error(e)); .then((data) => callback(data), (e) => error(e));
} }
export default { export default {
@ -41,4 +40,3 @@ export default {
getThumbnailForAlbumName, getThumbnailForAlbumName,
getPhotosForAlbum getPhotosForAlbum
} }