@stream-io/video-react-native-sdk 0.0.1-alpha.147 → 0.0.1-alpha.148
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.0.1-alpha.148](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.0.1-alpha.147...@stream-io/video-react-native-sdk-0.0.1-alpha.148) (2023-06-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* User connect and types ([#627](https://github.com/GetStream/stream-video-js/issues/627)) ([721ef61](https://github.com/GetStream/stream-video-js/commit/721ef611374540ef570a516009c78d58ce4f5360))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
5
14
|
## [0.0.1-alpha.147](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.0.1-alpha.146...@stream-io/video-react-native-sdk-0.0.1-alpha.147) (2023-06-12)
|
|
6
15
|
|
|
7
16
|
|
|
@@ -30,4 +30,4 @@ export type StreamVideoClientInit = {
|
|
|
30
30
|
*
|
|
31
31
|
* @category Client State
|
|
32
32
|
*/
|
|
33
|
-
export declare const useCreateStreamVideoClient: ({ apiKey, tokenOrProvider, user, options,
|
|
33
|
+
export declare const useCreateStreamVideoClient: ({ apiKey, tokenOrProvider, user, options, }: StreamVideoClientInit) => StreamVideoClient;
|
|
@@ -8,18 +8,11 @@ const react_1 = require("react");
|
|
|
8
8
|
*
|
|
9
9
|
* @category Client State
|
|
10
10
|
*/
|
|
11
|
-
const useCreateStreamVideoClient = ({ apiKey, tokenOrProvider, user, options,
|
|
11
|
+
const useCreateStreamVideoClient = ({ apiKey, tokenOrProvider, user, options, }) => {
|
|
12
12
|
const [client] = (0, react_1.useState)(() => new video_client_1.StreamVideoClient(apiKey, options));
|
|
13
13
|
const disconnectRef = (0, react_1.useRef)(Promise.resolve());
|
|
14
14
|
(0, react_1.useEffect)(() => {
|
|
15
15
|
const connectionPromise = disconnectRef.current.then(() => {
|
|
16
|
-
if (isAnonymous) {
|
|
17
|
-
return client
|
|
18
|
-
.connectAnonymousUser(user, tokenOrProvider)
|
|
19
|
-
.catch((err) => {
|
|
20
|
-
console.error(`Failed to establish connection`, err);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
16
|
return client.connectUser(user, tokenOrProvider).catch((err) => {
|
|
24
17
|
console.error(`Failed to establish connection`, err);
|
|
25
18
|
});
|
|
@@ -33,7 +26,7 @@ const useCreateStreamVideoClient = ({ apiKey, tokenOrProvider, user, options, is
|
|
|
33
26
|
};
|
|
34
27
|
// we want to re-run this effect only in some special cases
|
|
35
28
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
|
-
}, [apiKey, tokenOrProvider, client,
|
|
29
|
+
}, [apiKey, tokenOrProvider, client, user?.id]);
|
|
37
30
|
return client;
|
|
38
31
|
};
|
|
39
32
|
exports.useCreateStreamVideoClient = useCreateStreamVideoClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateStreamVideoClient.js","sourceRoot":"","sources":["../../../src/hooks/useCreateStreamVideoClient.tsx"],"names":[],"mappings":";;;AAAA,0DAKiC;AACjC,iCAAoD;AA6BpD;;;;GAIG;AACI,MAAM,0BAA0B,GAAG,CAAC,EACzC,MAAM,EACN,eAAe,EACf,IAAI,EACJ,OAAO,
|
|
1
|
+
{"version":3,"file":"useCreateStreamVideoClient.js","sourceRoot":"","sources":["../../../src/hooks/useCreateStreamVideoClient.tsx"],"names":[],"mappings":";;;AAAA,0DAKiC;AACjC,iCAAoD;AA6BpD;;;;GAIG;AACI,MAAM,0BAA0B,GAAG,CAAC,EACzC,MAAM,EACN,eAAe,EACf,IAAI,EACJ,OAAO,GACe,EAAE,EAAE;IAC1B,MAAM,CAAC,MAAM,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,IAAI,gCAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAExE,MAAM,aAAa,GAAG,IAAA,cAAM,EAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAChD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,iBAAiB,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;YACxD,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC7D,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,OAAO,GAAG,iBAAiB;iBACtC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;iBACnC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACb,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QACF,2DAA2D;QAC3D,uDAAuD;IACzD,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IAEhD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA5BW,QAAA,0BAA0B,8BA4BrC"}
|
package/package.json
CHANGED
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"CHANGELOG.md"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@stream-io/i18n": "^0.0.
|
|
25
|
-
"@stream-io/video-client": "^0.0.
|
|
26
|
-
"@stream-io/video-react-bindings": "^0.0.
|
|
24
|
+
"@stream-io/i18n": "^0.0.3",
|
|
25
|
+
"@stream-io/video-client": "^0.0.10",
|
|
26
|
+
"@stream-io/video-react-bindings": "^0.0.10"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@react-native-community/netinfo": ">=9.0.0",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"typedoc-plugin-markdown": "^3.15.3",
|
|
67
67
|
"typescript": "^4.9.5"
|
|
68
68
|
},
|
|
69
|
-
"version": "0.0.1-alpha.
|
|
69
|
+
"version": "0.0.1-alpha.148"
|
|
70
70
|
}
|
|
@@ -43,20 +43,12 @@ export const useCreateStreamVideoClient = ({
|
|
|
43
43
|
tokenOrProvider,
|
|
44
44
|
user,
|
|
45
45
|
options,
|
|
46
|
-
isAnonymous = false,
|
|
47
46
|
}: StreamVideoClientInit) => {
|
|
48
47
|
const [client] = useState(() => new StreamVideoClient(apiKey, options));
|
|
49
48
|
|
|
50
49
|
const disconnectRef = useRef(Promise.resolve());
|
|
51
50
|
useEffect(() => {
|
|
52
51
|
const connectionPromise = disconnectRef.current.then(() => {
|
|
53
|
-
if (isAnonymous) {
|
|
54
|
-
return client
|
|
55
|
-
.connectAnonymousUser(user, tokenOrProvider)
|
|
56
|
-
.catch((err) => {
|
|
57
|
-
console.error(`Failed to establish connection`, err);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
52
|
return client.connectUser(user, tokenOrProvider).catch((err) => {
|
|
61
53
|
console.error(`Failed to establish connection`, err);
|
|
62
54
|
});
|
|
@@ -71,7 +63,7 @@ export const useCreateStreamVideoClient = ({
|
|
|
71
63
|
};
|
|
72
64
|
// we want to re-run this effect only in some special cases
|
|
73
65
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
74
|
-
}, [apiKey, tokenOrProvider, client,
|
|
66
|
+
}, [apiKey, tokenOrProvider, client, user?.id]);
|
|
75
67
|
|
|
76
68
|
return client;
|
|
77
69
|
};
|