@droppii-org/chat-sdk 0.6.54 → 0.6.55
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.
|
@@ -4,11 +4,8 @@ interface UseViewOnlyGroupRefreshOptions {
|
|
|
4
4
|
groupId?: string;
|
|
5
5
|
refreshMessages: () => Promise<void>;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* snapshot from when they opened the group. Poll new messages and group info
|
|
10
|
-
* while the tab is visible, and once right away when it becomes visible again.
|
|
11
|
-
*/
|
|
7
|
+
/** OpenIM only pushes to group members, so refresh a read-only viewer's messages and
|
|
8
|
+
* group info on open, then poll while visible and again when the tab returns. */
|
|
12
9
|
export declare const useViewOnlyGroupRefresh: ({ enabled, groupId, refreshMessages, }: UseViewOnlyGroupRefreshOptions) => void;
|
|
13
10
|
export {};
|
|
14
11
|
//# sourceMappingURL=useViewOnlyGroupRefresh.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useViewOnlyGroupRefresh.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useViewOnlyGroupRefresh.ts"],"names":[],"mappings":"AAKA,UAAU,8BAA8B;IACtC,gFAAgF;IAChF,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED
|
|
1
|
+
{"version":3,"file":"useViewOnlyGroupRefresh.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useViewOnlyGroupRefresh.ts"],"names":[],"mappings":"AAKA,UAAU,8BAA8B;IACtC,gFAAgF;IAChF,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED;iFACiF;AACjF,eAAO,MAAM,uBAAuB,GAAI,wCAIrC,8BAA8B,SAkChC,CAAC"}
|
|
@@ -2,11 +2,8 @@ import { useEffect } from "react";
|
|
|
2
2
|
import { useLatest } from "ahooks";
|
|
3
3
|
import { VIEW_ONLY_REFRESH_INTERVAL_MS } from "../../constants";
|
|
4
4
|
import useConversationStore from "../../store/conversation";
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* snapshot from when they opened the group. Poll new messages and group info
|
|
8
|
-
* while the tab is visible, and once right away when it becomes visible again.
|
|
9
|
-
*/
|
|
5
|
+
/** OpenIM only pushes to group members, so refresh a read-only viewer's messages and
|
|
6
|
+
* group info on open, then poll while visible and again when the tab returns. */
|
|
10
7
|
export const useViewOnlyGroupRefresh = ({ enabled, groupId, refreshMessages, }) => {
|
|
11
8
|
const refreshMessagesRef = useLatest(refreshMessages);
|
|
12
9
|
useEffect(() => {
|
|
@@ -36,6 +33,8 @@ export const useViewOnlyGroupRefresh = ({ enabled, groupId, refreshMessages, })
|
|
|
36
33
|
void refresh();
|
|
37
34
|
}, VIEW_ONLY_REFRESH_INTERVAL_MS);
|
|
38
35
|
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
36
|
+
// Reopening a group shows its cached name/avatar; don't wait a full interval.
|
|
37
|
+
void refresh();
|
|
39
38
|
return () => {
|
|
40
39
|
window.clearInterval(timer);
|
|
41
40
|
document.removeEventListener("visibilitychange", onVisibilityChange);
|