expo-media-library 17.1.2 → 17.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/medialibrary/MediaLibraryModule.kt +17 -4
- package/android/src/main/java/expo/modules/medialibrary/albums/AddAssetsToAlbum.kt +1 -29
- package/android/src/main/java/expo/modules/medialibrary/albums/AlbumUtils.kt +30 -0
- package/android/src/main/java/expo/modules/medialibrary/albums/CreateAlbum.kt +37 -17
- package/build/MediaLibrary.d.ts +6 -3
- package/build/MediaLibrary.d.ts.map +1 -1
- package/build/MediaLibrary.js +12 -7
- package/build/MediaLibrary.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/MediaLibraryModule.swift +36 -13
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/{17.1.2/expo.modules.medialibrary-17.1.2-sources.jar → 17.1.3/expo.modules.medialibrary-17.1.3-sources.jar} +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3-sources.jar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3-sources.jar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3-sources.jar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3-sources.jar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/{17.1.2/expo.modules.medialibrary-17.1.2.module → 17.1.3/expo.modules.medialibrary-17.1.3.module} +22 -22
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/{17.1.2/expo.modules.medialibrary-17.1.2.pom → 17.1.3/expo.modules.medialibrary-17.1.3.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.3/expo.modules.medialibrary-17.1.3.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/maven-metadata.xml +4 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/maven-metadata.xml.sha512 +1 -1
- package/package.json +2 -2
- package/src/MediaLibrary.ts +17 -7
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2-sources.jar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2-sources.jar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2-sources.jar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2-sources.jar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/17.1.2/expo.modules.medialibrary-17.1.2.pom.sha512 +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 17.1.3 — 2025-04-21
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
13
17
|
## 17.1.2 — 2025-04-14
|
|
14
18
|
|
|
15
19
|
_This version does not introduce any user-facing changes._
|
|
@@ -24,6 +28,7 @@ _This version does not introduce any user-facing changes._
|
|
|
24
28
|
|
|
25
29
|
- [iOS] Adding `pairedVideoAsset` for Live Photo support. ([#33274](https://github.com/expo/expo/pull/33274) by [@entiendoNull](https://github.com/entiendoNull))
|
|
26
30
|
- Add `album` parameter to `createAssetAsync`. ([#35686](https://github.com/expo/expo/pull/35686) by [@behenate](https://github.com/behenate))
|
|
31
|
+
- Add `initialAssetLocalUri` to `createAlbumAsync`. ([#35692](https://github.com/expo/expo/pull/35692) by [@behenate](https://github.com/behenate))
|
|
27
32
|
|
|
28
33
|
### 💡 Others
|
|
29
34
|
|
package/android/build.gradle
CHANGED
|
@@ -33,6 +33,7 @@ import expo.modules.kotlin.modules.ModuleDefinition
|
|
|
33
33
|
import expo.modules.medialibrary.MediaLibraryModule.Action
|
|
34
34
|
import expo.modules.medialibrary.albums.AddAssetsToAlbum
|
|
35
35
|
import expo.modules.medialibrary.albums.CreateAlbum
|
|
36
|
+
import expo.modules.medialibrary.albums.CreateAlbumWithInitialFileUri
|
|
36
37
|
import expo.modules.medialibrary.albums.DeleteAlbums
|
|
37
38
|
import expo.modules.medialibrary.albums.GetAlbum
|
|
38
39
|
import expo.modules.medialibrary.albums.GetAlbums
|
|
@@ -180,15 +181,27 @@ class MediaLibraryModule : Module() {
|
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
183
|
|
|
183
|
-
AsyncFunction("createAlbumAsync") { albumName: String, assetId: String
|
|
184
|
+
AsyncFunction("createAlbumAsync") { albumName: String, assetId: String?, copyAsset: Boolean, initialAssetUri: Uri?, promise: Promise ->
|
|
184
185
|
throwUnlessPermissionsGranted {
|
|
185
186
|
val action = actionIfUserGrantedPermission(promise) {
|
|
186
187
|
withModuleScope(promise) {
|
|
187
|
-
|
|
188
|
-
|
|
188
|
+
assetId?.let {
|
|
189
|
+
CreateAlbum(context, albumName, assetId, copyAsset, promise)
|
|
190
|
+
.execute()
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
initialAssetUri?.let {
|
|
194
|
+
CreateAlbumWithInitialFileUri(context, albumName, it, promise)
|
|
195
|
+
.execute()
|
|
196
|
+
}
|
|
189
197
|
}
|
|
190
198
|
}
|
|
191
|
-
|
|
199
|
+
val assetIdList = if (!copyAsset && assetId != null) {
|
|
200
|
+
listOf(assetId)
|
|
201
|
+
} else {
|
|
202
|
+
emptyList()
|
|
203
|
+
}
|
|
204
|
+
runActionWithPermissions(assetIdList, action)
|
|
192
205
|
}
|
|
193
206
|
}
|
|
194
207
|
|
|
@@ -3,11 +3,7 @@ package expo.modules.medialibrary.albums
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import android.media.MediaScannerConnection
|
|
5
5
|
import android.os.Build
|
|
6
|
-
import android.provider.MediaStore
|
|
7
6
|
import expo.modules.kotlin.Promise
|
|
8
|
-
import expo.modules.medialibrary.AlbumException
|
|
9
|
-
import expo.modules.medialibrary.EXTERNAL_CONTENT_URI
|
|
10
|
-
import expo.modules.medialibrary.MediaLibraryException
|
|
11
7
|
import expo.modules.medialibrary.MediaLibraryUtils
|
|
12
8
|
import expo.modules.medialibrary.PermissionsException
|
|
13
9
|
import java.io.File
|
|
@@ -25,31 +21,7 @@ internal class AddAssetsToAlbum(
|
|
|
25
21
|
// Media store table can be corrupted. Extra check won't harm anyone.
|
|
26
22
|
private val album: File
|
|
27
23
|
get() {
|
|
28
|
-
|
|
29
|
-
val selection = "${MediaStore.MediaColumns.BUCKET_ID}=?"
|
|
30
|
-
val id = arrayOf(albumId)
|
|
31
|
-
context.contentResolver.query(
|
|
32
|
-
EXTERNAL_CONTENT_URI,
|
|
33
|
-
path,
|
|
34
|
-
selection,
|
|
35
|
-
id,
|
|
36
|
-
null
|
|
37
|
-
).use { albumCursor ->
|
|
38
|
-
if (albumCursor == null) {
|
|
39
|
-
throw AlbumException("Could not get album. Query returns null.")
|
|
40
|
-
} else if (albumCursor.count == 0) {
|
|
41
|
-
throw AlbumException("No album with id: $albumId")
|
|
42
|
-
}
|
|
43
|
-
albumCursor.moveToNext()
|
|
44
|
-
val filePathColumnIndex = albumCursor.getColumnIndex(MediaStore.Images.Media.DATA)
|
|
45
|
-
val fileInAlbum = File(albumCursor.getString(filePathColumnIndex))
|
|
46
|
-
|
|
47
|
-
// Media store table can be corrupted. Extra check won't harm anyone.
|
|
48
|
-
if (!fileInAlbum.isFile && !fileInAlbum.isDirectory) {
|
|
49
|
-
throw MediaLibraryException()
|
|
50
|
-
}
|
|
51
|
-
return File(fileInAlbum.parent!!)
|
|
52
|
-
}
|
|
24
|
+
return getAlbumFile(context, albumId)
|
|
53
25
|
}
|
|
54
26
|
|
|
55
27
|
fun execute() {
|
|
@@ -3,13 +3,17 @@ package expo.modules.medialibrary.albums
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import android.os.Bundle
|
|
5
5
|
import android.provider.MediaStore
|
|
6
|
+
import android.provider.MediaStore.Files.FileColumns
|
|
6
7
|
import android.provider.MediaStore.MediaColumns
|
|
8
|
+
import expo.modules.core.utilities.ifNull
|
|
7
9
|
import expo.modules.kotlin.Promise
|
|
8
10
|
import expo.modules.medialibrary.AlbumException
|
|
11
|
+
import expo.modules.medialibrary.AssetFileException
|
|
9
12
|
import expo.modules.medialibrary.ERROR_UNABLE_TO_LOAD
|
|
10
13
|
import expo.modules.medialibrary.ERROR_UNABLE_TO_LOAD_PERMISSION
|
|
11
14
|
import expo.modules.medialibrary.EXTERNAL_CONTENT_URI
|
|
12
15
|
import expo.modules.medialibrary.MediaLibraryException
|
|
16
|
+
import expo.modules.medialibrary.MediaLibraryUtils
|
|
13
17
|
import expo.modules.medialibrary.MediaLibraryUtils.queryPlaceholdersFor
|
|
14
18
|
import java.io.File
|
|
15
19
|
|
|
@@ -111,9 +115,35 @@ internal fun getFileOrNullByContextResolver(context: Context, selection: String,
|
|
|
111
115
|
}
|
|
112
116
|
}
|
|
113
117
|
|
|
118
|
+
internal fun getAlbumFileByNameOrNull(context: Context, albumName: String): File? {
|
|
119
|
+
val selection = "${FileColumns.MEDIA_TYPE} != ${FileColumns.MEDIA_TYPE_NONE} AND ${MediaColumns.BUCKET_DISPLAY_NAME}=?"
|
|
120
|
+
val selectionArgs = arrayOf(albumName)
|
|
121
|
+
|
|
122
|
+
return getFileOrNullByContextResolver(context, selection, selectionArgs)
|
|
123
|
+
}
|
|
124
|
+
|
|
114
125
|
internal fun getAlbumFileOrNull(context: Context, albumId: String): File? {
|
|
115
126
|
val selection = "${MediaColumns.BUCKET_ID}=?"
|
|
116
127
|
val selectionArgs = arrayOf(albumId)
|
|
117
128
|
|
|
118
129
|
return getFileOrNullByContextResolver(context, selection, selectionArgs)
|
|
119
130
|
}
|
|
131
|
+
|
|
132
|
+
internal fun getAlbumFile(context: Context, albumId: String): File {
|
|
133
|
+
val albumFile = getAlbumFileOrNull(context, albumId)
|
|
134
|
+
return albumFile ?: throw AlbumException("Could not get album. Query returns null.")
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
internal fun createAlbumFile(mimeType: String, albumName: String): File {
|
|
138
|
+
val albumDir = MediaLibraryUtils.getEnvDirectoryForAssetType(mimeType, false)
|
|
139
|
+
.ifNull {
|
|
140
|
+
throw AssetFileException("Could not guess asset type.")
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
val album = File(albumDir.path, albumName)
|
|
144
|
+
.takeIf { it.exists() || it.mkdirs() }
|
|
145
|
+
.ifNull {
|
|
146
|
+
throw AlbumException("Could not create album directory.")
|
|
147
|
+
}
|
|
148
|
+
return album
|
|
149
|
+
}
|
|
@@ -4,13 +4,12 @@ import android.content.Context
|
|
|
4
4
|
import android.media.MediaScannerConnection
|
|
5
5
|
import android.net.Uri
|
|
6
6
|
import android.provider.MediaStore
|
|
7
|
-
import expo.modules.core.utilities.ifNull
|
|
8
7
|
import expo.modules.kotlin.Promise
|
|
9
8
|
import expo.modules.medialibrary.AlbumException
|
|
10
|
-
import expo.modules.medialibrary.AssetFileException
|
|
11
9
|
import expo.modules.medialibrary.ERROR_UNABLE_TO_LOAD
|
|
12
10
|
import expo.modules.medialibrary.ERROR_UNABLE_TO_LOAD_PERMISSION
|
|
13
11
|
import expo.modules.medialibrary.MediaLibraryUtils
|
|
12
|
+
import expo.modules.medialibrary.assets.CreateAssetWithAlbumFile
|
|
14
13
|
import java.io.File
|
|
15
14
|
import java.io.IOException
|
|
16
15
|
|
|
@@ -23,25 +22,11 @@ internal class CreateAlbum(
|
|
|
23
22
|
) {
|
|
24
23
|
private val mStrategy = if (copyAsset) AssetFileStrategy.copyStrategy else AssetFileStrategy.moveStrategy
|
|
25
24
|
|
|
26
|
-
private fun createAlbum(mimeType: String): File {
|
|
27
|
-
val albumDir = MediaLibraryUtils.getEnvDirectoryForAssetType(mimeType, false)
|
|
28
|
-
.ifNull {
|
|
29
|
-
throw AssetFileException("Could not guess asset type.")
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
val album = File(albumDir.path, albumName)
|
|
33
|
-
.takeIf { it.exists() || it.mkdirs() }
|
|
34
|
-
.ifNull {
|
|
35
|
-
throw AlbumException("Could not create album directory.")
|
|
36
|
-
}
|
|
37
|
-
return album
|
|
38
|
-
}
|
|
39
|
-
|
|
40
25
|
fun execute() {
|
|
41
26
|
try {
|
|
42
27
|
val files = MediaLibraryUtils.getAssetsById(context, assetId)
|
|
43
28
|
val albumCreator = files[0]
|
|
44
|
-
val album =
|
|
29
|
+
val album = createAlbumFile(albumCreator.mimeType, albumName)
|
|
45
30
|
val newFile = mStrategy.apply(albumCreator, album, context)
|
|
46
31
|
MediaScannerConnection.scanFile(
|
|
47
32
|
context,
|
|
@@ -66,3 +51,38 @@ internal class CreateAlbum(
|
|
|
66
51
|
}
|
|
67
52
|
}
|
|
68
53
|
}
|
|
54
|
+
|
|
55
|
+
// Creates the album file and uses existing CreateAssetWithAlbumFile to create the asset inside the album.
|
|
56
|
+
internal class CreateAlbumWithInitialFileUri(val context: Context, val albumName: String, val assetUri: Uri, val promise: Promise) {
|
|
57
|
+
fun execute() {
|
|
58
|
+
val mimeType: String = MediaLibraryUtils.getMimeType(context.contentResolver, assetUri) ?: run {
|
|
59
|
+
promise.reject(AlbumException("Failed to create album: could not determine MIME type of the asset with uri: `$assetUri`."))
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
val assetUriPath = assetUri.path ?: run {
|
|
63
|
+
promise.reject(AlbumException("Failed to create album: could not determine path of the asset with uri: `$assetUri`."))
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
val albumFile: File = createAlbumFile(mimeType, albumName)
|
|
68
|
+
val mediaFile: File = File(assetUriPath)
|
|
69
|
+
|
|
70
|
+
if (!mediaFile.exists()) {
|
|
71
|
+
promise.reject(AlbumException("Failed to create album: the local media file with uri: `$assetUri` does not exist."))
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
val createAssetPromise = object : Promise {
|
|
76
|
+
override fun resolve(value: Any?) {
|
|
77
|
+
// Resolve our promise with the newly created album
|
|
78
|
+
GetAlbum(context, albumName, promise).execute()
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
override fun reject(code: String, message: String?, cause: Throwable?) {
|
|
82
|
+
promise.reject(code, "Failed to create the album: $message", cause)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
CreateAssetWithAlbumFile(context, assetUri.toString(), createAssetPromise, false, albumFile).execute()
|
|
87
|
+
}
|
|
88
|
+
}
|
package/build/MediaLibrary.d.ts
CHANGED
|
@@ -415,13 +415,16 @@ export declare function getAlbumAsync(title: string): Promise<Album>;
|
|
|
415
415
|
* given asset from the current album to the new one, however it's also possible to move it by
|
|
416
416
|
* passing `false` as `copyAsset` argument.
|
|
417
417
|
* In case it's copied you should keep in mind that `getAssetsAsync` will return duplicated asset.
|
|
418
|
+
* > On Android, it's not possible to create an empty album. You must provide an existing asset to copy or move into the album or an uri of a local file, which will be used to create an initial asset for the album.
|
|
418
419
|
* @param albumName Name of the album to create.
|
|
419
|
-
* @param asset An [Asset](#asset) or its ID
|
|
420
|
-
* @param
|
|
420
|
+
* @param asset An [Asset](#asset) or its ID. On Android you either need to provide an asset or a localUri.
|
|
421
|
+
* @param initialAssetLocalUri A URI to the local media file, which will be used to create the initial asset inside the album. It must contain an extension. On Android it
|
|
422
|
+
* must be a local path, so it must start with `file:///`. If the `asset` was provided, this parameter will be ignored.
|
|
423
|
+
* @param copyAsset __Android Only.__ Whether to copy asset to the new album instead of move it. This parameter is ignored if `asset` was not provided.
|
|
421
424
|
* Defaults to `true`.
|
|
422
425
|
* @return Newly created [`Album`](#album).
|
|
423
426
|
*/
|
|
424
|
-
export declare function createAlbumAsync(albumName: string, asset?: AssetRef, copyAsset?: boolean): Promise<Album>;
|
|
427
|
+
export declare function createAlbumAsync(albumName: string, asset?: AssetRef, copyAsset?: boolean, initialAssetLocalUri?: string): Promise<Album>;
|
|
425
428
|
/**
|
|
426
429
|
* Deletes given albums from the library. On Android by default it deletes assets belonging to given
|
|
427
430
|
* albums from the library. On iOS it doesn't delete these assets, however it's possible to do by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IG;AACH,wBAAsB,cAAc,CAAC,aAAa,GAAE,aAAkB,GAAG,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAuCjG;AAGD;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,6BAA6B,KAAK,IAAI,GACvD,iBAAiB,CAEnB;AAGD,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,iBAAiB,GAAG,IAAI,CAExE;AAGD;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAGD;;;;;GAKG;AACH,wBAAsB,eAAe,iBAMpC;AAGD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAM9E;AAGD;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAMhF"}
|
package/build/MediaLibrary.js
CHANGED
|
@@ -323,20 +323,25 @@ export async function getAlbumAsync(title) {
|
|
|
323
323
|
* given asset from the current album to the new one, however it's also possible to move it by
|
|
324
324
|
* passing `false` as `copyAsset` argument.
|
|
325
325
|
* In case it's copied you should keep in mind that `getAssetsAsync` will return duplicated asset.
|
|
326
|
+
* > On Android, it's not possible to create an empty album. You must provide an existing asset to copy or move into the album or an uri of a local file, which will be used to create an initial asset for the album.
|
|
326
327
|
* @param albumName Name of the album to create.
|
|
327
|
-
* @param asset An [Asset](#asset) or its ID
|
|
328
|
-
* @param
|
|
328
|
+
* @param asset An [Asset](#asset) or its ID. On Android you either need to provide an asset or a localUri.
|
|
329
|
+
* @param initialAssetLocalUri A URI to the local media file, which will be used to create the initial asset inside the album. It must contain an extension. On Android it
|
|
330
|
+
* must be a local path, so it must start with `file:///`. If the `asset` was provided, this parameter will be ignored.
|
|
331
|
+
* @param copyAsset __Android Only.__ Whether to copy asset to the new album instead of move it. This parameter is ignored if `asset` was not provided.
|
|
329
332
|
* Defaults to `true`.
|
|
330
333
|
* @return Newly created [`Album`](#album).
|
|
331
334
|
*/
|
|
332
|
-
export async function createAlbumAsync(albumName, asset, copyAsset = true) {
|
|
335
|
+
export async function createAlbumAsync(albumName, asset, copyAsset = true, initialAssetLocalUri) {
|
|
333
336
|
if (!MediaLibrary.createAlbumAsync) {
|
|
334
337
|
throw new UnavailabilityError('MediaLibrary', 'createAlbumAsync');
|
|
335
338
|
}
|
|
336
339
|
const assetId = getId(asset);
|
|
337
|
-
if (Platform.OS === 'android' &&
|
|
340
|
+
if (Platform.OS === 'android' &&
|
|
341
|
+
(typeof assetId !== 'string' || assetId.length === 0) &&
|
|
342
|
+
!initialAssetLocalUri) {
|
|
338
343
|
// it's not possible to create empty album on Android, so initial asset must be provided
|
|
339
|
-
throw new Error('MediaLibrary.createAlbumAsync must be called with an asset on Android.');
|
|
344
|
+
throw new Error('MediaLibrary.createAlbumAsync must be called with an asset or a localUri on Android.');
|
|
340
345
|
}
|
|
341
346
|
if (!albumName || typeof albumName !== 'string') {
|
|
342
347
|
throw new Error('Invalid argument "albumName". It must be a string!');
|
|
@@ -345,9 +350,9 @@ export async function createAlbumAsync(albumName, asset, copyAsset = true) {
|
|
|
345
350
|
throw new Error('Asset ID must be a string!');
|
|
346
351
|
}
|
|
347
352
|
if (Platform.OS === 'ios') {
|
|
348
|
-
return await MediaLibrary.createAlbumAsync(albumName, assetId);
|
|
353
|
+
return await MediaLibrary.createAlbumAsync(albumName, assetId, initialAssetLocalUri);
|
|
349
354
|
}
|
|
350
|
-
return await MediaLibrary.createAlbumAsync(albumName, assetId, !!copyAsset);
|
|
355
|
+
return await MediaLibrary.createAlbumAsync(albumName, assetId, !!copyAsset, initialAssetLocalUri);
|
|
351
356
|
}
|
|
352
357
|
// @needsAudit
|
|
353
358
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaLibrary.js","sourceRoot":"","sources":["../src/M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AY,CAAC,WAAW,CAAC,YAAY,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;AAC/E,CAAC;AAED,eAAe;AACf,MAAM,UAAU,kBAAkB,CAAC,YAA+B;IAChE,YAAY,CAAC,MAAM,EAAE,CAAC;AACxB,CAAC;AAED,cAAc;AACd;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,YAAY,CAAC,kBAAkB,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;AACrE,CAAC;AAED,cAAc;AACd;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,CAAC;QAClC,MAAM,IAAI,mBAAmB,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,MAAM,YAAY,CAAC,eAAe,EAAE,CAAC;AAC9C,CAAC;AAED,cAAc;AACd;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,KAAe;IAC7D,IAAI,CAAC,YAAY,CAAC,yBAAyB,EAAE,CAAC;QAC5C,OAAO;IACT,CAAC;IAED,OAAO,MAAM,YAAY,CAAC,yBAAyB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,cAAc;AACd;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,KAAe;IAC5D,IAAI,CAAC,YAAY,CAAC,wBAAwB,EAAE,CAAC;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,MAAM,YAAY,CAAC,wBAAwB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import {\n PermissionResponse as EXPermissionResponse,\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n createPermissionHook,\n UnavailabilityError,\n EventSubscription,\n} from 'expo-modules-core';\nimport { Platform } from 'react-native';\n\nimport MediaLibrary from './ExpoMediaLibrary';\n\nconst isExpoGo = typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo;\n\nlet loggedExpoGoWarning = false;\n\nif (isExpoGo && !loggedExpoGoWarning) {\n console.warn(\n 'Due to changes in Androids permission requirements, Expo Go can no longer provide full access to the media library. To test the full functionality of this module, you can create a development build. https://docs.expo.dev/develop/development-builds/create-a-build'\n );\n loggedExpoGoWarning = true;\n}\n\n// @needsAudit\nexport type PermissionResponse = EXPermissionResponse & {\n /**\n * Indicates if your app has access to the whole or only part of the photo library. Possible values are:\n * - `'all'` if the user granted your app access to the whole photo library\n * - `'limited'` if the user granted your app access only to selected photos (only available on Android API 14+ and iOS 14.0+)\n * - `'none'` if user denied or hasn't yet granted the permission\n */\n accessPrivileges?: 'all' | 'limited' | 'none';\n};\n\n/**\n * Determines the type of media that the app will ask the OS to get access to.\n * @platform android 13+\n */\nexport type GranularPermission = 'audio' | 'photo' | 'video';\n\nexport type MediaTypeValue = 'audio' | 'photo' | 'video' | 'unknown' | 'pairedVideo';\n\n/**\n * Represents the possible types of media that the app will ask the OS to get access to when calling [`presentPermissionsPickerAsync()`](#medialibrarypresentpermissionspickerasyncmediatypes).\n * @platform android 14+\n * */\nexport type MediaTypeFilter = 'photo' | 'video';\n\nexport type SortByKey =\n | 'default'\n | 'mediaType'\n | 'width'\n | 'height'\n | 'creationTime'\n | 'modificationTime'\n | 'duration';\nexport type SortByValue = [SortByKey, boolean] | SortByKey;\n\ntype InternalSortByValue = `${SortByKey} ${'ASC' | 'DESC'}`;\n\nexport type MediaTypeObject = {\n audio: 'audio';\n photo: 'photo';\n video: 'video';\n unknown: 'unknown';\n};\n\nexport type SortByObject = {\n default: 'default';\n mediaType: 'mediaType';\n width: 'width';\n height: 'height';\n creationTime: 'creationTime';\n modificationTime: 'modificationTime';\n duration: 'duration';\n};\n\n// @needsAudit\nexport type Asset = {\n /**\n * Internal ID that represents an asset.\n */\n id: string;\n /**\n * Filename of the asset.\n */\n filename: string;\n /**\n * URI that points to the asset. `ph://*` (iOS), `file://*` (Android)\n */\n uri: string;\n /**\n * Media type.\n */\n mediaType: MediaTypeValue;\n /**\n * An array of media subtypes.\n * @platform ios\n */\n mediaSubtypes?: MediaSubtype[];\n /**\n * Width of the image or video.\n */\n width: number;\n /**\n * Height of the image or video.\n */\n height: number;\n /**\n * File creation timestamp.\n */\n creationTime: number;\n /**\n * Last modification timestamp.\n */\n modificationTime: number;\n /**\n * Duration of the video or audio asset in seconds.\n */\n duration: number;\n /**\n * Album ID that the asset belongs to.\n * @platform android\n */\n albumId?: string;\n};\n\n// @needsAudit\nexport type AssetInfo = Asset & {\n /**\n * Local URI for the asset.\n */\n localUri?: string;\n /**\n * GPS location if available.\n */\n location?: Location;\n /**\n * EXIF metadata associated with the image.\n */\n exif?: object;\n /**\n * Whether the asset is marked as favorite.\n * @platform ios\n */\n isFavorite?: boolean;\n /**\n * This field is available only if flag `shouldDownloadFromNetwork` is set to `false`.\n * Whether the asset is stored on the network (iCloud on iOS).\n * @platform ios\n */\n isNetworkAsset?: boolean; //iOS only\n /**\n * Display orientation of the image. Orientation is available only for assets whose\n * `mediaType` is `MediaType.photo`. Value will range from 1 to 8, see [EXIF orientation specification](http://sylvana.net/jpegcrop/exif_orientation.html)\n * for more details.\n * @platform ios\n */\n orientation?: number;\n /**\n * Contains information about the video paired with the image file.\n * This field is available if the `mediaType` is `\"photo\"`, and the `mediaSubtypes` includes `\"livePhoto\"`.\n * @platform ios\n */\n pairedVideoAsset?: Asset | null;\n};\n\n/**\n * Constants identifying specific variations of asset media, such as panorama or screenshot photos,\n * and time-lapse or high-frame-rate video. Maps to [these values](https://developer.apple.com/documentation/photokit/phassetmediasubtype#1603888).\n * */\nexport type MediaSubtype =\n | 'depthEffect'\n | 'hdr'\n | 'highFrameRate'\n | 'livePhoto'\n | 'panorama'\n | 'screenshot'\n | 'stream'\n | 'timelapse';\n\n// @needsAudit\nexport type MediaLibraryAssetInfoQueryOptions = {\n /**\n * Whether allow the asset to be downloaded from network. Only available in iOS with iCloud assets.\n * @default true\n */\n shouldDownloadFromNetwork?: boolean;\n};\n\n// @needsAudit\nexport type MediaLibraryAssetsChangeEvent = {\n /**\n * Whether the media library's changes could be described as \"incremental changes\".\n * `true` indicates the changes are described by the `insertedAssets`, `deletedAssets` and\n * `updatedAssets` values. `false` indicates that the scope of changes is too large and you\n * should perform a full assets reload (eg. a user has changed access to individual assets in the\n * media library).\n */\n hasIncrementalChanges: boolean;\n /**\n * Available only if `hasIncrementalChanges` is `true`.\n * Array of [`Asset`](#asset)s that have been inserted to the library.\n */\n insertedAssets?: Asset[];\n /**\n * Available only if `hasIncrementalChanges` is `true`.\n * Array of [`Asset`](#asset)s that have been deleted from the library.\n */\n deletedAssets?: Asset[];\n /**\n * Available only if `hasIncrementalChanges` is `true`.\n * Array of [`Asset`](#asset)s that have been updated or completed downloading from network\n * storage (iCloud on iOS).\n */\n updatedAssets?: Asset[];\n};\n\n// @docsMissing\nexport type Location = {\n latitude: number;\n longitude: number;\n};\n\n// @needsAudit\nexport type Album = {\n /**\n * Album ID.\n */\n id: string;\n /**\n * Album title.\n */\n title: string;\n /**\n * Estimated number of assets in the album.\n */\n assetCount: number;\n /**\n * The type of the assets album.\n * @platform ios\n */\n type?: AlbumType;\n /**\n * Apply only to albums whose type is `'moment'`. Earliest creation timestamp of all\n * assets in the moment.\n * @platform ios\n */\n startTime: number;\n /**\n * Apply only to albums whose type is `'moment'`. Latest creation timestamp of all\n * assets in the moment.\n * @platform ios\n */\n endTime: number;\n /**\n * Apply only to albums whose type is `'moment'`. Approximated location of all\n * assets in the moment.\n * @platform ios\n */\n approximateLocation?: Location;\n /**\n * Apply only to albums whose type is `'moment'`. Names of locations grouped\n * in the moment.\n * @platform ios\n */\n locationNames?: string[];\n};\n\n// @docsMissing\nexport type AlbumType = 'album' | 'moment' | 'smartAlbum';\n\n// @docsMissing\nexport type AlbumsOptions = {\n includeSmartAlbums?: boolean;\n};\n\n// @needsAudit\nexport type AssetsOptions = {\n /**\n * The maximum number of items on a single page.\n * @default 20\n */\n first?: number;\n /**\n * Asset ID of the last item returned on the previous page. To get the ID of the next page,\n * pass [`endCursor`](#pagedinfo) as its value.\n */\n after?: AssetRef;\n /**\n * [Album](#album) or its ID to get assets from specific album.\n */\n album?: AlbumRef;\n /**\n * An array of [`SortByValue`](#sortbyvalue)s or a single `SortByValue` value. By default, all\n * keys are sorted in descending order, however you can also pass a pair `[key, ascending]` where\n * the second item is a `boolean` value that means whether to use ascending order. Note that if\n * the `SortBy.default` key is used, then `ascending` argument will not matter. Earlier items have\n * higher priority when sorting out the results.\n * If empty, this method uses the default sorting that is provided by the platform.\n */\n sortBy?: SortByValue[] | SortByValue;\n /**\n * An array of [MediaTypeValue](#mediatypevalue)s or a single `MediaTypeValue`.\n * @default MediaType.photo\n */\n mediaType?: MediaTypeValue[] | MediaTypeValue;\n /**\n * `Date` object or Unix timestamp in milliseconds limiting returned assets only to those that\n * were created after this date.\n */\n createdAfter?: Date | number;\n /**\n * Similarly as `createdAfter`, but limits assets only to those that were created before specified\n * date.\n */\n createdBefore?: Date | number;\n};\n\n// @needsAudit\nexport type PagedInfo<T> = {\n /**\n * A page of [`Asset`](#asset)s fetched by the query.\n */\n assets: T[];\n /**\n * ID of the last fetched asset. It should be passed as `after` option in order to get the\n * next page.\n */\n endCursor: string;\n /**\n * Whether there are more assets to fetch.\n */\n hasNextPage: boolean;\n /**\n * Estimated total number of assets that match the query.\n */\n totalCount: number;\n};\n\n// @docsMissing\nexport type AssetRef = Asset | string;\n\n// @docsMissing\nexport type AlbumRef = Album | string;\n\nexport {\n PermissionStatus,\n PermissionExpiration,\n EXPermissionResponse,\n PermissionHookOptions,\n EventSubscription as Subscription,\n};\n\nfunction arrayize<T>(item: T | T[]): T[] {\n if (Array.isArray(item)) {\n return item;\n }\n return item ? [item] : [];\n}\n\nfunction getId(ref: string | undefined | { id?: string }): string | undefined {\n if (typeof ref === 'string') {\n return ref;\n }\n return ref ? ref.id : undefined;\n}\n\nfunction checkAssetIds(assetIds: unknown[]): asserts assetIds is string[] {\n if (assetIds.some((id) => !id || typeof id !== 'string')) {\n throw new Error('Asset ID must be a string!');\n }\n}\n\nfunction checkAlbumIds(albumIds: unknown[]): asserts albumIds is string[] {\n if (albumIds.some((id) => !id || typeof id !== 'string')) {\n throw new Error('Album ID must be a string!');\n }\n}\n\nfunction checkMediaType(mediaType: unknown): asserts mediaType is keyof MediaTypeObject {\n if (Object.values(MediaType).indexOf(mediaType as any) === -1) {\n throw new Error(`Invalid mediaType: ${mediaType}`);\n }\n}\n\nfunction checkSortBy(sortBy: unknown): asserts sortBy is SortByValue {\n if (Array.isArray(sortBy)) {\n checkSortByKey(sortBy[0]);\n\n if (typeof sortBy[1] !== 'boolean') {\n throw new Error('Invalid sortBy array argument. Second item must be a boolean!');\n }\n } else {\n checkSortByKey(sortBy);\n }\n}\n\nfunction checkSortByKey(sortBy: any): void {\n if (Object.values(SortBy).indexOf(sortBy) === -1) {\n throw new Error(`Invalid sortBy key: ${sortBy}`);\n }\n}\n\nfunction sortByOptionToString(sortBy: SortByValue | undefined): InternalSortByValue {\n checkSortBy(sortBy);\n if (Array.isArray(sortBy)) {\n return `${sortBy[0]} ${sortBy[1] ? 'ASC' : 'DESC'}`;\n }\n return `${sortBy} DESC`;\n}\n\nfunction dateToNumber(value?: Date | number): number | undefined {\n return value instanceof Date ? value.getTime() : value;\n}\n\n// @needsAudit\n/**\n * Possible media types.\n */\nexport const MediaType: MediaTypeObject = MediaLibrary.MediaType;\n\n// @needsAudit\n/**\n * Supported keys that can be used to sort `getAssetsAsync` results.\n */\nexport const SortBy: SortByObject = MediaLibrary.SortBy;\n\n// @needsAudit\n/**\n * Returns whether the Media Library API is enabled on the current device.\n * @return A promise which fulfils with a `boolean`, indicating whether the Media Library API is\n * available on the current device.\n */\nexport async function isAvailableAsync(): Promise<boolean> {\n return !!MediaLibrary && 'getAssetsAsync' in MediaLibrary;\n}\n\n// @needsAudit @docsMissing\n/**\n * Asks the user to grant permissions for accessing media in user's media library.\n * @param writeOnly\n * @param granularPermissions - A list of [`GranularPermission`](#granularpermission) values. This parameter has an\n * effect only on Android 13 and newer. By default, `expo-media-library` will ask for all possible permissions.\n * @return A promise that fulfils with [`PermissionResponse`](#permissionresponse) object.\n */\nexport async function requestPermissionsAsync(\n writeOnly: boolean = false,\n granularPermissions?: GranularPermission[]\n): Promise<PermissionResponse> {\n if (!MediaLibrary.requestPermissionsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'requestPermissionsAsync');\n }\n if (Platform.OS === 'android') {\n return await MediaLibrary.requestPermissionsAsync(writeOnly, granularPermissions);\n }\n return await MediaLibrary.requestPermissionsAsync(writeOnly);\n}\n\n// @needsAudit @docsMissing\n/**\n * Checks user's permissions for accessing media library.\n * @param writeOnly\n * @param granularPermissions - A list of [`GranularPermission`](#granularpermission) values. This parameter has\n * an effect only on Android 13 and newer. By default, `expo-media-library` will ask for all possible permissions.\n * @return A promise that fulfils with [`PermissionResponse`](#permissionresponse) object.\n */\nexport async function getPermissionsAsync(\n writeOnly: boolean = false,\n granularPermissions?: GranularPermission[]\n): Promise<PermissionResponse> {\n if (!MediaLibrary.getPermissionsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'getPermissionsAsync');\n }\n if (Platform.OS === 'android') {\n return await MediaLibrary.getPermissionsAsync(writeOnly, granularPermissions);\n }\n return await MediaLibrary.getPermissionsAsync(writeOnly);\n}\n\n// @needsAudit\n/**\n * Check or request permissions to access the media library.\n * This uses both `requestPermissionsAsync` and `getPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [permissionResponse, requestPermission] = MediaLibrary.usePermissions();\n * ```\n */\nexport const usePermissions = createPermissionHook<\n PermissionResponse,\n { writeOnly?: boolean; granularPermissions?: GranularPermission[] }\n>({\n // TODO(cedric): permission requesters should have an options param or a different requester\n getMethod: (options) => getPermissionsAsync(options?.writeOnly, options?.granularPermissions),\n requestMethod: (options) =>\n requestPermissionsAsync(options?.writeOnly, options?.granularPermissions),\n});\n\n// @needsAudit\n/**\n * Allows the user to update the assets that your app has access to.\n * The system modal is only displayed if the user originally allowed only `limited` access to their\n * media library, otherwise this method is a no-op.\n * @param mediaTypes Limits the type(s) of media that the user will be granting access to. By default, a list that shows both photos and videos is presented.\n *\n * @return A promise that either rejects if the method is unavailable, or resolves to `void`.\n * > __Note:__ This method doesn't inform you if the user changes which assets your app has access to.\n * That information is only exposed by iOS, and to obtain it, you need to subscribe for updates to the user's media library using [`addListener()`](#medialibraryaddlistenerlistener).\n * If `hasIncrementalChanges` is `false`, the user changed their permissions.\n *\n * @platform android 14+\n * @platform ios\n */\nexport async function presentPermissionsPickerAsync(\n mediaTypes: MediaTypeFilter[] = ['photo', 'video']\n): Promise<void> {\n if (Platform.OS === 'android' && isExpoGo) {\n throw new UnavailabilityError(\n 'MediaLibrary',\n 'presentPermissionsPickerAsync is unavailable in Expo Go'\n );\n }\n if (Platform.OS === 'android' && Platform.Version >= 34) {\n await MediaLibrary.requestPermissionsAsync(false, mediaTypes);\n return;\n }\n if (!MediaLibrary.presentPermissionsPickerAsync) {\n throw new UnavailabilityError('MediaLibrary', 'presentPermissionsPickerAsync');\n }\n return await MediaLibrary.presentPermissionsPickerAsync();\n}\n\n// @needsAudit\n/**\n * Creates an asset from existing file. The most common use case is to save a picture taken by [Camera](./camera).\n * This method requires `CAMERA_ROLL` permission.\n *\n * @example\n * ```js\n * const { uri } = await Camera.takePictureAsync();\n * const asset = await MediaLibrary.createAssetAsync(uri);\n * ```\n * @param localUri A URI to the image or video file. It must contain an extension. On Android it\n * must be a local path, so it must start with `file:///`\n *\n * @param album An [Album](#album) or its ID. If provided, the asset will be added to this album upon creation, otherwise it will be added to the default album for the media type.\n * The album has exist.\n * @return A promise which fulfils with an object representing an [`Asset`](#asset).\n */\nexport async function createAssetAsync(localUri: string, album?: AlbumRef): Promise<Asset> {\n if (!MediaLibrary.createAssetAsync) {\n throw new UnavailabilityError('MediaLibrary', 'createAssetAsync');\n }\n\n const albumId = getId(album);\n\n if (!localUri || typeof localUri !== 'string') {\n throw new Error('Invalid argument \"localUri\". It must be a string!');\n }\n const asset = await MediaLibrary.createAssetAsync(localUri, albumId);\n\n if (Array.isArray(asset)) {\n // Android returns an array with asset, we need to pick the first item\n return asset[0];\n }\n return asset;\n}\n\n// @needsAudit\n/**\n * Saves the file at given `localUri` to the user's media library. Unlike [`createAssetAsync()`](#medialibrarycreateassetasynclocaluri),\n * This method doesn't return created asset.\n * On __iOS 11+__, it's possible to use this method without asking for `CAMERA_ROLL` permission,\n * however then yours `Info.plist` should have `NSPhotoLibraryAddUsageDescription` key.\n * @param localUri A URI to the image or video file. It must contain an extension. On Android it\n * must be a local path, so it must start with `file:///`.\n */\nexport async function saveToLibraryAsync(localUri: string): Promise<void> {\n if (!MediaLibrary.saveToLibraryAsync) {\n throw new UnavailabilityError('MediaLibrary', 'saveToLibraryAsync');\n }\n return await MediaLibrary.saveToLibraryAsync(localUri);\n}\n\n// @needsAudit\n/**\n * Adds array of assets to the album.\n *\n * On Android, by default it copies assets from the current album to provided one, however it's also\n * possible to move them by passing `false` as `copyAssets` argument. In case they're copied you\n * should keep in mind that `getAssetsAsync` will return duplicated assets.\n * @param assets An array of [Asset](#asset) or their IDs.\n * @param album An [Album](#album) or its ID.\n * @param copy __Android only.__ Whether to copy assets to the new album instead of move them.\n * Defaults to `true`.\n * @return Returns promise which fulfils with `true` if the assets were successfully added to\n * the album.\n */\nexport async function addAssetsToAlbumAsync(\n assets: AssetRef[] | AssetRef,\n album: AlbumRef,\n copy: boolean = true\n): Promise<boolean> {\n if (!MediaLibrary.addAssetsToAlbumAsync) {\n throw new UnavailabilityError('MediaLibrary', 'addAssetsToAlbumAsync');\n }\n\n const assetIds = arrayize(assets).map(getId);\n const albumId = getId(album);\n\n checkAssetIds(assetIds);\n\n if (!albumId || typeof albumId !== 'string') {\n throw new Error('Invalid album ID. It must be a string!');\n }\n\n if (Platform.OS === 'ios') {\n return await MediaLibrary.addAssetsToAlbumAsync(assetIds, albumId);\n }\n return await MediaLibrary.addAssetsToAlbumAsync(assetIds, albumId, !!copy);\n}\n\n// @needsAudit\n/**\n * Removes given assets from album.\n *\n * On Android, album will be automatically deleted if there are no more assets inside.\n * @param assets An array of [Asset](#asset) or their IDs.\n * @param album An [Album](#album) or its ID.\n * @return Returns promise which fulfils with `true` if the assets were successfully removed from\n * the album.\n */\nexport async function removeAssetsFromAlbumAsync(\n assets: AssetRef[] | AssetRef,\n album: AlbumRef\n): Promise<boolean> {\n if (!MediaLibrary.removeAssetsFromAlbumAsync) {\n throw new UnavailabilityError('MediaLibrary', 'removeAssetsFromAlbumAsync');\n }\n\n const assetIds = arrayize(assets).map(getId);\n const albumId = getId(album);\n\n checkAssetIds(assetIds);\n return await MediaLibrary.removeAssetsFromAlbumAsync(assetIds, albumId);\n}\n\n// @needsAudit\n/**\n * Deletes assets from the library. On iOS it deletes assets from all albums they belong to, while\n * on Android it keeps all copies of them (album is strictly connected to the asset). Also, there is\n * additional dialog on iOS that requires user to confirm this action.\n * @param assets An array of [Asset](#asset) or their IDs.\n * @return Returns promise which fulfils with `true` if the assets were successfully deleted.\n */\nexport async function deleteAssetsAsync(assets: AssetRef[] | AssetRef): Promise<boolean> {\n if (!MediaLibrary.deleteAssetsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'deleteAssetsAsync');\n }\n\n const assetIds = arrayize(assets).map(getId);\n\n checkAssetIds(assetIds);\n return await MediaLibrary.deleteAssetsAsync(assetIds);\n}\n\n// @needsAudit\n/**\n * Provides more information about an asset, including GPS location, local URI and EXIF metadata.\n * @param asset An [Asset](#asset) or its ID.\n * @param options\n * @return An [AssetInfo](#assetinfo) object, which is an `Asset` extended by an additional fields.\n */\nexport async function getAssetInfoAsync(\n asset: AssetRef,\n options: MediaLibraryAssetInfoQueryOptions = { shouldDownloadFromNetwork: true }\n): Promise<AssetInfo> {\n if (!MediaLibrary.getAssetInfoAsync) {\n throw new UnavailabilityError('MediaLibrary', 'getAssetInfoAsync');\n }\n\n const assetId = getId(asset);\n\n checkAssetIds([assetId]);\n\n const assetInfo = await MediaLibrary.getAssetInfoAsync(assetId, options);\n\n if (Array.isArray(assetInfo)) {\n // Android returns an array with asset info, we need to pick the first item\n return assetInfo[0];\n }\n return assetInfo;\n}\n\n// @needsAudit\n/**\n * Queries for user-created albums in media gallery.\n * @return A promise which fulfils with an array of [`Album`](#asset)s. Depending on Android version,\n * root directory of your storage may be listed as album titled `\"0\"` or unlisted at all.\n */\nexport async function getAlbumsAsync({ includeSmartAlbums = false }: AlbumsOptions = {}): Promise<\n Album[]\n> {\n if (!MediaLibrary.getAlbumsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'getAlbumsAsync');\n }\n return await MediaLibrary.getAlbumsAsync({ includeSmartAlbums });\n}\n\n// @needsAudit\n/**\n * Queries for an album with a specific name.\n * @param title Name of the album to look for.\n * @return An object representing an [`Album`](#album), if album with given name exists, otherwise\n * returns `null`.\n */\nexport async function getAlbumAsync(title: string): Promise<Album> {\n if (!MediaLibrary.getAlbumAsync) {\n throw new UnavailabilityError('MediaLibrary', 'getAlbumAsync');\n }\n if (typeof title !== 'string') {\n throw new Error('Album title must be a string!');\n }\n return await MediaLibrary.getAlbumAsync(title);\n}\n\n// @needsAudit\n/**\n * Creates an album with given name and initial asset. The asset parameter is required on Android,\n * since it's not possible to create empty album on this platform. On Android, by default it copies\n * given asset from the current album to the new one, however it's also possible to move it by\n * passing `false` as `copyAsset` argument.\n * In case it's copied you should keep in mind that `getAssetsAsync` will return duplicated asset.\n * @param albumName Name of the album to create.\n * @param asset An [Asset](#asset) or its ID (required on Android).\n * @param copyAsset __Android Only.__ Whether to copy asset to the new album instead of move it.\n * Defaults to `true`.\n * @return Newly created [`Album`](#album).\n */\nexport async function createAlbumAsync(\n albumName: string,\n asset?: AssetRef,\n copyAsset: boolean = true\n): Promise<Album> {\n if (!MediaLibrary.createAlbumAsync) {\n throw new UnavailabilityError('MediaLibrary', 'createAlbumAsync');\n }\n\n const assetId = getId(asset);\n\n if (Platform.OS === 'android' && (typeof assetId !== 'string' || assetId.length === 0)) {\n // it's not possible to create empty album on Android, so initial asset must be provided\n throw new Error('MediaLibrary.createAlbumAsync must be called with an asset on Android.');\n }\n if (!albumName || typeof albumName !== 'string') {\n throw new Error('Invalid argument \"albumName\". It must be a string!');\n }\n if (assetId != null && typeof assetId !== 'string') {\n throw new Error('Asset ID must be a string!');\n }\n\n if (Platform.OS === 'ios') {\n return await MediaLibrary.createAlbumAsync(albumName, assetId);\n }\n return await MediaLibrary.createAlbumAsync(albumName, assetId, !!copyAsset);\n}\n\n// @needsAudit\n/**\n * Deletes given albums from the library. On Android by default it deletes assets belonging to given\n * albums from the library. On iOS it doesn't delete these assets, however it's possible to do by\n * passing `true` as `deleteAssets`.\n * @param albums An array of [`Album`](#asset)s or their IDs.\n * @param assetRemove __iOS Only.__ Whether to also delete assets belonging to given albums.\n * Defaults to `false`.\n * @return Returns a promise which fulfils with `true` if the albums were successfully deleted from\n * the library.\n */\nexport async function deleteAlbumsAsync(\n albums: AlbumRef[] | AlbumRef,\n assetRemove: boolean = false\n): Promise<boolean> {\n if (!MediaLibrary.deleteAlbumsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'deleteAlbumsAsync');\n }\n\n const albumIds = arrayize(albums).map(getId);\n\n checkAlbumIds(albumIds);\n if (Platform.OS === 'android') {\n return await MediaLibrary.deleteAlbumsAsync(albumIds);\n }\n return await MediaLibrary.deleteAlbumsAsync(albumIds, !!assetRemove);\n}\n\n// @needsAudit\n/**\n * Fetches a page of assets matching the provided criteria.\n * @param assetsOptions\n * @return A promise that fulfils with to [`PagedInfo`](#pagedinfo) object with array of [`Asset`](#asset)s.\n */\nexport async function getAssetsAsync(assetsOptions: AssetsOptions = {}): Promise<PagedInfo<Asset>> {\n if (!MediaLibrary.getAssetsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'getAssetsAsync');\n }\n\n const { first, after, album, sortBy, mediaType, createdAfter, createdBefore } = assetsOptions;\n\n const options = {\n first: first == null ? 20 : first,\n after: getId(after),\n album: getId(album),\n sortBy: arrayize(sortBy),\n mediaType: arrayize(mediaType || [MediaType.photo]),\n createdAfter: dateToNumber(createdAfter),\n createdBefore: dateToNumber(createdBefore),\n };\n\n if (first != null && typeof options.first !== 'number') {\n throw new Error('Option \"first\" must be a number!');\n }\n if (after != null && typeof options.after !== 'string') {\n throw new Error('Option \"after\" must be a string!');\n }\n if (album != null && typeof options.album !== 'string') {\n throw new Error('Option \"album\" must be a string!');\n }\n if (after != null && Platform.OS === 'android' && isNaN(parseInt(getId(after) as string, 10))) {\n throw new Error('Option \"after\" must be a valid ID!');\n }\n if (first != null && first < 0) {\n throw new Error('Option \"first\" must be a positive integer!');\n }\n\n options.mediaType.forEach(checkMediaType);\n // TODO(@kitten): Add expected native types for `MediaLibrary`\n return await MediaLibrary.getAssetsAsync({\n ...options,\n sortBy: options.sortBy.map(sortByOptionToString),\n });\n}\n\n// @needsAudit\n/**\n * Subscribes for updates in user's media library.\n * @param listener A callback that is fired when any assets have been inserted or deleted from the\n * library. On Android it's invoked with an empty object. On iOS, it's invoked with [`MediaLibraryAssetsChangeEvent`](#medialibraryassetschangeevent)\n * object.\n *\n * Additionally, only on iOS, the listener is also invoked when the user changes access to individual assets in the media library\n * using `presentPermissionsPickerAsync()`.\n * @return An [`Subscription`](#subscription) object that you can call `remove()` on when you would\n * like to unsubscribe the listener.\n */\nexport function addListener(\n listener: (event: MediaLibraryAssetsChangeEvent) => void\n): EventSubscription {\n return MediaLibrary.addListener(MediaLibrary.CHANGE_LISTENER_NAME, listener);\n}\n\n// @docsMissing\nexport function removeSubscription(subscription: EventSubscription): void {\n subscription.remove();\n}\n\n// @needsAudit\n/**\n * Removes all listeners.\n */\nexport function removeAllListeners(): void {\n MediaLibrary.removeAllListeners(MediaLibrary.CHANGE_LISTENER_NAME);\n}\n\n// @needsAudit\n/**\n * Fetches a list of moments, which is a group of assets taken around the same place\n * and time.\n * @return An array of [albums](#album) whose type is `moment`.\n * @platform ios\n */\nexport async function getMomentsAsync() {\n if (!MediaLibrary.getMomentsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'getMomentsAsync');\n }\n\n return await MediaLibrary.getMomentsAsync();\n}\n\n// @needsAudit\n/**\n * Moves album content to the special media directories on **Android R** or **above** if needed.\n * Those new locations are in line with the Android `scoped storage` - so your application won't\n * lose write permission to those directories in the future.\n *\n * This method does nothing if:\n * - app is running on **iOS**, **web** or **Android below R**\n * - app has **write permission** to the album folder\n *\n * The migration is possible when the album contains only compatible files types.\n * For instance, movies and pictures are compatible with each other, but music and pictures are not.\n * If automatic migration isn't possible, the function rejects.\n * In that case, you can use methods from the `expo-file-system` to migrate all your files manually.\n *\n * # Why do you need to migrate files?\n * __Android R__ introduced a lot of changes in the storage system. Now applications can't save\n * anything to the root directory. The only available locations are from the `MediaStore` API.\n * Unfortunately, the media library stored albums in folders for which, because of those changes,\n * the application doesn't have permissions anymore. However, it doesn't mean you need to migrate\n * all your albums. If your application doesn't add assets to albums, you don't have to migrate.\n * Everything will work as it used to. You can read more about scoped storage in [the Android documentation](https://developer.android.com/about/versions/11/privacy/storage).\n *\n * @param album An [Album](#album) or its ID.\n * @return A promise which fulfils to `void`.\n */\nexport async function migrateAlbumIfNeededAsync(album: AlbumRef): Promise<void> {\n if (!MediaLibrary.migrateAlbumIfNeededAsync) {\n return;\n }\n\n return await MediaLibrary.migrateAlbumIfNeededAsync(getId(album));\n}\n\n// @needsAudit\n/**\n * Checks if the album should be migrated to a different location. In other words, it checks if the\n * application has the write permission to the album folder. If not, it returns `true`, otherwise `false`.\n * > Note: For **Android below R**, **web** or **iOS**, this function always returns `false`.\n * @param album An [Album](#album) or its ID.\n * @return Returns a promise which fulfils with `true` if the album should be migrated.\n */\nexport async function albumNeedsMigrationAsync(album: AlbumRef): Promise<boolean> {\n if (!MediaLibrary.albumNeedsMigrationAsync) {\n return false;\n }\n\n return await MediaLibrary.albumNeedsMigrationAs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se as EXPermissionResponse,\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n createPermissionHook,\n UnavailabilityError,\n EventSubscription,\n} from 'expo-modules-core';\nimport { Platform } from 'react-native';\n\nimport MediaLibrary from './ExpoMediaLibrary';\n\nconst isExpoGo = typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo;\n\nlet loggedExpoGoWarning = false;\n\nif (isExpoGo && !loggedExpoGoWarning) {\n console.warn(\n 'Due to changes in Androids permission requirements, Expo Go can no longer provide full access to the media library. To test the full functionality of this module, you can create a development build. https://docs.expo.dev/develop/development-builds/create-a-build'\n );\n loggedExpoGoWarning = true;\n}\n\n// @needsAudit\nexport type PermissionResponse = EXPermissionResponse & {\n /**\n * Indicates if your app has access to the whole or only part of the photo library. Possible values are:\n * - `'all'` if the user granted your app access to the whole photo library\n * - `'limited'` if the user granted your app access only to selected photos (only available on Android API 14+ and iOS 14.0+)\n * - `'none'` if user denied or hasn't yet granted the permission\n */\n accessPrivileges?: 'all' | 'limited' | 'none';\n};\n\n/**\n * Determines the type of media that the app will ask the OS to get access to.\n * @platform android 13+\n */\nexport type GranularPermission = 'audio' | 'photo' | 'video';\n\nexport type MediaTypeValue = 'audio' | 'photo' | 'video' | 'unknown' | 'pairedVideo';\n\n/**\n * Represents the possible types of media that the app will ask the OS to get access to when calling [`presentPermissionsPickerAsync()`](#medialibrarypresentpermissionspickerasyncmediatypes).\n * @platform android 14+\n * */\nexport type MediaTypeFilter = 'photo' | 'video';\n\nexport type SortByKey =\n | 'default'\n | 'mediaType'\n | 'width'\n | 'height'\n | 'creationTime'\n | 'modificationTime'\n | 'duration';\nexport type SortByValue = [SortByKey, boolean] | SortByKey;\n\ntype InternalSortByValue = `${SortByKey} ${'ASC' | 'DESC'}`;\n\nexport type MediaTypeObject = {\n audio: 'audio';\n photo: 'photo';\n video: 'video';\n unknown: 'unknown';\n};\n\nexport type SortByObject = {\n default: 'default';\n mediaType: 'mediaType';\n width: 'width';\n height: 'height';\n creationTime: 'creationTime';\n modificationTime: 'modificationTime';\n duration: 'duration';\n};\n\n// @needsAudit\nexport type Asset = {\n /**\n * Internal ID that represents an asset.\n */\n id: string;\n /**\n * Filename of the asset.\n */\n filename: string;\n /**\n * URI that points to the asset. `ph://*` (iOS), `file://*` (Android)\n */\n uri: string;\n /**\n * Media type.\n */\n mediaType: MediaTypeValue;\n /**\n * An array of media subtypes.\n * @platform ios\n */\n mediaSubtypes?: MediaSubtype[];\n /**\n * Width of the image or video.\n */\n width: number;\n /**\n * Height of the image or video.\n */\n height: number;\n /**\n * File creation timestamp.\n */\n creationTime: number;\n /**\n * Last modification timestamp.\n */\n modificationTime: number;\n /**\n * Duration of the video or audio asset in seconds.\n */\n duration: number;\n /**\n * Album ID that the asset belongs to.\n * @platform android\n */\n albumId?: string;\n};\n\n// @needsAudit\nexport type AssetInfo = Asset & {\n /**\n * Local URI for the asset.\n */\n localUri?: string;\n /**\n * GPS location if available.\n */\n location?: Location;\n /**\n * EXIF metadata associated with the image.\n */\n exif?: object;\n /**\n * Whether the asset is marked as favorite.\n * @platform ios\n */\n isFavorite?: boolean;\n /**\n * This field is available only if flag `shouldDownloadFromNetwork` is set to `false`.\n * Whether the asset is stored on the network (iCloud on iOS).\n * @platform ios\n */\n isNetworkAsset?: boolean; //iOS only\n /**\n * Display orientation of the image. Orientation is available only for assets whose\n * `mediaType` is `MediaType.photo`. Value will range from 1 to 8, see [EXIF orientation specification](http://sylvana.net/jpegcrop/exif_orientation.html)\n * for more details.\n * @platform ios\n */\n orientation?: number;\n /**\n * Contains information about the video paired with the image file.\n * This field is available if the `mediaType` is `\"photo\"`, and the `mediaSubtypes` includes `\"livePhoto\"`.\n * @platform ios\n */\n pairedVideoAsset?: Asset | null;\n};\n\n/**\n * Constants identifying specific variations of asset media, such as panorama or screenshot photos,\n * and time-lapse or high-frame-rate video. Maps to [these values](https://developer.apple.com/documentation/photokit/phassetmediasubtype#1603888).\n * */\nexport type MediaSubtype =\n | 'depthEffect'\n | 'hdr'\n | 'highFrameRate'\n | 'livePhoto'\n | 'panorama'\n | 'screenshot'\n | 'stream'\n | 'timelapse';\n\n// @needsAudit\nexport type MediaLibraryAssetInfoQueryOptions = {\n /**\n * Whether allow the asset to be downloaded from network. Only available in iOS with iCloud assets.\n * @default true\n */\n shouldDownloadFromNetwork?: boolean;\n};\n\n// @needsAudit\nexport type MediaLibraryAssetsChangeEvent = {\n /**\n * Whether the media library's changes could be described as \"incremental changes\".\n * `true` indicates the changes are described by the `insertedAssets`, `deletedAssets` and\n * `updatedAssets` values. `false` indicates that the scope of changes is too large and you\n * should perform a full assets reload (eg. a user has changed access to individual assets in the\n * media library).\n */\n hasIncrementalChanges: boolean;\n /**\n * Available only if `hasIncrementalChanges` is `true`.\n * Array of [`Asset`](#asset)s that have been inserted to the library.\n */\n insertedAssets?: Asset[];\n /**\n * Available only if `hasIncrementalChanges` is `true`.\n * Array of [`Asset`](#asset)s that have been deleted from the library.\n */\n deletedAssets?: Asset[];\n /**\n * Available only if `hasIncrementalChanges` is `true`.\n * Array of [`Asset`](#asset)s that have been updated or completed downloading from network\n * storage (iCloud on iOS).\n */\n updatedAssets?: Asset[];\n};\n\n// @docsMissing\nexport type Location = {\n latitude: number;\n longitude: number;\n};\n\n// @needsAudit\nexport type Album = {\n /**\n * Album ID.\n */\n id: string;\n /**\n * Album title.\n */\n title: string;\n /**\n * Estimated number of assets in the album.\n */\n assetCount: number;\n /**\n * The type of the assets album.\n * @platform ios\n */\n type?: AlbumType;\n /**\n * Apply only to albums whose type is `'moment'`. Earliest creation timestamp of all\n * assets in the moment.\n * @platform ios\n */\n startTime: number;\n /**\n * Apply only to albums whose type is `'moment'`. Latest creation timestamp of all\n * assets in the moment.\n * @platform ios\n */\n endTime: number;\n /**\n * Apply only to albums whose type is `'moment'`. Approximated location of all\n * assets in the moment.\n * @platform ios\n */\n approximateLocation?: Location;\n /**\n * Apply only to albums whose type is `'moment'`. Names of locations grouped\n * in the moment.\n * @platform ios\n */\n locationNames?: string[];\n};\n\n// @docsMissing\nexport type AlbumType = 'album' | 'moment' | 'smartAlbum';\n\n// @docsMissing\nexport type AlbumsOptions = {\n includeSmartAlbums?: boolean;\n};\n\n// @needsAudit\nexport type AssetsOptions = {\n /**\n * The maximum number of items on a single page.\n * @default 20\n */\n first?: number;\n /**\n * Asset ID of the last item returned on the previous page. To get the ID of the next page,\n * pass [`endCursor`](#pagedinfo) as its value.\n */\n after?: AssetRef;\n /**\n * [Album](#album) or its ID to get assets from specific album.\n */\n album?: AlbumRef;\n /**\n * An array of [`SortByValue`](#sortbyvalue)s or a single `SortByValue` value. By default, all\n * keys are sorted in descending order, however you can also pass a pair `[key, ascending]` where\n * the second item is a `boolean` value that means whether to use ascending order. Note that if\n * the `SortBy.default` key is used, then `ascending` argument will not matter. Earlier items have\n * higher priority when sorting out the results.\n * If empty, this method uses the default sorting that is provided by the platform.\n */\n sortBy?: SortByValue[] | SortByValue;\n /**\n * An array of [MediaTypeValue](#mediatypevalue)s or a single `MediaTypeValue`.\n * @default MediaType.photo\n */\n mediaType?: MediaTypeValue[] | MediaTypeValue;\n /**\n * `Date` object or Unix timestamp in milliseconds limiting returned assets only to those that\n * were created after this date.\n */\n createdAfter?: Date | number;\n /**\n * Similarly as `createdAfter`, but limits assets only to those that were created before specified\n * date.\n */\n createdBefore?: Date | number;\n};\n\n// @needsAudit\nexport type PagedInfo<T> = {\n /**\n * A page of [`Asset`](#asset)s fetched by the query.\n */\n assets: T[];\n /**\n * ID of the last fetched asset. It should be passed as `after` option in order to get the\n * next page.\n */\n endCursor: string;\n /**\n * Whether there are more assets to fetch.\n */\n hasNextPage: boolean;\n /**\n * Estimated total number of assets that match the query.\n */\n totalCount: number;\n};\n\n// @docsMissing\nexport type AssetRef = Asset | string;\n\n// @docsMissing\nexport type AlbumRef = Album | string;\n\nexport {\n PermissionStatus,\n PermissionExpiration,\n EXPermissionResponse,\n PermissionHookOptions,\n EventSubscription as Subscription,\n};\n\nfunction arrayize<T>(item: T | T[]): T[] {\n if (Array.isArray(item)) {\n return item;\n }\n return item ? [item] : [];\n}\n\nfunction getId(ref: string | undefined | { id?: string }): string | undefined {\n if (typeof ref === 'string') {\n return ref;\n }\n return ref ? ref.id : undefined;\n}\n\nfunction checkAssetIds(assetIds: unknown[]): asserts assetIds is string[] {\n if (assetIds.some((id) => !id || typeof id !== 'string')) {\n throw new Error('Asset ID must be a string!');\n }\n}\n\nfunction checkAlbumIds(albumIds: unknown[]): asserts albumIds is string[] {\n if (albumIds.some((id) => !id || typeof id !== 'string')) {\n throw new Error('Album ID must be a string!');\n }\n}\n\nfunction checkMediaType(mediaType: unknown): asserts mediaType is keyof MediaTypeObject {\n if (Object.values(MediaType).indexOf(mediaType as any) === -1) {\n throw new Error(`Invalid mediaType: ${mediaType}`);\n }\n}\n\nfunction checkSortBy(sortBy: unknown): asserts sortBy is SortByValue {\n if (Array.isArray(sortBy)) {\n checkSortByKey(sortBy[0]);\n\n if (typeof sortBy[1] !== 'boolean') {\n throw new Error('Invalid sortBy array argument. Second item must be a boolean!');\n }\n } else {\n checkSortByKey(sortBy);\n }\n}\n\nfunction checkSortByKey(sortBy: any): void {\n if (Object.values(SortBy).indexOf(sortBy) === -1) {\n throw new Error(`Invalid sortBy key: ${sortBy}`);\n }\n}\n\nfunction sortByOptionToString(sortBy: SortByValue | undefined): InternalSortByValue {\n checkSortBy(sortBy);\n if (Array.isArray(sortBy)) {\n return `${sortBy[0]} ${sortBy[1] ? 'ASC' : 'DESC'}`;\n }\n return `${sortBy} DESC`;\n}\n\nfunction dateToNumber(value?: Date | number): number | undefined {\n return value instanceof Date ? value.getTime() : value;\n}\n\n// @needsAudit\n/**\n * Possible media types.\n */\nexport const MediaType: MediaTypeObject = MediaLibrary.MediaType;\n\n// @needsAudit\n/**\n * Supported keys that can be used to sort `getAssetsAsync` results.\n */\nexport const SortBy: SortByObject = MediaLibrary.SortBy;\n\n// @needsAudit\n/**\n * Returns whether the Media Library API is enabled on the current device.\n * @return A promise which fulfils with a `boolean`, indicating whether the Media Library API is\n * available on the current device.\n */\nexport async function isAvailableAsync(): Promise<boolean> {\n return !!MediaLibrary && 'getAssetsAsync' in MediaLibrary;\n}\n\n// @needsAudit @docsMissing\n/**\n * Asks the user to grant permissions for accessing media in user's media library.\n * @param writeOnly\n * @param granularPermissions - A list of [`GranularPermission`](#granularpermission) values. This parameter has an\n * effect only on Android 13 and newer. By default, `expo-media-library` will ask for all possible permissions.\n * @return A promise that fulfils with [`PermissionResponse`](#permissionresponse) object.\n */\nexport async function requestPermissionsAsync(\n writeOnly: boolean = false,\n granularPermissions?: GranularPermission[]\n): Promise<PermissionResponse> {\n if (!MediaLibrary.requestPermissionsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'requestPermissionsAsync');\n }\n if (Platform.OS === 'android') {\n return await MediaLibrary.requestPermissionsAsync(writeOnly, granularPermissions);\n }\n return await MediaLibrary.requestPermissionsAsync(writeOnly);\n}\n\n// @needsAudit @docsMissing\n/**\n * Checks user's permissions for accessing media library.\n * @param writeOnly\n * @param granularPermissions - A list of [`GranularPermission`](#granularpermission) values. This parameter has\n * an effect only on Android 13 and newer. By default, `expo-media-library` will ask for all possible permissions.\n * @return A promise that fulfils with [`PermissionResponse`](#permissionresponse) object.\n */\nexport async function getPermissionsAsync(\n writeOnly: boolean = false,\n granularPermissions?: GranularPermission[]\n): Promise<PermissionResponse> {\n if (!MediaLibrary.getPermissionsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'getPermissionsAsync');\n }\n if (Platform.OS === 'android') {\n return await MediaLibrary.getPermissionsAsync(writeOnly, granularPermissions);\n }\n return await MediaLibrary.getPermissionsAsync(writeOnly);\n}\n\n// @needsAudit\n/**\n * Check or request permissions to access the media library.\n * This uses both `requestPermissionsAsync` and `getPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [permissionResponse, requestPermission] = MediaLibrary.usePermissions();\n * ```\n */\nexport const usePermissions = createPermissionHook<\n PermissionResponse,\n { writeOnly?: boolean; granularPermissions?: GranularPermission[] }\n>({\n // TODO(cedric): permission requesters should have an options param or a different requester\n getMethod: (options) => getPermissionsAsync(options?.writeOnly, options?.granularPermissions),\n requestMethod: (options) =>\n requestPermissionsAsync(options?.writeOnly, options?.granularPermissions),\n});\n\n// @needsAudit\n/**\n * Allows the user to update the assets that your app has access to.\n * The system modal is only displayed if the user originally allowed only `limited` access to their\n * media library, otherwise this method is a no-op.\n * @param mediaTypes Limits the type(s) of media that the user will be granting access to. By default, a list that shows both photos and videos is presented.\n *\n * @return A promise that either rejects if the method is unavailable, or resolves to `void`.\n * > __Note:__ This method doesn't inform you if the user changes which assets your app has access to.\n * That information is only exposed by iOS, and to obtain it, you need to subscribe for updates to the user's media library using [`addListener()`](#medialibraryaddlistenerlistener).\n * If `hasIncrementalChanges` is `false`, the user changed their permissions.\n *\n * @platform android 14+\n * @platform ios\n */\nexport async function presentPermissionsPickerAsync(\n mediaTypes: MediaTypeFilter[] = ['photo', 'video']\n): Promise<void> {\n if (Platform.OS === 'android' && isExpoGo) {\n throw new UnavailabilityError(\n 'MediaLibrary',\n 'presentPermissionsPickerAsync is unavailable in Expo Go'\n );\n }\n if (Platform.OS === 'android' && Platform.Version >= 34) {\n await MediaLibrary.requestPermissionsAsync(false, mediaTypes);\n return;\n }\n if (!MediaLibrary.presentPermissionsPickerAsync) {\n throw new UnavailabilityError('MediaLibrary', 'presentPermissionsPickerAsync');\n }\n return await MediaLibrary.presentPermissionsPickerAsync();\n}\n\n// @needsAudit\n/**\n * Creates an asset from existing file. The most common use case is to save a picture taken by [Camera](./camera).\n * This method requires `CAMERA_ROLL` permission.\n *\n * @example\n * ```js\n * const { uri } = await Camera.takePictureAsync();\n * const asset = await MediaLibrary.createAssetAsync(uri);\n * ```\n * @param localUri A URI to the image or video file. It must contain an extension. On Android it\n * must be a local path, so it must start with `file:///`\n *\n * @param album An [Album](#album) or its ID. If provided, the asset will be added to this album upon creation, otherwise it will be added to the default album for the media type.\n * The album has exist.\n * @return A promise which fulfils with an object representing an [`Asset`](#asset).\n */\nexport async function createAssetAsync(localUri: string, album?: AlbumRef): Promise<Asset> {\n if (!MediaLibrary.createAssetAsync) {\n throw new UnavailabilityError('MediaLibrary', 'createAssetAsync');\n }\n\n const albumId = getId(album);\n\n if (!localUri || typeof localUri !== 'string') {\n throw new Error('Invalid argument \"localUri\". It must be a string!');\n }\n const asset = await MediaLibrary.createAssetAsync(localUri, albumId);\n\n if (Array.isArray(asset)) {\n // Android returns an array with asset, we need to pick the first item\n return asset[0];\n }\n return asset;\n}\n\n// @needsAudit\n/**\n * Saves the file at given `localUri` to the user's media library. Unlike [`createAssetAsync()`](#medialibrarycreateassetasynclocaluri),\n * This method doesn't return created asset.\n * On __iOS 11+__, it's possible to use this method without asking for `CAMERA_ROLL` permission,\n * however then yours `Info.plist` should have `NSPhotoLibraryAddUsageDescription` key.\n * @param localUri A URI to the image or video file. It must contain an extension. On Android it\n * must be a local path, so it must start with `file:///`.\n */\nexport async function saveToLibraryAsync(localUri: string): Promise<void> {\n if (!MediaLibrary.saveToLibraryAsync) {\n throw new UnavailabilityError('MediaLibrary', 'saveToLibraryAsync');\n }\n return await MediaLibrary.saveToLibraryAsync(localUri);\n}\n\n// @needsAudit\n/**\n * Adds array of assets to the album.\n *\n * On Android, by default it copies assets from the current album to provided one, however it's also\n * possible to move them by passing `false` as `copyAssets` argument. In case they're copied you\n * should keep in mind that `getAssetsAsync` will return duplicated assets.\n * @param assets An array of [Asset](#asset) or their IDs.\n * @param album An [Album](#album) or its ID.\n * @param copy __Android only.__ Whether to copy assets to the new album instead of move them.\n * Defaults to `true`.\n * @return Returns promise which fulfils with `true` if the assets were successfully added to\n * the album.\n */\nexport async function addAssetsToAlbumAsync(\n assets: AssetRef[] | AssetRef,\n album: AlbumRef,\n copy: boolean = true\n): Promise<boolean> {\n if (!MediaLibrary.addAssetsToAlbumAsync) {\n throw new UnavailabilityError('MediaLibrary', 'addAssetsToAlbumAsync');\n }\n\n const assetIds = arrayize(assets).map(getId);\n const albumId = getId(album);\n\n checkAssetIds(assetIds);\n\n if (!albumId || typeof albumId !== 'string') {\n throw new Error('Invalid album ID. It must be a string!');\n }\n\n if (Platform.OS === 'ios') {\n return await MediaLibrary.addAssetsToAlbumAsync(assetIds, albumId);\n }\n return await MediaLibrary.addAssetsToAlbumAsync(assetIds, albumId, !!copy);\n}\n\n// @needsAudit\n/**\n * Removes given assets from album.\n *\n * On Android, album will be automatically deleted if there are no more assets inside.\n * @param assets An array of [Asset](#asset) or their IDs.\n * @param album An [Album](#album) or its ID.\n * @return Returns promise which fulfils with `true` if the assets were successfully removed from\n * the album.\n */\nexport async function removeAssetsFromAlbumAsync(\n assets: AssetRef[] | AssetRef,\n album: AlbumRef\n): Promise<boolean> {\n if (!MediaLibrary.removeAssetsFromAlbumAsync) {\n throw new UnavailabilityError('MediaLibrary', 'removeAssetsFromAlbumAsync');\n }\n\n const assetIds = arrayize(assets).map(getId);\n const albumId = getId(album);\n\n checkAssetIds(assetIds);\n return await MediaLibrary.removeAssetsFromAlbumAsync(assetIds, albumId);\n}\n\n// @needsAudit\n/**\n * Deletes assets from the library. On iOS it deletes assets from all albums they belong to, while\n * on Android it keeps all copies of them (album is strictly connected to the asset). Also, there is\n * additional dialog on iOS that requires user to confirm this action.\n * @param assets An array of [Asset](#asset) or their IDs.\n * @return Returns promise which fulfils with `true` if the assets were successfully deleted.\n */\nexport async function deleteAssetsAsync(assets: AssetRef[] | AssetRef): Promise<boolean> {\n if (!MediaLibrary.deleteAssetsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'deleteAssetsAsync');\n }\n\n const assetIds = arrayize(assets).map(getId);\n\n checkAssetIds(assetIds);\n return await MediaLibrary.deleteAssetsAsync(assetIds);\n}\n\n// @needsAudit\n/**\n * Provides more information about an asset, including GPS location, local URI and EXIF metadata.\n * @param asset An [Asset](#asset) or its ID.\n * @param options\n * @return An [AssetInfo](#assetinfo) object, which is an `Asset` extended by an additional fields.\n */\nexport async function getAssetInfoAsync(\n asset: AssetRef,\n options: MediaLibraryAssetInfoQueryOptions = { shouldDownloadFromNetwork: true }\n): Promise<AssetInfo> {\n if (!MediaLibrary.getAssetInfoAsync) {\n throw new UnavailabilityError('MediaLibrary', 'getAssetInfoAsync');\n }\n\n const assetId = getId(asset);\n\n checkAssetIds([assetId]);\n\n const assetInfo = await MediaLibrary.getAssetInfoAsync(assetId, options);\n\n if (Array.isArray(assetInfo)) {\n // Android returns an array with asset info, we need to pick the first item\n return assetInfo[0];\n }\n return assetInfo;\n}\n\n// @needsAudit\n/**\n * Queries for user-created albums in media gallery.\n * @return A promise which fulfils with an array of [`Album`](#asset)s. Depending on Android version,\n * root directory of your storage may be listed as album titled `\"0\"` or unlisted at all.\n */\nexport async function getAlbumsAsync({ includeSmartAlbums = false }: AlbumsOptions = {}): Promise<\n Album[]\n> {\n if (!MediaLibrary.getAlbumsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'getAlbumsAsync');\n }\n return await MediaLibrary.getAlbumsAsync({ includeSmartAlbums });\n}\n\n// @needsAudit\n/**\n * Queries for an album with a specific name.\n * @param title Name of the album to look for.\n * @return An object representing an [`Album`](#album), if album with given name exists, otherwise\n * returns `null`.\n */\nexport async function getAlbumAsync(title: string): Promise<Album> {\n if (!MediaLibrary.getAlbumAsync) {\n throw new UnavailabilityError('MediaLibrary', 'getAlbumAsync');\n }\n if (typeof title !== 'string') {\n throw new Error('Album title must be a string!');\n }\n return await MediaLibrary.getAlbumAsync(title);\n}\n\n// @needsAudit\n/**\n * Creates an album with given name and initial asset. The asset parameter is required on Android,\n * since it's not possible to create empty album on this platform. On Android, by default it copies\n * given asset from the current album to the new one, however it's also possible to move it by\n * passing `false` as `copyAsset` argument.\n * In case it's copied you should keep in mind that `getAssetsAsync` will return duplicated asset.\n * > On Android, it's not possible to create an empty album. You must provide an existing asset to copy or move into the album or an uri of a local file, which will be used to create an initial asset for the album.\n * @param albumName Name of the album to create.\n * @param asset An [Asset](#asset) or its ID. On Android you either need to provide an asset or a localUri.\n * @param initialAssetLocalUri A URI to the local media file, which will be used to create the initial asset inside the album. It must contain an extension. On Android it\n * must be a local path, so it must start with `file:///`. If the `asset` was provided, this parameter will be ignored.\n * @param copyAsset __Android Only.__ Whether to copy asset to the new album instead of move it. This parameter is ignored if `asset` was not provided.\n * Defaults to `true`.\n * @return Newly created [`Album`](#album).\n */\nexport async function createAlbumAsync(\n albumName: string,\n asset?: AssetRef,\n copyAsset: boolean = true,\n initialAssetLocalUri?: string\n): Promise<Album> {\n if (!MediaLibrary.createAlbumAsync) {\n throw new UnavailabilityError('MediaLibrary', 'createAlbumAsync');\n }\n\n const assetId = getId(asset);\n\n if (\n Platform.OS === 'android' &&\n (typeof assetId !== 'string' || assetId.length === 0) &&\n !initialAssetLocalUri\n ) {\n // it's not possible to create empty album on Android, so initial asset must be provided\n throw new Error(\n 'MediaLibrary.createAlbumAsync must be called with an asset or a localUri on Android.'\n );\n }\n if (!albumName || typeof albumName !== 'string') {\n throw new Error('Invalid argument \"albumName\". It must be a string!');\n }\n if (assetId != null && typeof assetId !== 'string') {\n throw new Error('Asset ID must be a string!');\n }\n\n if (Platform.OS === 'ios') {\n return await MediaLibrary.createAlbumAsync(albumName, assetId, initialAssetLocalUri);\n }\n return await MediaLibrary.createAlbumAsync(albumName, assetId, !!copyAsset, initialAssetLocalUri);\n}\n\n// @needsAudit\n/**\n * Deletes given albums from the library. On Android by default it deletes assets belonging to given\n * albums from the library. On iOS it doesn't delete these assets, however it's possible to do by\n * passing `true` as `deleteAssets`.\n * @param albums An array of [`Album`](#asset)s or their IDs.\n * @param assetRemove __iOS Only.__ Whether to also delete assets belonging to given albums.\n * Defaults to `false`.\n * @return Returns a promise which fulfils with `true` if the albums were successfully deleted from\n * the library.\n */\nexport async function deleteAlbumsAsync(\n albums: AlbumRef[] | AlbumRef,\n assetRemove: boolean = false\n): Promise<boolean> {\n if (!MediaLibrary.deleteAlbumsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'deleteAlbumsAsync');\n }\n\n const albumIds = arrayize(albums).map(getId);\n\n checkAlbumIds(albumIds);\n if (Platform.OS === 'android') {\n return await MediaLibrary.deleteAlbumsAsync(albumIds);\n }\n return await MediaLibrary.deleteAlbumsAsync(albumIds, !!assetRemove);\n}\n\n// @needsAudit\n/**\n * Fetches a page of assets matching the provided criteria.\n * @param assetsOptions\n * @return A promise that fulfils with to [`PagedInfo`](#pagedinfo) object with array of [`Asset`](#asset)s.\n */\nexport async function getAssetsAsync(assetsOptions: AssetsOptions = {}): Promise<PagedInfo<Asset>> {\n if (!MediaLibrary.getAssetsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'getAssetsAsync');\n }\n\n const { first, after, album, sortBy, mediaType, createdAfter, createdBefore } = assetsOptions;\n\n const options = {\n first: first == null ? 20 : first,\n after: getId(after),\n album: getId(album),\n sortBy: arrayize(sortBy),\n mediaType: arrayize(mediaType || [MediaType.photo]),\n createdAfter: dateToNumber(createdAfter),\n createdBefore: dateToNumber(createdBefore),\n };\n\n if (first != null && typeof options.first !== 'number') {\n throw new Error('Option \"first\" must be a number!');\n }\n if (after != null && typeof options.after !== 'string') {\n throw new Error('Option \"after\" must be a string!');\n }\n if (album != null && typeof options.album !== 'string') {\n throw new Error('Option \"album\" must be a string!');\n }\n if (after != null && Platform.OS === 'android' && isNaN(parseInt(getId(after) as string, 10))) {\n throw new Error('Option \"after\" must be a valid ID!');\n }\n if (first != null && first < 0) {\n throw new Error('Option \"first\" must be a positive integer!');\n }\n\n options.mediaType.forEach(checkMediaType);\n // TODO(@kitten): Add expected native types for `MediaLibrary`\n return await MediaLibrary.getAssetsAsync({\n ...options,\n sortBy: options.sortBy.map(sortByOptionToString),\n });\n}\n\n// @needsAudit\n/**\n * Subscribes for updates in user's media library.\n * @param listener A callback that is fired when any assets have been inserted or deleted from the\n * library. On Android it's invoked with an empty object. On iOS, it's invoked with [`MediaLibraryAssetsChangeEvent`](#medialibraryassetschangeevent)\n * object.\n *\n * Additionally, only on iOS, the listener is also invoked when the user changes access to individual assets in the media library\n * using `presentPermissionsPickerAsync()`.\n * @return An [`Subscription`](#subscription) object that you can call `remove()` on when you would\n * like to unsubscribe the listener.\n */\nexport function addListener(\n listener: (event: MediaLibraryAssetsChangeEvent) => void\n): EventSubscription {\n return MediaLibrary.addListener(MediaLibrary.CHANGE_LISTENER_NAME, listener);\n}\n\n// @docsMissing\nexport function removeSubscription(subscription: EventSubscription): void {\n subscription.remove();\n}\n\n// @needsAudit\n/**\n * Removes all listeners.\n */\nexport function removeAllListeners(): void {\n MediaLibrary.removeAllListeners(MediaLibrary.CHANGE_LISTENER_NAME);\n}\n\n// @needsAudit\n/**\n * Fetches a list of moments, which is a group of assets taken around the same place\n * and time.\n * @return An array of [albums](#album) whose type is `moment`.\n * @platform ios\n */\nexport async function getMomentsAsync() {\n if (!MediaLibrary.getMomentsAsync) {\n throw new UnavailabilityError('MediaLibrary', 'getMomentsAsync');\n }\n\n return await MediaLibrary.getMomentsAsync();\n}\n\n// @needsAudit\n/**\n * Moves album content to the special media directories on **Android R** or **above** if needed.\n * Those new locations are in line with the Android `scoped storage` - so your application won't\n * lose write permission to those directories in the future.\n *\n * This method does nothing if:\n * - app is running on **iOS**, **web** or **Android below R**\n * - app has **write permission** to the album folder\n *\n * The migration is possible when the album contains only compatible files types.\n * For instance, movies and pictures are compatible with each other, but music and pictures are not.\n * If automatic migration isn't possible, the function rejects.\n * In that case, you can use methods from the `expo-file-system` to migrate all your files manually.\n *\n * # Why do you need to migrate files?\n * __Android R__ introduced a lot of changes in the storage system. Now applications can't save\n * anything to the root directory. The only available locations are from the `MediaStore` API.\n * Unfortunately, the media library stored albums in folders for which, because of those changes,\n * the application doesn't have permissions anymore. However, it doesn't mean you need to migrate\n * all your albums. If your application doesn't add assets to albums, you don't have to migrate.\n * Everything will work as it used to. You can read more about scoped storage in [the Android documentation](https://developer.android.com/about/versions/11/privacy/storage).\n *\n * @param album An [Album](#album) or its ID.\n * @return A promise which fulfils to `void`.\n */\nexport async function migrateAlbumIfNeededAsync(album: AlbumRef): Promise<void> {\n if (!MediaLibrary.migrateAlbumIfNeededAsync) {\n return;\n }\n\n return await MediaLibrary.migrateAlbumIfNeededAsync(getId(album));\n}\n\n// @needsAudit\n/**\n * Checks if the album should be migrated to a different location. In other words, it checks if the\n * application has the write permission to the album folder. If not, it returns `true`, otherwise `false`.\n * > Note: For **Android below R**, **web** or **iOS**, this function always returns `false`.\n * @param album An [Album](#album) or its ID.\n * @return Returns a promise which fulfils with `true` if the album should be migrated.\n */\nexport async function albumNeedsMigrationAsync(album: AlbumRef): Promise<boolean> {\n if (!MediaLibrary.albumNeedsMigrationAsync) {\n return false;\n }\n\n return await MediaLibrary.albumNeedsMigrationAsync(getId(album));\n}\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -243,23 +243,46 @@ public class MediaLibraryModule: Module, PhotoLibraryObserverHandler {
|
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
AsyncFunction("createAlbumAsync") { (title: String, assetId: String?, promise: Promise) in
|
|
246
|
+
AsyncFunction("createAlbumAsync") { (title: String, assetId: String?, initialAssetUri: URL?, promise: Promise) in
|
|
247
247
|
runIfAllPermissionsWereGranted(reject: promise.legacyRejecter) {
|
|
248
|
-
createAlbum(with: title) { collection, createError in
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
248
|
+
createAlbum(with: title) { [weak self] collection, createError in
|
|
249
|
+
guard let collection else {
|
|
250
|
+
promise.reject(CreateAlbumFailedException(createError))
|
|
251
|
+
return
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if assetId == nil && initialAssetUri == nil {
|
|
255
|
+
promise.resolve(exportCollection(collection))
|
|
256
|
+
return
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if let assetId {
|
|
260
|
+
addAssets(ids: [assetId], to: collection.localIdentifier) { success, addError in
|
|
261
|
+
if success {
|
|
262
|
+
promise.resolve(exportCollection(collection))
|
|
263
|
+
} else {
|
|
264
|
+
promise.reject(FailedToAddAssetException(addError))
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if let initialAssetUri {
|
|
271
|
+
createAsset(uri: initialAssetUri, appContext: self?.appContext) { asset, error in
|
|
272
|
+
if let error {
|
|
273
|
+
promise.reject(error)
|
|
274
|
+
return
|
|
275
|
+
}
|
|
276
|
+
if let asset {
|
|
277
|
+
addAssets(ids: [asset.localIdentifier], to: collection.localIdentifier) { success, addError in
|
|
278
|
+
if success {
|
|
279
|
+
promise.resolve(exportCollection(collection))
|
|
280
|
+
} else {
|
|
281
|
+
promise.reject(FailedToAddAssetException(addError))
|
|
282
|
+
}
|
|
256
283
|
}
|
|
257
284
|
}
|
|
258
|
-
} else {
|
|
259
|
-
promise.resolve(exportCollection(collection))
|
|
260
285
|
}
|
|
261
|
-
} else {
|
|
262
|
-
promise.reject(CreateAlbumFailedException(createError))
|
|
263
286
|
}
|
|
264
287
|
}
|
|
265
288
|
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b2d8bacb5f732b5aaed1d54ac8c3da1a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0b54d105bca4a251a1c2d4b73cbf339ad76911fa
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
6549ee6e5b7c4879b2b684b029e5dac80df460b9b37de33577e1ede17be14b1f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e25288a07185f860f73217c6dd9e1eff89379c6f469c09e4db4df734dc31cf8bb586fab6c1fa13b34b865bf50757190e8f873372170ec81e49f8bad936387a7c
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3eda399040f4d0fe9538f8c038278d27
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
c503f0093a49014aebe7cc631fca05c4ce46d8fc
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
711a8211758c1587dc30af3d563dd26914645d088092516b33a468d4aa3767cc
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f6622ba09522d1f2a0832400e550b4db8bdec3805b37b9782bca629e90991bd71982167acad7330d1818039adc00d4682bc40f62d39e4c82d0107d1f5e1fc831
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.medialibrary",
|
|
6
|
-
"version": "17.1.
|
|
6
|
+
"version": "17.1.3",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
],
|
|
34
34
|
"files": [
|
|
35
35
|
{
|
|
36
|
-
"name": "expo.modules.medialibrary-17.1.
|
|
37
|
-
"url": "expo.modules.medialibrary-17.1.
|
|
38
|
-
"size":
|
|
39
|
-
"sha512": "
|
|
40
|
-
"sha256": "
|
|
41
|
-
"sha1": "
|
|
42
|
-
"md5": "
|
|
36
|
+
"name": "expo.modules.medialibrary-17.1.3.aar",
|
|
37
|
+
"url": "expo.modules.medialibrary-17.1.3.aar",
|
|
38
|
+
"size": 204645,
|
|
39
|
+
"sha512": "f6622ba09522d1f2a0832400e550b4db8bdec3805b37b9782bca629e90991bd71982167acad7330d1818039adc00d4682bc40f62d39e4c82d0107d1f5e1fc831",
|
|
40
|
+
"sha256": "711a8211758c1587dc30af3d563dd26914645d088092516b33a468d4aa3767cc",
|
|
41
|
+
"sha1": "c503f0093a49014aebe7cc631fca05c4ce46d8fc",
|
|
42
|
+
"md5": "3eda399040f4d0fe9538f8c038278d27"
|
|
43
43
|
}
|
|
44
44
|
]
|
|
45
45
|
},
|
|
@@ -76,13 +76,13 @@
|
|
|
76
76
|
],
|
|
77
77
|
"files": [
|
|
78
78
|
{
|
|
79
|
-
"name": "expo.modules.medialibrary-17.1.
|
|
80
|
-
"url": "expo.modules.medialibrary-17.1.
|
|
81
|
-
"size":
|
|
82
|
-
"sha512": "
|
|
83
|
-
"sha256": "
|
|
84
|
-
"sha1": "
|
|
85
|
-
"md5": "
|
|
79
|
+
"name": "expo.modules.medialibrary-17.1.3.aar",
|
|
80
|
+
"url": "expo.modules.medialibrary-17.1.3.aar",
|
|
81
|
+
"size": 204645,
|
|
82
|
+
"sha512": "f6622ba09522d1f2a0832400e550b4db8bdec3805b37b9782bca629e90991bd71982167acad7330d1818039adc00d4682bc40f62d39e4c82d0107d1f5e1fc831",
|
|
83
|
+
"sha256": "711a8211758c1587dc30af3d563dd26914645d088092516b33a468d4aa3767cc",
|
|
84
|
+
"sha1": "c503f0093a49014aebe7cc631fca05c4ce46d8fc",
|
|
85
|
+
"md5": "3eda399040f4d0fe9538f8c038278d27"
|
|
86
86
|
}
|
|
87
87
|
]
|
|
88
88
|
},
|
|
@@ -96,13 +96,13 @@
|
|
|
96
96
|
},
|
|
97
97
|
"files": [
|
|
98
98
|
{
|
|
99
|
-
"name": "expo.modules.medialibrary-17.1.
|
|
100
|
-
"url": "expo.modules.medialibrary-17.1.
|
|
101
|
-
"size":
|
|
102
|
-
"sha512": "
|
|
103
|
-
"sha256": "
|
|
104
|
-
"sha1": "
|
|
105
|
-
"md5": "
|
|
99
|
+
"name": "expo.modules.medialibrary-17.1.3-sources.jar",
|
|
100
|
+
"url": "expo.modules.medialibrary-17.1.3-sources.jar",
|
|
101
|
+
"size": 32481,
|
|
102
|
+
"sha512": "e25288a07185f860f73217c6dd9e1eff89379c6f469c09e4db4df734dc31cf8bb586fab6c1fa13b34b865bf50757190e8f873372170ec81e49f8bad936387a7c",
|
|
103
|
+
"sha256": "6549ee6e5b7c4879b2b684b029e5dac80df460b9b37de33577e1ede17be14b1f",
|
|
104
|
+
"sha1": "0b54d105bca4a251a1c2d4b73cbf339ad76911fa",
|
|
105
|
+
"md5": "b2d8bacb5f732b5aaed1d54ac8c3da1a"
|
|
106
106
|
}
|
|
107
107
|
]
|
|
108
108
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a8ac1322a5003e6b9433d09682acc42c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1e1edd18e95d031d7a6bd4f07b80a5fe361ceb44
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
42acf8d3e5f0c259c90d605e0577571dfe6f8233fe8988ce6478d90e15508b60
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d6dfdaad467fcb906616f8720adb116b70374e701c6eff23b648f7ce471dea80f65171123c18debf220008c4f8599376c46228e5751493ad47655faa49d0c43a
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>host.exp.exponent</groupId>
|
|
11
11
|
<artifactId>expo.modules.medialibrary</artifactId>
|
|
12
|
-
<version>17.1.
|
|
12
|
+
<version>17.1.3</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.medialibrary</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3b7b43319cba4969769dcb23af4ecbfa
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f7c3711d13d1bd974b7a3138c6575ffbb72f647d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d62878851f121fe446396f8b6a979378bb42566606f2d5d9a9e33b7edb1e8b9c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2ddfadaaf9e8f796b8fea7e7336c2d8c76d0fad12564f5bcc6e0ccb0e80a7b432f9e44c44e34aab4c2775db6ffff74f295982a9daa2f1a0524ec954ced68e9e5
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>host.exp.exponent</groupId>
|
|
4
4
|
<artifactId>expo.modules.medialibrary</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>17.1.
|
|
7
|
-
<release>17.1.
|
|
6
|
+
<latest>17.1.3</latest>
|
|
7
|
+
<release>17.1.3</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>17.1.
|
|
9
|
+
<version>17.1.3</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20250421213310</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
6c4d59cbef5e4658c9b0d3c6833ccd3f
|
package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/maven-metadata.xml.sha1
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
a5632552745bdb23fe382a6662f52019c5dc5750
|
package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/maven-metadata.xml.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4e591e946f4546ce872f458f400ea8732d9c14c05b3bd6d7b385c55e1132ba14
|
package/local-maven-repo/host/exp/exponent/expo.modules.medialibrary/maven-metadata.xml.sha512
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
384d55288a63f30ba3aa5a6ef45851368e3145fe0dd91b13951e24e18a6d4934529cd0f420ae62dd416a12e0d74cd3727c75fd63528a5caab4fe4dd94823246a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-media-library",
|
|
3
|
-
"version": "17.1.
|
|
3
|
+
"version": "17.1.3",
|
|
4
4
|
"description": "Provides access to user's media library.",
|
|
5
5
|
"main": "build/MediaLibrary.js",
|
|
6
6
|
"types": "build/MediaLibrary.d.ts",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "f1394f21ff2719a9a3037d7511db170704e5c492"
|
|
58
58
|
}
|
package/src/MediaLibrary.ts
CHANGED
|
@@ -734,16 +734,20 @@ export async function getAlbumAsync(title: string): Promise<Album> {
|
|
|
734
734
|
* given asset from the current album to the new one, however it's also possible to move it by
|
|
735
735
|
* passing `false` as `copyAsset` argument.
|
|
736
736
|
* In case it's copied you should keep in mind that `getAssetsAsync` will return duplicated asset.
|
|
737
|
+
* > On Android, it's not possible to create an empty album. You must provide an existing asset to copy or move into the album or an uri of a local file, which will be used to create an initial asset for the album.
|
|
737
738
|
* @param albumName Name of the album to create.
|
|
738
|
-
* @param asset An [Asset](#asset) or its ID
|
|
739
|
-
* @param
|
|
739
|
+
* @param asset An [Asset](#asset) or its ID. On Android you either need to provide an asset or a localUri.
|
|
740
|
+
* @param initialAssetLocalUri A URI to the local media file, which will be used to create the initial asset inside the album. It must contain an extension. On Android it
|
|
741
|
+
* must be a local path, so it must start with `file:///`. If the `asset` was provided, this parameter will be ignored.
|
|
742
|
+
* @param copyAsset __Android Only.__ Whether to copy asset to the new album instead of move it. This parameter is ignored if `asset` was not provided.
|
|
740
743
|
* Defaults to `true`.
|
|
741
744
|
* @return Newly created [`Album`](#album).
|
|
742
745
|
*/
|
|
743
746
|
export async function createAlbumAsync(
|
|
744
747
|
albumName: string,
|
|
745
748
|
asset?: AssetRef,
|
|
746
|
-
copyAsset: boolean = true
|
|
749
|
+
copyAsset: boolean = true,
|
|
750
|
+
initialAssetLocalUri?: string
|
|
747
751
|
): Promise<Album> {
|
|
748
752
|
if (!MediaLibrary.createAlbumAsync) {
|
|
749
753
|
throw new UnavailabilityError('MediaLibrary', 'createAlbumAsync');
|
|
@@ -751,9 +755,15 @@ export async function createAlbumAsync(
|
|
|
751
755
|
|
|
752
756
|
const assetId = getId(asset);
|
|
753
757
|
|
|
754
|
-
if (
|
|
758
|
+
if (
|
|
759
|
+
Platform.OS === 'android' &&
|
|
760
|
+
(typeof assetId !== 'string' || assetId.length === 0) &&
|
|
761
|
+
!initialAssetLocalUri
|
|
762
|
+
) {
|
|
755
763
|
// it's not possible to create empty album on Android, so initial asset must be provided
|
|
756
|
-
throw new Error(
|
|
764
|
+
throw new Error(
|
|
765
|
+
'MediaLibrary.createAlbumAsync must be called with an asset or a localUri on Android.'
|
|
766
|
+
);
|
|
757
767
|
}
|
|
758
768
|
if (!albumName || typeof albumName !== 'string') {
|
|
759
769
|
throw new Error('Invalid argument "albumName". It must be a string!');
|
|
@@ -763,9 +773,9 @@ export async function createAlbumAsync(
|
|
|
763
773
|
}
|
|
764
774
|
|
|
765
775
|
if (Platform.OS === 'ios') {
|
|
766
|
-
return await MediaLibrary.createAlbumAsync(albumName, assetId);
|
|
776
|
+
return await MediaLibrary.createAlbumAsync(albumName, assetId, initialAssetLocalUri);
|
|
767
777
|
}
|
|
768
|
-
return await MediaLibrary.createAlbumAsync(albumName, assetId, !!copyAsset);
|
|
778
|
+
return await MediaLibrary.createAlbumAsync(albumName, assetId, !!copyAsset, initialAssetLocalUri);
|
|
769
779
|
}
|
|
770
780
|
|
|
771
781
|
// @needsAudit
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2845a7703f070fd53eeed9ec20ffd62e
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
42ee38d93d15cf9354638508d497292eb1f03f74
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7693396a462bf4106ed083906e76e7142ebb8935baff9aae9f4a54d9c3d9111d
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
5ad3ac61bb3eb4e35e01adf5e708f0a1071167a10597acf3f28e47d2b29ba4e089263e640d47c35d40ecf81d500d47d58b4a2d61c1562942a68727b42986ba62
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1aa71bde31425a6d8d139aa1150f507d
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1805ba3b2e837bac1f1dcdc08a832679d43fa687
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3119ba28d72b73a64c93ec0742db25e6ceaa8a0ed572d134bde5d90c464e937d
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
6c995d1bf30b8c181e71797d2f9d0a67b3c9be075e000c52d1f9981be952a8d0292c950f9d98f1cacc91ed947df2829b5c399d3f9addb2aa01a69f52bf87dbe6
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
6dfd43946f40d734bd88ef19b9a91cbb
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3d93337e53495e55d8506da864bc467c3e4220d0
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
55f4c3e6d868674de84582c7c7bafe5e064240b1ada9e646b374d24f84a7cda3
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
94c5a0025e06a73ca2fe4ac89c1ece386c5397b215c5d33f093b401cb02812c8e3869e96389e8d0df04e6ed11a07104eb8ed139c8cfa9a66af56d16572d177bd
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
36181cf243e675689d9719d627085555
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
038028e3622ae2ccba89eb1aa0de55208e1fb109
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
81f3de658b082ae5e63a78a539658e2abb5fe661d749b4453bd7014492ab602b
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
d3a1d0b8807aac28f81ed40a83269455e36875cb9de35ce31f13b3c88176d3438710d6bf2003ca0aaefae810643ff8d2353f78d0147305b67e60719871f7b53a
|