olofd / react-native-photos-framework

A modern and comprehensive CameraRoll/iCloud-library-API for React Native 📸 📹
MIT License
220 stars 99 forks source link

Features missing? Interesting use-cases? #41

Open olofd opened 7 years ago

olofd commented 7 years ago

As we are reaching 1.0 (https://github.com/olofd/react-native-photos-framework/milestone/1). I'm wondering if you, the users of this library, have any input on what we should focus on going forward and if there are any big holes, gaps, in the API that you would like to be implemented?

Feel free to ask questions and propose new ideas in this thread.

iamgbsmith commented 7 years ago

Thanks for the great library. Is it possible to add a feature to allow the sort order for album images (either ascending or descending) when pre-fetching images in albums using the previewAssets property?

olofd commented 7 years ago

@iamgbsmith I actually think you already can do that. Have you tried adding a assetFetchOptions to your getAlbums query?

Search for this text : Fetch options used when loading assets from album returned. You can choose to pass these fetchOptions here to affect previewAssetsin the README.md and you'll find docs about it.

Let me know if there is something here that does not work, or if there is anything else needed regarding this. Or if you need help applying it.

Haven't tried it, but his should work:

                RNPhotosFramework.getAlbums({
                    assetFetchOptions: {
                        sortDescriptors: [
                            {
                                key: 'creationDate',
                                ascending: true
                            }
                        ]
                    }
                }).then..
DylanVann commented 7 years ago

I have a somewhat "interesting" use case. I'm making a photo picker where photos are grouped by days and the user needs to be able to select all photos in a day. So ideally I'd like to be able to query by day / between a start and end time. Most of the time if the user has a reasonable amount of photos per day this isn't an issue because I'd already have loaded them when the user clicks select all. Sort of an edge case.

justinsherwood commented 7 years ago

Is it possible to load certain albums on the device if they exist like Instagram or Snapchat? If not, I think it would be useful to select these albums if they exist on the users device.

olofd commented 7 years ago

@justinsherwood I do not really follow what you mean? Expand please.

justinsherwood commented 7 years ago

I'm currently using the getAlbumsMany method to return a list of albums by passing an array containing smartAlbumUserLibrary, smartAlbumFavorites, smartAlbumSelfPortraits, etc. I think it would be nice to also query custom albums created by the user that are not "system specific" albums if they exist. An example of this would be including the Instagram or Snapchat albums on a users device.

For example, including specific "My Albums" albums

image1

olofd commented 7 years ago

@justinsherwood They should already be included if you just:

                RNPhotosFramework.getAlbums().then...

Does that not work?

You could also use:

        return RNPhotosFramework.getAlbumsCommon({
            trackInsertsAndDeletes: true,
            trackChanges: true,
            assetCount: 'exact',
            includeMetaData: false,
            previewAssets: 2
        }, true).then((queryResult) => {
            return queryResult.instagramAppAlbumSort();
        });

If you like the albums in the exact order the instagram app shows them. You can also use: queryResult.photoAppAlbumSort() if you want the same order as apple's photos app.

You should not have to use getAlbumsMany. And by passing that array with smartAlbum-values you´re actively excluding user created albums. That's why you do not get them in your result.

justinsherwood commented 7 years ago

I understand that, but the issue is deciding which specific system albums to include, as well as specific user albums. I do not want to include all user created albums, only specific ones like albums titled Instagram or Snapchat. Basically, I want to be able to choose which user albums to include in my query if they exist in addition to the specific smartAlbums I am interested in displaying.

For example, when I run the code you mentioned I receive 100's of user created albums that I am not interested in displaying to users. (albums with specific dates, etc)

The mean reason I think this feature would be useful is to limit the number of displayed custom user created albums to increase performance and to avoid loading 100's of random albums.

zweck commented 7 years ago

I'm struggling at the moment to find a simple / elegant way of sharing a photo fetched with RNPhotosFramework. At the moment I'm trying to write an ObjC lib to return me a base64 version of the image from the photos:// uri; but if that feature was in this library it would be lovely.

justinsherwood commented 7 years ago

Does this library work with Android as well? I tried including it in an android project, but get the error: Could not find react-native-photos-framework's native module.

arberkryeziu commented 7 years ago

Thank you for the great library!

  1. One interesting case would be to return a boolean, if the asset is currently stored on the device or in the cloud! The native Photos app let users know which assets are stored in the cloud by showing a cloud icon mark over the asset.

  2. Another issue that I have (somewhat related to 1. ) is that, when assets are returned e.g. by calling getAssets(), all the assets which are not stored on the device, are being downloaded from the cloud. It would be nice to have some thumbnails for each asset, and a triggering function for the asset to be downloaded from the cloud, as soon as the user clicks on that specific asset.

monolithed commented 6 years ago

+1 for moving a photo to another album