Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Android Place Photos Support #154

Open
wants to merge 12 commits into
base: place-photos
Choose a base branch
from

Commits on Jun 29, 2018

  1. Remove unused react import

    thomasw committed Jun 29, 2018
    Configuration menu
    Copy the full SHA
    d3192a8 View commit details
    Browse the repository at this point in the history
  2. index.js: Add missing EOF newline

    Files should always end with new lines to avoid introducing extraneous diffs.
    thomasw committed Jun 29, 2018
    Configuration menu
    Copy the full SHA
    258194c View commit details
    Browse the repository at this point in the history
  3. Android: Add getPlacePhoto and getPlacePhotos

    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)
    ```
    thomasw committed Jun 29, 2018
    Configuration menu
    Copy the full SHA
    e030a82 View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2018

  1. getPlacePhoto: write image to cache directory

    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.
    thomasw committed Jul 1, 2018
    Configuration menu
    Copy the full SHA
    2f03075 View commit details
    Browse the repository at this point in the history
  2. getURIForBitmap: return a URI instead of String

    This makes the return type consistent with the method's current naming.
    thomasw committed Jul 1, 2018
    Configuration menu
    Copy the full SHA
    7f6a8ef View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2018

  1. getUriForBitmap: correct invalid return type

    File.toURI returns a URI, not a Uri.
    thomasw committed Jul 2, 2018
    Configuration menu
    Copy the full SHA
    d0c5aa1 View commit details
    Browse the repository at this point in the history

Commits on Jul 6, 2018

  1. Make use of ResultCallbacks and ResultTransform

    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.
    thomasw committed Jul 6, 2018
    Configuration menu
    Copy the full SHA
    4cc2e39 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a255a49 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6724345 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a87467c View commit details
    Browse the repository at this point in the history
  5. getScaledPhoto: Call .release() on buffer

    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.
    thomasw committed Jul 6, 2018
    Configuration menu
    Copy the full SHA
    a6c6954 View commit details
    Browse the repository at this point in the history
  6. Add getPlacePhotos support

    thomasw committed Jul 6, 2018
    Configuration menu
    Copy the full SHA
    669cf38 View commit details
    Browse the repository at this point in the history