stream-chat-react-native 5.22.0-beta.4 → 5.22.0-beta.6

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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
  [![NPM](https://img.shields.io/npm/v/stream-chat-react-native.svg)](https://www.npmjs.com/package/stream-chat-react-native)
12
- [![Build Status](https://github.com/GetStream/stream-chat-react-native/workflows/build/badge.svg)](https://github.com/GetStream/stream-chat-react-native/actions)
12
+ [![Build Status](https://github.com/GetStream/stream-chat-react-native/actions/workflows/release.yml/badge.svg)](https://github.com/GetStream/stream-chat-react-native/actions)
13
13
  [![Component Reference](https://img.shields.io/badge/docs-component%20reference-blue.svg)](https://getstream.io/chat/docs/sdk/reactnative)
14
14
 
15
15
  <img align="right" src="https://getstream.imgix.net/images/ios-chat-tutorial/iphone_chat_art@3x.png?auto=format,enhance" width="50%" />
@@ -25,10 +25,15 @@
25
25
 
26
26
  ## Contents
27
27
 
28
- - [React Native Chat Tutorial](#-react-native-chat-tutorial)
29
- - [Example Apps](#-example-apps)
30
- - [Keep in mind](#-keep-in-mind)
31
- - [Contributing](#-contributing)
28
+ - [Official React Native SDK for Stream Chat](#official-react-native-sdk-for-stream-chat)
29
+ - [Contents](#contents)
30
+ - [📖 React Native Chat Tutorial](#-react-native-chat-tutorial)
31
+ - [Free for Makers](#free-for-makers)
32
+ - [🔮 Example Apps](#-example-apps)
33
+ - [💬 Keep in mind](#-keep-in-mind)
34
+ - [👏 Contributing](#-contributing)
35
+ - [Git flow \& Release process](#git-flow--release-process)
36
+ - [We are hiring](#we-are-hiring)
32
37
 
33
38
  ## 📖 React Native Chat Tutorial
34
39
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-chat-react-native",
3
3
  "description": "The official React Native SDK for Stream Chat, a service for building chat applications",
4
- "version": "5.22.0-beta.4",
4
+ "version": "5.22.0-beta.6",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -11,7 +11,7 @@
11
11
  "types": "types/index.d.ts",
12
12
  "dependencies": {
13
13
  "es6-symbol": "^3.1.3",
14
- "stream-chat-react-native-core": "5.22.0-beta.4"
14
+ "stream-chat-react-native-core": "5.22.0-beta.6"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@react-native-camera-roll/camera-roll": ">=5.0.0",
@@ -1,8 +1,6 @@
1
- import { AppState, Image, Linking, PermissionsAndroid, Platform } from 'react-native';
1
+ import { AppState, Image, PermissionsAndroid, Platform } from 'react-native';
2
2
  import ImagePicker from 'react-native-image-crop-picker';
3
3
 
4
- let hadDeniedAndroidPermission = false;
5
-
6
4
  export const takePhoto = async ({ compressImageQuality = Platform.OS === 'ios' ? 0.8 : 1 }) => {
7
5
  if (Platform.OS === 'android') {
8
6
  const cameraPermissions = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.CAMERA);
@@ -11,13 +9,9 @@ export const takePhoto = async ({ compressImageQuality = Platform.OS === 'ios' ?
11
9
  PermissionsAndroid.PERMISSIONS.CAMERA,
12
10
  );
13
11
  if (androidPermissionStatus === PermissionsAndroid.RESULTS.DENIED) {
14
- hadDeniedAndroidPermission = true;
15
12
  return { cancelled: true };
16
13
  } else if (androidPermissionStatus === PermissionsAndroid.RESULTS.NEVER_ASK_AGAIN) {
17
- if (!hadDeniedAndroidPermission) {
18
- Linking.openSettings();
19
- }
20
- return { cancelled: true };
14
+ return { askToOpenSettings: true, cancelled: true };
21
15
  }
22
16
  }
23
17
  }
@@ -62,9 +56,15 @@ export const takePhoto = async ({ compressImageQuality = Platform.OS === 'ios' ?
62
56
  };
63
57
  }
64
58
  } catch (e: unknown) {
65
- // on iOS: if it was in inactive state, then the user had just denied the permissions
66
- if (Platform.OS === 'ios' && AppState.currentState === 'active') {
67
- await Linking.openSettings();
59
+ if (e instanceof Error) {
60
+ // on iOS: if it was in inactive state, then the user had just denied the permissions
61
+ if (Platform.OS === 'ios' && AppState.currentState === 'active') {
62
+ const cameraPermissionDeniedMsg = 'User did not grant camera permission.';
63
+ // Open settings when the user did not allow camera permissions
64
+ if (e.message === cameraPermissionDeniedMsg) {
65
+ return { askToOpenSettings: true, cancelled: true };
66
+ }
67
+ }
68
68
  }
69
69
  }
70
70