stream-chat-react-native 6.0.0-rc.9 → 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/README.md +1 -1
- package/package.json +2 -2
- package/src/optionalDependencies/getLocalAssetUri.ts +7 -2
- package/src/optionalDependencies/getPhotos.ts +19 -9
- package/src/optionalDependencies/pickImage.ts +1 -0
- /package/android/src/oldarch/com/streamchatreactnative/{StreamChatReactNativeSpec.java → StreamChatReactNative.java} +0 -0
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
[](https://www.npmjs.com/package/stream-chat-react-native)
|
|
11
11
|
[](https://github.com/GetStream/stream-chat-react-native/actions)
|
|
12
12
|
[](https://getstream.io/chat/docs/sdk/reactnative)
|
|
13
|
-

|
|
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%" />
|
|
16
16
|
|
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": "6.0.0
|
|
4
|
+
"version": "6.0.0",
|
|
5
5
|
"homepage": "https://www.npmjs.com/package/stream-chat-react-native",
|
|
6
6
|
"author": {
|
|
7
7
|
"company": "Stream.io Inc",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"types": "types/index.d.ts",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"es6-symbol": "^3.1.3",
|
|
23
|
-
"stream-chat-react-native-core": "6.0.0
|
|
23
|
+
"stream-chat-react-native-core": "6.0.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@react-native-camera-roll/camera-roll": ">=7.8.0",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
1
3
|
let CameraRollDependency;
|
|
2
4
|
|
|
3
5
|
try {
|
|
@@ -12,8 +14,11 @@ try {
|
|
|
12
14
|
export const getLocalAssetUri = CameraRollDependency
|
|
13
15
|
? async (remoteUri: string) => {
|
|
14
16
|
try {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
if (Platform.OS === 'ios') {
|
|
18
|
+
const imageData = await CameraRollDependency.CameraRoll.iosGetImageDataById(remoteUri);
|
|
19
|
+
return imageData?.node?.image?.filepath;
|
|
20
|
+
}
|
|
21
|
+
return remoteUri;
|
|
17
22
|
} catch {
|
|
18
23
|
throw new Error('getLocalAssetUri Error');
|
|
19
24
|
}
|
|
@@ -13,6 +13,8 @@ try {
|
|
|
13
13
|
|
|
14
14
|
import type { Asset } from 'stream-chat-react-native-core';
|
|
15
15
|
|
|
16
|
+
import { getLocalAssetUri } from './getLocalAssetUri';
|
|
17
|
+
|
|
16
18
|
type ReturnType = {
|
|
17
19
|
assets: Array<Omit<Asset, 'source'> & { source: 'picker' }>;
|
|
18
20
|
endCursor: string | undefined;
|
|
@@ -82,15 +84,23 @@ export const getPhotos = CameraRollDependency
|
|
|
82
84
|
first,
|
|
83
85
|
include: ['fileSize', 'filename', 'imageSize', 'playableDuration'],
|
|
84
86
|
});
|
|
85
|
-
const assets =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
const assets = await Promise.all(
|
|
88
|
+
results.edges.map(async (edge) => {
|
|
89
|
+
const originalUri = edge.node?.image?.uri;
|
|
90
|
+
const uri = getLocalAssetUri ? await getLocalAssetUri(originalUri) : originalUri;
|
|
91
|
+
return {
|
|
92
|
+
...edge.node.image,
|
|
93
|
+
duration: edge.node.image.playableDuration * 1000,
|
|
94
|
+
// since we include filename, fileSize in the query, we can safely assume it will be defined
|
|
95
|
+
name: edge.node.image.filename as string,
|
|
96
|
+
originalUri,
|
|
97
|
+
size: edge.node.image.fileSize as number,
|
|
98
|
+
source: 'picker' as const,
|
|
99
|
+
type: edge.node.type,
|
|
100
|
+
uri,
|
|
101
|
+
};
|
|
102
|
+
}),
|
|
103
|
+
);
|
|
94
104
|
const hasNextPage = results.page_info.has_next_page;
|
|
95
105
|
const endCursor = results.page_info.end_cursor;
|
|
96
106
|
return { assets, endCursor, hasNextPage, iOSLimited: !!results.limited };
|
|
File without changes
|