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

Support filter media items between dates #140

Merged
merged 10 commits into from
Feb 5, 2020
Merged

Support filter media items between dates #140

merged 10 commits into from
Feb 5, 2020

Conversation

r0b0t3d
Copy link
Contributor

@r0b0t3d r0b0t3d commented Feb 5, 2020

Summary

This PR is a replacement of #120 that I closed accidentally. So I am going to copy the description below.

Add fromTime and toTime to getPhotos to get media items in between

Test Plan

Manual test on my device

What's required for testing (prerequisites)?

What are the steps to reproduce (after prerequisites)?

Compatibility

OS Implemented
iOS
Android

Checklist

  • I have tested this on a device and a simulator
  • I added the documentation in README.md
  • I mentioned this change in CHANGELOG.md
  • I updated the typed files (TS and Flow)
  • I added a sample use of the API in the example project (example/App.js)

@bartolkaruza bartolkaruza merged commit 75b4208 into react-native-cameraroll:master Feb 5, 2020
@bartolkaruza
Copy link
Collaborator

looks good, thanks!

bartolkaruza pushed a commit that referenced this pull request Feb 5, 2020
# [1.4.0](v1.3.1...v1.4.0) (2020-02-05)

### Bug Fixes

* Making Promise return types consistent across iOS and Android, updating types to match. ([#137](#137)) ([b49dc8e](b49dc8e))

### Features

* Support filter media items between dates ([#140](#140)) ([75b4208](75b4208))
@bartolkaruza
Copy link
Collaborator

🎉 This PR is included in version 1.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@imranmirza-nxb
Copy link

imranmirza-nxb commented Mar 16, 2020

@bartolkaruza I'm using 1.4.1 also tried 1.4.0, Without time filter system fetch all the photos from the camerarole that I have added few minutes/hours back, but unable to get any photo if I add 'fromTime' and 'toTime'.

Can you please confirm if this issue is fixed in this PR?
Following is my example code:

CameraRoll.getPhotos({ first: 20, assetType: 'Photos', fromTime: 1584356434595, //5 hours back toTime: moment().valueOf(), })

@r0b0t3d
Copy link
Contributor Author

r0b0t3d commented Mar 17, 2020

@imranmirza-nxb I tried your code above, works well for me on both android and ios

CameraRoll.getPhotos({
  first: 20,
  assetType: 'Photos',
  fromTime: 1584356434595, //5 hours back
  toTime: moment().valueOf(),
})

@imranmirza-nxb
Copy link

@r0b0t3d in my case getPhotos without time filter returns me 'timestamp = 0' not sure why, this might be an issue, is there anything required to save timestamp while storing in camerarole ?

const data = await this.camera.takePictureAsync({quality: 0.5, base64: true}); CameraRoll.saveToCameraRoll(data.uri)

{"node": {"group_name": "Pictures", "image": [Object], "timestamp": 0, "type": "image/jpeg"}}

@r0b0t3d
Copy link
Contributor Author

r0b0t3d commented Mar 17, 2020

I haven't got the problem with timestamp while saving so far. Did it happen on ios/android or both?
If you find that this is really a bug, you could open another issue to keep track.

@imranmirza-nxb
Copy link

Thanks for quick response. I'm testing so far over Android Simulator.

My getPhotos returns me following object with timestamp=0:
{"node": {"group_name": "Pictures", "image": [Object], "timestamp": 0, "type": "image/jpeg"}}.

Can you please confirm two things for your case:

  1. While saveToCameraRoll you didn't give explicitly any timestamp param and system save photo automatically with some creation time.
  2. Your getPhotos returned e.edges object contains some value in the "timestamp" and its not "0" as in my case its 0?

@r0b0t3d
Copy link
Contributor Author

r0b0t3d commented Mar 17, 2020

@imranmirza-nxb just tried with emulator (android 10), got the same problem as yours. It seems something went wrong with emulator or android 10 (not sure about it).
You can try with real device to see whether it works or not.

@imranmirza-nxb
Copy link

Yes, On real device this is working fine, the module has issue with emulator only.
Thank you for your cooperation @r0b0t3d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants