@supportworks/multi-imagepicker 5.0.7 → 6.0.0
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/changes.md +6 -0
- package/package.json +1 -1
- package/src/components/MultiImagePicker.js +15 -15
package/changes.md
CHANGED
package/package.json
CHANGED
|
@@ -36,7 +36,7 @@ class MultiImagePicker extends React.Component {
|
|
|
36
36
|
case RESULTS.DENIED:
|
|
37
37
|
//if request is blocked, show persmission
|
|
38
38
|
const requestResponse = await request(permission);
|
|
39
|
-
if (requestResponse === RESULTS.BLOCKED) {
|
|
39
|
+
if (requestResponse === RESULTS.BLOCKED) {
|
|
40
40
|
this.showPermissionAlert('Storage');
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
@@ -86,20 +86,20 @@ class MultiImagePicker extends React.Component {
|
|
|
86
86
|
showPermissionAlert(type) {
|
|
87
87
|
|
|
88
88
|
const platformMessage = Platform.select({
|
|
89
|
-
ios:
|
|
89
|
+
ios:
|
|
90
90
|
"Photo library access is required. Please go to Settings > Privacy > Photos and grant full access for this app.",
|
|
91
|
-
android:
|
|
92
|
-
`${type} access is required to select photos. Please go to Settings > Apps >
|
|
91
|
+
android:
|
|
92
|
+
`${type} access is required to select photos. Please go to Settings > Apps > THIS_APP > Permissions and enable access.`,
|
|
93
93
|
});
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
Alert.alert(
|
|
96
96
|
'Permission Required',
|
|
97
97
|
`${platformMessage} You need to enable access to continue.`,
|
|
98
98
|
[
|
|
99
99
|
{ text: 'Cancel', style: 'cancel' },
|
|
100
|
-
{
|
|
101
|
-
text: 'Open Settings',
|
|
102
|
-
onPress: () => openSettings().catch(() => Linking.openURL('app-settings:'))
|
|
100
|
+
{
|
|
101
|
+
text: 'Open Settings',
|
|
102
|
+
onPress: () => openSettings().catch(() => Linking.openURL('app-settings:'))
|
|
103
103
|
},
|
|
104
104
|
]
|
|
105
105
|
);
|
|
@@ -107,18 +107,18 @@ class MultiImagePicker extends React.Component {
|
|
|
107
107
|
|
|
108
108
|
async checkAndOpenPicker(options, action) {
|
|
109
109
|
|
|
110
|
-
//if its android 33+ then we don't need to check read external sorage. we need to check media images and video
|
|
111
110
|
let permission;
|
|
112
111
|
|
|
113
112
|
if (Platform.OS === 'android') {
|
|
114
113
|
// Check Android version
|
|
115
114
|
const androidVersion = parseInt(Platform.Version, 10);
|
|
116
115
|
if (androidVersion >= 33) {
|
|
117
|
-
// Android 13+ requires specific media permissions
|
|
118
|
-
|
|
116
|
+
// Android 13+ requires specific media permissions -
|
|
117
|
+
// UPDATE 9/24/25: these are no longer needed and in fact Google Play Store prohibits use of them in our case
|
|
118
|
+
/*permission = [
|
|
119
119
|
PERMISSIONS.ANDROID.READ_MEDIA_IMAGES,
|
|
120
120
|
PERMISSIONS.ANDROID.READ_MEDIA_VIDEO,
|
|
121
|
-
]
|
|
121
|
+
];*/
|
|
122
122
|
} else {
|
|
123
123
|
// Use legacy storage permission for Android < 33
|
|
124
124
|
permission = PERMISSIONS.ANDROID.READ_EXTERNAL_STORAGE;
|
|
@@ -129,7 +129,7 @@ class MultiImagePicker extends React.Component {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
//check if permission is a string or an array of strings, if its an array do a for each and check each permission
|
|
132
|
-
const hasPermission = await this.requestPermissions(permission);
|
|
132
|
+
const hasPermission = permission ? await this.requestPermissions(permission) : true;
|
|
133
133
|
if (hasPermission) {
|
|
134
134
|
action(options); // Proceed if permission granted
|
|
135
135
|
} else {
|
|
@@ -171,14 +171,14 @@ class MultiImagePicker extends React.Component {
|
|
|
171
171
|
callback();
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
|
-
|
|
174
|
+
|
|
175
175
|
const hasPermission = await this.requestCameraPermission();
|
|
176
176
|
if (!hasPermission) {
|
|
177
177
|
this.showPermissionAlert('Camera');
|
|
178
178
|
callback();
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
|
|
182
182
|
try {
|
|
183
183
|
const image = await ImagePicker.openCamera(options);
|
|
184
184
|
console.log("SWSI take photo, image: " + JSON.stringify(image));
|