Add Android Place Photos Support#154
Open
thomasw wants to merge 12 commits intotolu360:place-photosfrom
Open
Conversation
Files should always end with new lines to avoid introducing extraneous diffs.
This introduces preliminary support for 1. retrieving photo metadata for a place and 2. persisting the associated photos to disk where they can be accessed via react-native using an `<Image>` tag. Example usage via JS: ```javascript const placePhotos = await RNGooglePlaces.getPlacePhotos(placeId) const firstPhotoUri = await RNGooglePlaces.getPlacePhoto(placePhotos[0]) console.info(firstPhotoUri) ```
Place photos shouldn't be persisted indefinitely. We write them to a cache directory so that the OS knows that it can clean these files up if necessary. This also removes specifying context.MODE_PRIVATE when creating the FileOutputStream, which doesn't seem necessary.
This makes the return type consistent with the method's current naming.
File.toURI returns a URI, not a Uri.
ResultCallbacks (vs ResultCallback) allows us to factor out status checks because we can define specific handlers for success/failure cases. ResultTransform allows us to neatly chain API calls without needing to pass promise references down deeply into multiple methods.
I'd believed that this wasn't required when using .then(...).andFinally(...) pattern, but according to the console warnings this was resulting in, it is indeed required.
|
Any chance of this getting merged? This is great functionality that I'd love to see added! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As discussed in #149 (comment) (with some slight modifications), this adds the following Google Place Photo API wrappers for android: