stream-chat-expo 5.21.0 → 5.22.0-beta.10

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-expo",
3
3
  "description": "The official Expo SDK for Stream Chat, a service for building chat applications",
4
- "version": "5.21.0",
4
+ "version": "5.22.0-beta.10",
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.21.0"
13
+ "stream-chat-react-native-core": "5.22.0-beta.10"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@react-native-community/netinfo": ">=6.0.0",
@@ -32,9 +32,9 @@ export const getPhotos = async ({
32
32
  });
33
33
  const assets = results.assets.map((asset) => ({
34
34
  duration: asset.duration,
35
- filename: asset.filename,
36
35
  height: asset.height,
37
36
  id: asset.id,
37
+ name: asset.filename,
38
38
  source: 'picker' as const,
39
39
  type: asset.mediaType,
40
40
  uri: asset.uri,
@@ -4,23 +4,6 @@ import * as MediaLibrary from 'expo-media-library';
4
4
 
5
5
  const isAboveIOS14 = Platform.OS === 'ios' && parseInt(Platform.Version as string, 10) >= 14;
6
6
 
7
- export function oniOS14GalleryLibrarySelectionChange(callback: () => void): {
8
- unsubscribe: () => void;
9
- } {
10
- if (isAboveIOS14) {
11
- const subscription = MediaLibrary.addListener(callback);
12
- return {
13
- unsubscribe: () => {
14
- subscription.remove();
15
- },
16
- };
17
- }
18
- return {
19
- // eslint-disable-next-line @typescript-eslint/no-empty-function
20
- unsubscribe: () => {},
21
- };
22
- }
23
-
24
7
  export const iOS14RefreshGallerySelection = (): Promise<void> => {
25
8
  if (isAboveIOS14) {
26
9
  return MediaLibrary.presentPermissionsPickerAsync();
@@ -4,6 +4,7 @@ export * from './getLocalAssetUri';
4
4
  export * from './getPhotos';
5
5
  export * from './iOS14RefreshGallerySelection';
6
6
  export * from './NetInfo';
7
+ export * from './oniOS14GalleryLibrarySelectionChange';
7
8
  export * from './saveFile';
8
9
  export * from './Sound';
9
10
  export * from './takePhoto';
@@ -0,0 +1,22 @@
1
+ import { Platform } from 'react-native';
2
+
3
+ import * as MediaLibrary from 'expo-media-library';
4
+
5
+ const isAboveIOS14 = Platform.OS === 'ios' && parseInt(Platform.Version as string, 10) >= 14;
6
+
7
+ export function oniOS14GalleryLibrarySelectionChange(callback: () => void): {
8
+ unsubscribe: () => void;
9
+ } {
10
+ if (isAboveIOS14) {
11
+ const subscription = MediaLibrary.addListener(callback);
12
+ return {
13
+ unsubscribe: () => {
14
+ subscription.remove();
15
+ },
16
+ };
17
+ }
18
+ return {
19
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
20
+ unsubscribe: () => {},
21
+ };
22
+ }
@@ -10,12 +10,18 @@ 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
+ return { askToOpenSettings: true, cancelled: true };
21
+ }
22
+ }
17
23
 
18
- if (permissionGranted?.status === 'granted' || permissionGranted?.granted === true) {
24
+ if (permissionGranted) {
19
25
  const imagePickerSuccessResult = await ImagePicker.launchCameraAsync({
20
26
  quality: Math.min(Math.max(0, compressImageQuality), 1),
21
27
  });