-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[media-library] Allow to get assets created in specified time range #5166
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
Conversation
@@ -93,6 +95,11 @@ export type PagedInfo<T> = { | |||
totalCount: number; | |||
}; | |||
|
|||
export type PermissionsResult = { | |||
status: 'granted' | 'denied' | 'undetermined'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe extract that to some Enum and export
as well. That would allow users to use library provided const and not if (someResult === 'granted
)` 🤔 ❓
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing this!
@@ -76,6 +77,26 @@ - (NSDictionary *)constantsToExport | |||
return @[EXMediaLibraryDidChangeEvent]; | |||
} | |||
|
|||
UM_EXPORT_METHOD_AS(requestPermissionsAsync, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this some forward-looking solution where in the future we will deprecate asking for permissions via expo-permissions
? Is making this change in a random module fit in a bigger scope? (i. e. wouldn't we like to copy-and-deprecate all the methods in one PR rather than in multiple random PRs)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moreover, maybe the redirection could happen on JS level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this some forward-looking solution where in the future we will deprecate asking for permissions via expo-permissions?
Yes, this is also already implemented in other modules like Location and Calendar which provide its own methods requesting for permissions. This is in the scope of #5061 but I think it doesn't bother to implement it earlier. I already discussed it with @lukmccall who is working on the new permissions. The code of these methods will probably be changed by his PR anyway, but the signature shouldn't change.
Moreover, maybe the redirection could happen on JS level?
I don't really want to add expo-permissions
as a dependency of expo-media-library
, even though expo-permissions
are installed by react-native-unimodules
, I guess we planned to not have such deps between unimodules.
Why
There are some use cases where we want to pick media assets from some specific period of time, like during a visit in a food place. That use case is also used in Gyroscope app where I wanted to make it work more smoothly and get rid of filtering all the assets in JS.
How
Added
createdAfter
andcreatedBefore
options toMediaLibrary.getAssetsAsync
and also addedrequestPermissionsAsync
andgetPermissionsAsync
functions which would also be a part of #5061 but I decided to include them earlier so I don't have to migrate in the future releases 😅Test Plan
Added tests to test-suite + I tested it in Gyroscope app