stream-chat-expo 5.22.0-beta.2 → 5.22.0-beta.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-chat-expo",
3
3
  "description": "The official Expo SDK for Stream Chat, a service for building chat applications",
4
- "version": "5.22.0-beta.2",
4
+ "version": "5.22.0-beta.4",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -10,7 +10,7 @@
10
10
  "main": "src/index.js",
11
11
  "types": "types/index.d.ts",
12
12
  "dependencies": {
13
- "stream-chat-react-native-core": "5.22.0-beta.2"
13
+ "stream-chat-react-native-core": "5.22.0-beta.4"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@react-native-community/netinfo": ">=6.0.0",
@@ -1,4 +1,4 @@
1
- import { Image, Platform } from 'react-native';
1
+ import { Image, Linking, Platform } from 'react-native';
2
2
 
3
3
  import * as ImagePicker from 'expo-image-picker';
4
4
 
@@ -10,12 +10,19 @@ type Size = {
10
10
  export const takePhoto = async ({ compressImageQuality = 1 }) => {
11
11
  try {
12
12
  const permissionCheck = await ImagePicker.getCameraPermissionsAsync();
13
- const permissionGranted =
14
- permissionCheck?.status === 'granted'
15
- ? permissionCheck
16
- : await ImagePicker.requestCameraPermissionsAsync();
13
+ const canRequest = permissionCheck.canAskAgain;
14
+ let permissionGranted = permissionCheck.granted;
15
+ if (!permissionGranted) {
16
+ if (canRequest) {
17
+ const response = await ImagePicker.requestCameraPermissionsAsync();
18
+ permissionGranted = response.granted;
19
+ } else {
20
+ Linking.openSettings();
21
+ return { cancelled: true };
22
+ }
23
+ }
17
24
 
18
- if (permissionGranted?.status === 'granted' || permissionGranted?.granted === true) {
25
+ if (permissionGranted) {
19
26
  const imagePickerSuccessResult = await ImagePicker.launchCameraAsync({
20
27
  quality: Math.min(Math.max(0, compressImageQuality), 1),
21
28
  });