[android][media-library] Fix passing sortBy argument to native (#21363)Fixes https://github.com/expo/expo/issues/21338
[android][expo-media-library] migrate to new modules API (#20232)# Why Migrate native module to use new modules API # How This was a much larger migration than any I have attempted before so I
[android][expo-media-library] migrate to new modules API (#20232)# Why Migrate native module to use new modules API # How This was a much larger migration than any I have attempted before so I will need feedback from the team. Maybe something of this size is not wanted from external contributors. Followed the typical migration steps. Note - One of the functions `getAssetsAsync` accepts an options object. One of the parameters is an array that can be a mixed type. A string or a tuple. I wasn't sure how to type this. The Either type is still marked as experimental so I didn't want to use it. Also, regarding this options type, the `first` variable was used as an`Int` sometimes and a `Double` at other times. I settled on a `Double`. - The module was renamed from `ExponentMediaLibrary` to `ExpoMediaLibrary` - There are cases where I still use `promise.resolve(null)` I'm aware this is not usually necessary but without it, some functions would never resolve - There are some instances where an exception is caught and rejected in the same way it was with the old API. I've got varied feedback on this so I'm not sure which way is preferred - There are cases where functions use things that require a min SDK of 29. In the original code sometimes this was handled and other times it wasn't. Didn't know whether to handle this or leave as it # Test Plan Checked by running the bare expo app and running the existing test suite. After the first iteration, the checks in the bare app all passed but the native unit tests were broken because of the changes in the Pomise API. These were fixed, and now all 43 native tests pass. The JS tests all pass as before.
show more ...
[media-library] Refactor to Kotlin 5 - Utilities (#14566)* Add Kotlin utilities * Kotlinize MediaLibraryUtils * Kotlinize MediaLibraryConstants * Extract default limit to constant * Ext
[media-library] Refactor to Kotlin 5 - Utilities (#14566)* Add Kotlin utilities * Kotlinize MediaLibraryUtils * Kotlinize MediaLibraryConstants * Extract default limit to constant * Extract enums * Lint + small fix * Apply suggestions * Use Pairs, minor improvements
[media-library] Refactor to Kotlin 4 - Asset management (#14565)* Kotlinize `GetAssetInfo` * Kotlinize `DeleteAssets` * Kotlinize `CreateAsset` * Kotlinize `GetAssets` * Kotlinize `GetQ
[media-library] Refactor to Kotlin 4 - Asset management (#14565)* Kotlinize `GetAssetInfo` * Kotlinize `DeleteAssets` * Kotlinize `CreateAsset` * Kotlinize `GetAssets` * Kotlinize `GetQueryInfo` * Extract package, move some utils, fix tests * Move other asset-related utils * Fix tests
[media-library] Refactor to Kotlin 2 - Albums (#14563)* Kotlinize `GetAlbum` * Tests for `GetAlbum` * Kotlinize `DeleteAlbums` * Kotlinize `CreateAlbum` * Kotlinize `AddAssetsToAlbum`
[media-library] Refactor to Kotlin 2 - Albums (#14563)* Kotlinize `GetAlbum` * Tests for `GetAlbum` * Kotlinize `DeleteAlbums` * Kotlinize `CreateAlbum` * Kotlinize `AddAssetsToAlbum` * Kotlinize `RemoveAssetsFromAlbum` * Move code to `albums` package * Apply spotless * Extract album utils, renames * Merge fix
[expo-modules] Move code from `unimodules` into `expo-modules-core` (#13703)# Why Migrated `unimodules-core`, `unimodules-react-native-adapter`, `unimodules-app-loader` into `expo-modules-core`
[expo-modules] Move code from `unimodules` into `expo-modules-core` (#13703)# Why Migrated `unimodules-core`, `unimodules-react-native-adapter`, `unimodules-app-loader` into `expo-modules-core` # How - Change package using AS refactor tools - Fix some places where AS wasn't able to do automatically - Fix compatibility with new auto-linking - Ensure that classes which are used during installation steps are still available in the old place # Test Plan - expo-go (tested using unversioned and 41) - bare-expo
[android] lint spotless ktlint and fix CI step (#13662)
[android] Add kotlin spotless ktlint linter (#12545)
[media-library][Android] Handle albums with null name (#9787)# Why Fixes #9759 Since Android Q, media files in some directories (including sdcard root dir) have `bucket_display_name` column c
[media-library][Android] Handle albums with null name (#9787)# Why Fixes #9759 Since Android Q, media files in some directories (including sdcard root dir) have `bucket_display_name` column containing `null` instead of directory name. Older Android versions returned at least _"0"_ as name. This situation needs to be handled. # How Skipped listing albums with no name. Listing them has no point, since they are impossible to query using `MediaLibrary.getAlbumAsync(name: string)`. Also added a short note to docs about this. # Test Plan Native unit tests, also tested manually on two devices: Android 6 and Android 10.
[media-library] Fix `getAlbumsAsync()` crashing on Android 10 (#9666)# Why Fixes #9635 Android 10 seems not to support SQL functions (`COUNT(*)`, `GROUP BY` etc.) in `ContentResolver` querie
[media-library] Fix `getAlbumsAsync()` crashing on Android 10 (#9666)# Why Fixes #9635 Android 10 seems not to support SQL functions (`COUNT(*)`, `GROUP BY` etc.) in `ContentResolver` queries. [[source]](https://stackoverflow.com/questions/60623594/replacement-for-group-by-in-contentresolver-query-in-android-q-android-10-a) Also, `MediaLibrary.getAlbumsAsync()` did not work properly on Android. # How Rewrite some `expo-media-library` methods, which used those statements. - [x] Fixed `getAlbumsAsync()`. Rewritten method in Kotlin. - [x] Fixed `getAlbum()`. - [x] Fixed `MediaLibrary` listener `onChange()` event. - [x] Other minor fixes. - [x] Cleanup. # Test Plan - [x] Native unit tests - [x] Test suite - [x] NCL - [x] Demo app ran on API level 29+. - [x] Demo app ran on API level < 29
[media-library] Add unit tests to module (#9538)# Why MediaLibrary has many utility methods, which behavior is sometimes unclear. Unit tests would describe that behavior. Also, contains some mi
[media-library] Add unit tests to module (#9538)# Why MediaLibrary has many utility methods, which behavior is sometimes unclear. Unit tests would describe that behavior. Also, contains some minor fixes. # How - Add native unit tests to `MediaLibrary` on Android. - Fixes bug, where `getAssetsAsync()` could return without promise rejection, when caught `IOException` - Adds a little input validation to module methods - Removes unused test dependencies from `expo-web-browser`. # Test plan `et android-native-unit-tests` --- WIP - [x] Add testing dependencies - [x] Add utility functions to mock `ContentResolver` - [x] Test `GetQueryInfo` - [x] Test `MediaLibraryUtils` where possible - [x] Test `GetAssets` - [x] Test `GetAssetInfo` - [x] Extract useful test utility functions to `unimodules-test-core` - [x] Input validation and minor refactors