expo-media-library 17.1.0-canary-20250305-0af9ad2 → 17.1.0-canary-20250320-7a205d3
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
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
- [Android] Started using expo modules gradle plugin. ([#34176](https://github.com/expo/expo/pull/34176) by [@lukmccall](https://github.com/lukmccall))
|
|
16
16
|
- [apple] Migrate remaining `expo-module.config.json` to unified platform syntax. ([#34445](https://github.com/expo/expo/pull/34445) by [@reichhartd](https://github.com/reichhartd))
|
|
17
|
+
- [iOS] Fix warnings which will become errors in Swift 6. ([#35288](https://github.com/expo/expo/pull/35288) by [@behenate](https://github.com/behenate)), ([#35428](https://github.com/expo/expo/pull/35428) by [@behenate](https://github.com/behenate))
|
|
18
|
+
- [iOS] Add `preventAutomaticLimitedAccessAlert` option to config plugin. ([#35515](https://github.com/expo/expo/pull/35515) by [@fobos531](https://github.com/fobos531))
|
|
17
19
|
|
|
18
20
|
## 17.0.6 - 2025-02-14
|
|
19
21
|
|
|
@@ -2,139 +2,139 @@ import ExpoModulesCore
|
|
|
2
2
|
|
|
3
3
|
let defaultErrorMessage = "unspecified error"
|
|
4
4
|
|
|
5
|
-
internal class MediaLibraryPermissionsException: Exception {
|
|
5
|
+
internal final class MediaLibraryPermissionsException: Exception {
|
|
6
6
|
override var reason: String {
|
|
7
7
|
"Media Library permission is required to do this operation"
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
internal class EmptyFileExtensionException: Exception {
|
|
11
|
+
internal final class EmptyFileExtensionException: Exception {
|
|
12
12
|
override var reason: String {
|
|
13
13
|
"Could not get the file's extension - it was empty."
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
internal class UnsupportedAssetTypeException: GenericException<String> {
|
|
17
|
+
internal final class UnsupportedAssetTypeException: GenericException<String> {
|
|
18
18
|
override var reason: String {
|
|
19
19
|
"This URL does not contain a valid asset type: \(param)"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
internal class UnreadableAssetException: GenericException<String> {
|
|
23
|
+
internal final class UnreadableAssetException: GenericException<String> {
|
|
24
24
|
override var reason: String {
|
|
25
25
|
"File \(param) isn't readable"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
internal class SaveAssetException: GenericException<(any Error)?> {
|
|
29
|
+
internal final class SaveAssetException: GenericException<(any Error)?> {
|
|
30
30
|
override var reason: String {
|
|
31
31
|
"Asset couldn't be saved to photo library: \(param?.localizedDescription ?? defaultErrorMessage)"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
internal class MissingPListKeyException: GenericException<String> {
|
|
35
|
+
internal final class MissingPListKeyException: GenericException<String> {
|
|
36
36
|
override var reason: String {
|
|
37
37
|
"This app is missing \(param). Add this entry to your bundle's Info.plist"
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
internal class MissingFileException: GenericException<String> {
|
|
41
|
+
internal final class MissingFileException: GenericException<String> {
|
|
42
42
|
override var reason: String {
|
|
43
43
|
"Couldn't open file: \(param). Make sure if this file exists"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
internal class SaveVideoException: Exception {
|
|
47
|
+
internal final class SaveVideoException: Exception {
|
|
48
48
|
override var reason: String {
|
|
49
49
|
"This video couldn't be saved to the Camera Roll album"
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
internal class SaveAlbumException: GenericException<(any Error)?> {
|
|
53
|
+
internal final class SaveAlbumException: GenericException<(any Error)?> {
|
|
54
54
|
override var reason: String {
|
|
55
55
|
"Couldn't add assets to album: \(param?.localizedDescription ?? defaultErrorMessage)"
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
internal class RemoveFromAlbumException: GenericException<(any Error)?> {
|
|
59
|
+
internal final class RemoveFromAlbumException: GenericException<(any Error)?> {
|
|
60
60
|
override var reason: String {
|
|
61
61
|
"Couldn't remove assets from album: \(param?.localizedDescription ?? defaultErrorMessage)"
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
internal class RemoveAssetsException: GenericException<(any Error)?> {
|
|
65
|
+
internal final class RemoveAssetsException: GenericException<(any Error)?> {
|
|
66
66
|
override var reason: String {
|
|
67
67
|
"Couldn't remove assets: \(param?.localizedDescription ?? defaultErrorMessage)"
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
internal class UnsupportedAssetException: Exception {
|
|
71
|
+
internal final class UnsupportedAssetException: Exception {
|
|
72
72
|
override var reason: String {
|
|
73
73
|
"This file type is not supported yet"
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
internal class NotEnoughPermissionsException: Exception {
|
|
77
|
+
internal final class NotEnoughPermissionsException: Exception {
|
|
78
78
|
override var reason: String {
|
|
79
79
|
"Access to all photos is required to do this operation"
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
internal class FailedToAddAssetException: GenericException<(any Error)?> {
|
|
83
|
+
internal final class FailedToAddAssetException: GenericException<(any Error)?> {
|
|
84
84
|
override var reason: String {
|
|
85
85
|
"Unable to add asset to the new album: \(param?.localizedDescription ?? defaultErrorMessage)"
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
internal class CreateAlbumFailedException: GenericException<(any Error)?> {
|
|
89
|
+
internal final class CreateAlbumFailedException: GenericException<(any Error)?> {
|
|
90
90
|
override var reason: String {
|
|
91
91
|
"Could not create album: \(param?.localizedDescription ?? defaultErrorMessage)"
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
internal class DeleteAlbumFailedException: GenericException<(any Error)?> {
|
|
95
|
+
internal final class DeleteAlbumFailedException: GenericException<(any Error)?> {
|
|
96
96
|
override var reason: String {
|
|
97
97
|
"Could not delete album: \(param?.localizedDescription ?? defaultErrorMessage)"
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
internal class CursorException: Exception {
|
|
101
|
+
internal final class CursorException: Exception {
|
|
102
102
|
override var reason: String {
|
|
103
103
|
"Couldn't find cursor"
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
internal class SortByKeyException: GenericException<String> {
|
|
107
|
+
internal final class SortByKeyException: GenericException<String> {
|
|
108
108
|
override var reason: String {
|
|
109
109
|
"SortBy key \"\(param)\" is not supported"
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
internal class PermissionsModuleNotFoundException: Exception {
|
|
113
|
+
internal final class PermissionsModuleNotFoundException: Exception {
|
|
114
114
|
override var reason: String {
|
|
115
115
|
"Permissions module not found. Are you sure that Expo modules are properly linked?"
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
internal class ExportSessionFailedException: Exception {
|
|
119
|
+
internal final class ExportSessionFailedException: Exception {
|
|
120
120
|
override var reason: String {
|
|
121
121
|
"Failed to export the requested video"
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
internal class ExportSessionCancelledException: Exception {
|
|
125
|
+
internal final class ExportSessionCancelledException: Exception {
|
|
126
126
|
override var reason: String {
|
|
127
127
|
"Exporting session cancelled"
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
internal class ExportSessionUnknownException: Exception {
|
|
131
|
+
internal final class ExportSessionUnknownException: Exception {
|
|
132
132
|
override var reason: String {
|
|
133
133
|
"Could not export the requested video"
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
internal class InvalidPathException: Exception {
|
|
137
|
+
internal final class InvalidPathException: Exception {
|
|
138
138
|
override var reason: String {
|
|
139
139
|
"Failed to create video path"
|
|
140
140
|
}
|
|
@@ -50,6 +50,9 @@ func stringifyAlbumType(type: PHAssetCollectionType) -> String {
|
|
|
50
50
|
return "moment"
|
|
51
51
|
case .smartAlbum:
|
|
52
52
|
return "smartAlbum"
|
|
53
|
+
@unknown default:
|
|
54
|
+
log.error("Unhandled `PHAssetCollectionType` value: \(type), returning `album` as fallback. Add the missing case as soon as possible.")
|
|
55
|
+
return "album"
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-media-library",
|
|
3
|
-
"version": "17.1.0-canary-
|
|
3
|
+
"version": "17.1.0-canary-20250320-7a205d3",
|
|
4
4
|
"description": "Provides access to user's media library.",
|
|
5
5
|
"main": "build/MediaLibrary.js",
|
|
6
6
|
"types": "build/MediaLibrary.d.ts",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"preset": "expo-module-scripts"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"expo-module-scripts": "4.0.5-canary-
|
|
41
|
+
"expo-module-scripts": "4.0.5-canary-20250320-7a205d3"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"expo": "53.0.0-canary-
|
|
44
|
+
"expo": "53.0.0-canary-20250320-7a205d3",
|
|
45
45
|
"react-native": "*"
|
|
46
46
|
},
|
|
47
47
|
"codegenConfig": {
|
|
@@ -53,6 +53,5 @@
|
|
|
53
53
|
"RCTImageURLLoader": "MediaLibraryImageLoader"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
}
|
|
57
|
-
"gitHead": "0af9ad2afd326af47eae076f81a89105a026312d"
|
|
56
|
+
}
|
|
58
57
|
}
|
|
@@ -4,5 +4,6 @@ declare const _default: ConfigPlugin<void | {
|
|
|
4
4
|
photosPermission?: string | false | undefined;
|
|
5
5
|
savePhotosPermission?: string | false | undefined;
|
|
6
6
|
isAccessMediaLocationEnabled?: boolean | undefined;
|
|
7
|
+
preventAutomaticLimitedAccessAlert?: boolean | undefined;
|
|
7
8
|
}>;
|
|
8
9
|
export default _default;
|
|
@@ -18,7 +18,7 @@ const withMediaLibraryExternalStorage = (config) => {
|
|
|
18
18
|
return config;
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
-
const withMediaLibrary = (config, { photosPermission, savePhotosPermission, isAccessMediaLocationEnabled } = {}) => {
|
|
21
|
+
const withMediaLibrary = (config, { photosPermission, savePhotosPermission, isAccessMediaLocationEnabled, preventAutomaticLimitedAccessAlert, } = {}) => {
|
|
22
22
|
config_plugins_1.IOSConfig.Permissions.createPermissionsPlugin({
|
|
23
23
|
NSPhotoLibraryUsageDescription: 'Allow $(PRODUCT_NAME) to access your photos',
|
|
24
24
|
NSPhotoLibraryAddUsageDescription: 'Allow $(PRODUCT_NAME) to save photos',
|
|
@@ -31,6 +31,12 @@ const withMediaLibrary = (config, { photosPermission, savePhotosPermission, isAc
|
|
|
31
31
|
'android.permission.WRITE_EXTERNAL_STORAGE',
|
|
32
32
|
isAccessMediaLocationEnabled && 'android.permission.ACCESS_MEDIA_LOCATION',
|
|
33
33
|
].filter(Boolean));
|
|
34
|
+
if (preventAutomaticLimitedAccessAlert) {
|
|
35
|
+
config = (0, config_plugins_1.withInfoPlist)(config, (config) => {
|
|
36
|
+
config.modResults.PHPhotoLibraryPreventAutomaticLimitedAccessAlert = true;
|
|
37
|
+
return config;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
34
40
|
return withMediaLibraryExternalStorage(config);
|
|
35
41
|
};
|
|
36
42
|
exports.default = (0, config_plugins_1.createRunOncePlugin)(withMediaLibrary, pkg.name, pkg.version);
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
AndroidConfig,
|
|
5
5
|
createRunOncePlugin,
|
|
6
6
|
IOSConfig,
|
|
7
|
+
withInfoPlist,
|
|
7
8
|
} from 'expo/config-plugins';
|
|
8
9
|
|
|
9
10
|
const pkg = require('expo-media-library/package.json');
|
|
@@ -31,8 +32,17 @@ const withMediaLibrary: ConfigPlugin<
|
|
|
31
32
|
photosPermission?: string | false;
|
|
32
33
|
savePhotosPermission?: string | false;
|
|
33
34
|
isAccessMediaLocationEnabled?: boolean;
|
|
35
|
+
preventAutomaticLimitedAccessAlert?: boolean;
|
|
34
36
|
} | void
|
|
35
|
-
> = (
|
|
37
|
+
> = (
|
|
38
|
+
config,
|
|
39
|
+
{
|
|
40
|
+
photosPermission,
|
|
41
|
+
savePhotosPermission,
|
|
42
|
+
isAccessMediaLocationEnabled,
|
|
43
|
+
preventAutomaticLimitedAccessAlert,
|
|
44
|
+
} = {}
|
|
45
|
+
) => {
|
|
36
46
|
IOSConfig.Permissions.createPermissionsPlugin({
|
|
37
47
|
NSPhotoLibraryUsageDescription: 'Allow $(PRODUCT_NAME) to access your photos',
|
|
38
48
|
NSPhotoLibraryAddUsageDescription: 'Allow $(PRODUCT_NAME) to save photos',
|
|
@@ -50,6 +60,13 @@ const withMediaLibrary: ConfigPlugin<
|
|
|
50
60
|
].filter(Boolean) as string[]
|
|
51
61
|
);
|
|
52
62
|
|
|
63
|
+
if (preventAutomaticLimitedAccessAlert) {
|
|
64
|
+
config = withInfoPlist(config, (config) => {
|
|
65
|
+
config.modResults.PHPhotoLibraryPreventAutomaticLimitedAccessAlert = true;
|
|
66
|
+
return config;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
53
70
|
return withMediaLibraryExternalStorage(config);
|
|
54
71
|
};
|
|
55
72
|
|