@droppii-org/chat-mobile 0.2.109 → 0.2.110
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/lib/module/screens/chat-detail/ChatDetail.js +42 -7
- package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatListLegend.js +249 -49
- package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
- package/lib/module/screens/chat-detail/hooks/createUnreadMarkReadGate.js +32 -0
- package/lib/module/screens/chat-detail/hooks/createUnreadMarkReadGate.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useMarkConversationRead.js +180 -0
- package/lib/module/screens/chat-detail/hooks/useMarkConversationRead.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useUnreadAnchorSeen.js +88 -0
- package/lib/module/screens/chat-detail/hooks/useUnreadAnchorSeen.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useUnreadDeeplinkCheck.js +59 -0
- package/lib/module/screens/chat-detail/hooks/useUnreadDeeplinkCheck.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useUnreadIndicator.js +105 -0
- package/lib/module/screens/chat-detail/hooks/useUnreadIndicator.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useUnreadIndicatorInList.js +157 -0
- package/lib/module/screens/chat-detail/hooks/useUnreadIndicatorInList.js.map +1 -0
- package/lib/module/screens/chat-detail/legend/LegendChatUnreadButton.js +140 -0
- package/lib/module/screens/chat-detail/legend/LegendChatUnreadButton.js.map +1 -0
- package/lib/module/screens/chat-detail/legend/LegendChatUnreadDivider.js +51 -0
- package/lib/module/screens/chat-detail/legend/LegendChatUnreadDivider.js.map +1 -0
- package/lib/module/services/message.js +30 -0
- package/lib/module/services/message.js.map +1 -1
- package/lib/module/store/message.js +25 -4
- package/lib/module/store/message.js.map +1 -1
- package/lib/module/store/unreadIndicator.js +26 -0
- package/lib/module/store/unreadIndicator.js.map +1 -0
- package/lib/module/translation/resources/i18n.js +2 -0
- package/lib/module/translation/resources/i18n.js.map +1 -1
- package/lib/module/types/chat.js.map +1 -1
- package/lib/module/types/unreadIndicator.js +2 -0
- package/lib/module/types/unreadIndicator.js.map +1 -0
- package/lib/module/utils/markReadPolicy.js +25 -0
- package/lib/module/utils/markReadPolicy.js.map +1 -0
- package/lib/module/utils/promise.js +16 -0
- package/lib/module/utils/promise.js.map +1 -1
- package/lib/module/utils/unreadAnchor.js +57 -0
- package/lib/module/utils/unreadAnchor.js.map +1 -0
- package/lib/module/utils/unreadIndicatorState.js +96 -0
- package/lib/module/utils/unreadIndicatorState.js.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts +4 -1
- package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/hooks/createUnreadMarkReadGate.d.ts +9 -0
- package/lib/typescript/src/screens/chat-detail/hooks/createUnreadMarkReadGate.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useMarkConversationRead.d.ts +39 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useMarkConversationRead.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useUnreadAnchorSeen.d.ts +26 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useUnreadAnchorSeen.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useUnreadDeeplinkCheck.d.ts +17 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useUnreadDeeplinkCheck.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useUnreadIndicator.d.ts +21 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useUnreadIndicator.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useUnreadIndicatorInList.d.ts +35 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useUnreadIndicatorInList.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatUnreadButton.d.ts +8 -0
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatUnreadButton.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatUnreadDivider.d.ts +7 -0
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatUnreadDivider.d.ts.map +1 -0
- package/lib/typescript/src/services/message.d.ts +8 -0
- package/lib/typescript/src/services/message.d.ts.map +1 -1
- package/lib/typescript/src/store/message.d.ts.map +1 -1
- package/lib/typescript/src/store/unreadIndicator.d.ts +10 -0
- package/lib/typescript/src/store/unreadIndicator.d.ts.map +1 -0
- package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
- package/lib/typescript/src/types/chat.d.ts +3 -0
- package/lib/typescript/src/types/chat.d.ts.map +1 -1
- package/lib/typescript/src/types/events.d.ts +17 -1
- package/lib/typescript/src/types/events.d.ts.map +1 -1
- package/lib/typescript/src/types/unreadIndicator.d.ts +45 -0
- package/lib/typescript/src/types/unreadIndicator.d.ts.map +1 -0
- package/lib/typescript/src/utils/markReadPolicy.d.ts +27 -0
- package/lib/typescript/src/utils/markReadPolicy.d.ts.map +1 -0
- package/lib/typescript/src/utils/promise.d.ts +6 -0
- package/lib/typescript/src/utils/promise.d.ts.map +1 -1
- package/lib/typescript/src/utils/unreadAnchor.d.ts +33 -0
- package/lib/typescript/src/utils/unreadAnchor.d.ts.map +1 -0
- package/lib/typescript/src/utils/unreadIndicatorState.d.ts +26 -0
- package/lib/typescript/src/utils/unreadIndicatorState.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/screens/chat-detail/ChatDetail.tsx +58 -5
- package/src/screens/chat-detail/ChatListLegend.tsx +314 -46
- package/src/screens/chat-detail/hooks/createUnreadMarkReadGate.ts +41 -0
- package/src/screens/chat-detail/hooks/useMarkConversationRead.ts +197 -0
- package/src/screens/chat-detail/hooks/useUnreadAnchorSeen.ts +105 -0
- package/src/screens/chat-detail/hooks/useUnreadDeeplinkCheck.ts +68 -0
- package/src/screens/chat-detail/hooks/useUnreadIndicator.ts +112 -0
- package/src/screens/chat-detail/hooks/useUnreadIndicatorInList.ts +181 -0
- package/src/screens/chat-detail/legend/LegendChatUnreadButton.tsx +165 -0
- package/src/screens/chat-detail/legend/LegendChatUnreadDivider.tsx +52 -0
- package/src/services/message.ts +42 -0
- package/src/store/message.ts +23 -5
- package/src/store/unreadIndicator.ts +38 -0
- package/src/translation/resources/i18n.ts +2 -0
- package/src/types/chat.ts +3 -0
- package/src/types/events.ts +18 -1
- package/src/types/unreadIndicator.ts +49 -0
- package/src/utils/markReadPolicy.ts +55 -0
- package/src/utils/promise.ts +20 -0
- package/src/utils/unreadAnchor.ts +87 -0
- package/src/utils/unreadIndicatorState.ts +131 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type AdvancedGetMessageResult, type MessageItem } from '@droppii/openim-rn-client-sdk';
|
|
2
|
+
export declare const FIRST_UNREAD_TIMEOUT_MS = 5000;
|
|
2
3
|
export type HistoryMessageResult = AdvancedGetMessageResult & {
|
|
3
4
|
lastMinSeq?: number;
|
|
4
5
|
};
|
|
@@ -19,6 +20,13 @@ export declare namespace ChatMessageAPI {
|
|
|
19
20
|
count?: number;
|
|
20
21
|
}): Promise<import("@droppii/openim-rn-client-sdk").SearchMessageResult>;
|
|
21
22
|
function markConversationAsRead(conversationID: string): Promise<[unknown, unknown]>;
|
|
23
|
+
/**
|
|
24
|
+
* First unread message of the conversation, or `null` when there is none,
|
|
25
|
+
* the call fails, or it times out. Never throws. The server records the
|
|
26
|
+
* conversation's open time on this call, so callers invoke it once per
|
|
27
|
+
* visit.
|
|
28
|
+
*/
|
|
29
|
+
function getFirstUnreadMessage(conversationID: string, timeoutMs?: number): Promise<MessageItem | null>;
|
|
22
30
|
function getCurrentUserId(): Promise<string>;
|
|
23
31
|
}
|
|
24
32
|
export type { MessageItem };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/services/message.ts"],"names":[],"mappings":"AAAA,OAAkB,EAEhB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/services/message.ts"],"names":[],"mappings":"AAAA,OAAkB,EAEhB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;AAWvC,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GAAG;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,yBAAiB,cAAc,CAAC;IAC9B,SAAsB,oBAAoB,CACxC,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,GACA,OAAO,CAAC,oBAAoB,CAAC,CAQ/B;IAED,SAAsB,eAAe,CAAC,MAAM,EAAE;QAC5C,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,WAAW,CAAC,CAavB;IAED,SAAsB,mBAAmB,CACvC,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,wEASF;IAED,SAAsB,sBAAsB,CAAC,cAAc,EAAE,MAAM,+BAUlE;IAED;;;;;OAKG;IACH,SAAsB,qBAAqB,CACzC,cAAc,EAAE,MAAM,EACtB,SAAS,SAA0B,GAClC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAwB7B;IAED,SAAsB,gBAAgB,oBAErC;CACF;AAED,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/store/message.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAGV,YAAY,EACb,MAAM,eAAe,CAAC;AAcvB,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/store/message.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAGV,YAAY,EACb,MAAM,eAAe,CAAC;AAcvB,eAAO,MAAM,eAAe,2EAuOzB,CAAC;AAEJ,eAAO,MAAM,kBAAkB,GAAI,aAAa,MAAM,SAiBrD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UnreadIndicatorStore } from '../types/unreadIndicator';
|
|
2
|
+
/**
|
|
3
|
+
* Unread-indicator session for ChatDetail. A dedicated store rather than a
|
|
4
|
+
* slice of `useMessageStore`, whose `reset()` also runs on a deeplink target
|
|
5
|
+
* change. Module scope on purpose: the session outlives remounts of
|
|
6
|
+
* ChatDetail inside the same route (access re-check, SDK reconnect). Internal —
|
|
7
|
+
* not exported from `store/index.ts`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useUnreadIndicatorStore: import("zustand").UseBoundStore<import("zustand").StoreApi<UnreadIndicatorStore>>;
|
|
10
|
+
//# sourceMappingURL=unreadIndicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unreadIndicator.d.ts","sourceRoot":"","sources":["../../../../src/store/unreadIndicator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAYrE;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,mFAiBnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../../../src/translation/resources/i18n.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../../../src/translation/resources/i18n.ts"],"names":[],"mappings":";;;AAiPA,wBAEE"}
|
|
@@ -3,6 +3,7 @@ import type { PropsWithChildren } from 'react';
|
|
|
3
3
|
import type { IUrlMetadata } from './common';
|
|
4
4
|
import type { DFlowContext, IConversationFlow, IConversationFlowStep, InputButtonItem, IRunConversationFlowPayload } from './flows';
|
|
5
5
|
import type { GetOpenIMTokenResponse } from './auth';
|
|
6
|
+
import type { ScrollToMessageOptions } from './events';
|
|
6
7
|
import type { ChatDetailProps } from '../screens/chat-detail';
|
|
7
8
|
export declare const EventProvider: {
|
|
8
9
|
readonly ga: "ga";
|
|
@@ -179,6 +180,8 @@ export interface ISearchMessagesParams {
|
|
|
179
180
|
applicationType: DChatApplicationType;
|
|
180
181
|
conversationId?: string;
|
|
181
182
|
startClientMsgId: string;
|
|
183
|
+
/** Carried from the ScrollToMessage that triggered the search. */
|
|
184
|
+
scrollOptions?: ScrollToMessageOptions;
|
|
182
185
|
}
|
|
183
186
|
export interface MessageStore {
|
|
184
187
|
messages: MessageItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../../src/types/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AACjB,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AAEF,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,eAAe,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,oBAAoB,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,mFAAmF;AACnF,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,eAAe,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -7,8 +7,24 @@ export declare enum ChatEvent {
|
|
|
7
7
|
GroupRemoved = "chat:group_removed",
|
|
8
8
|
TargetMessageUnavailable = "chat:target_message_unavailable"
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface ScrollToMessageOptions {
|
|
11
|
+
/** Default true: highlight the target for 5s after landing. */
|
|
12
|
+
highlight?: boolean;
|
|
13
|
+
/** Default 0.5 (centred). */
|
|
14
|
+
viewPosition?: number;
|
|
15
|
+
viewOffset?: number;
|
|
16
|
+
/** Default true: an unavailable target toasts and navigates back. */
|
|
17
|
+
exitOnUnavailable?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Default true. False: an out-of-window jump loads the window but doesn't
|
|
20
|
+
* re-emit, because the caller re-resolves its own target.
|
|
21
|
+
*/
|
|
22
|
+
reemitAfterSearch?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ScrollToMessagePayload extends ScrollToMessageOptions {
|
|
11
25
|
clientMessageId: string;
|
|
26
|
+
/** @internal Set on post-search emits; stops a re-search loop. */
|
|
27
|
+
fromSearch?: boolean;
|
|
12
28
|
}
|
|
13
29
|
export interface MessageRevokedPayload {
|
|
14
30
|
clientMsgID: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/types/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,oBAAY,SAAS;IACnB,eAAe,2BAA2B;IAC1C,cAAc,0BAA0B;IACxC,cAAc,yBAAyB;IACvC,sBAAsB,kCAAkC;IACxD,YAAY,uBAAuB;IACnC,wBAAwB,oCAAoC;CAC7D;AAED,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/types/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,oBAAY,SAAS;IACnB,eAAe,2BAA2B;IAC1C,cAAc,0BAA0B;IACxC,cAAc,yBAAyB;IACvC,sBAAsB,kCAAkC;IACxD,YAAY,uBAAuB;IACnC,wBAAwB,oCAAoC;CAC7D;AAED,MAAM,WAAW,sBAAsB;IACrC,+DAA+D;IAC/D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACpE,eAAe,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,6BAA6B,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAElE,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;CACzC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** The validated first-unread message of a thread. */
|
|
2
|
+
export interface UnreadAnchor {
|
|
3
|
+
clientMsgID: string;
|
|
4
|
+
seq: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* One unread-indicator session per route visit. `token` identifies the
|
|
8
|
+
* session: every mutation after `begin` names the token it was issued for and
|
|
9
|
+
* is a no-op otherwise, so two ChatDetail instances of the same thread can't
|
|
10
|
+
* touch each other's session.
|
|
11
|
+
*/
|
|
12
|
+
export interface UnreadIndicatorState {
|
|
13
|
+
token: number;
|
|
14
|
+
routeKey?: string;
|
|
15
|
+
conversationId?: string;
|
|
16
|
+
/** The `getFirstUnreadMessage` lookup is in flight (mark-read gate). */
|
|
17
|
+
pending: boolean;
|
|
18
|
+
pendingSince: number;
|
|
19
|
+
anchor: UnreadAnchor | null;
|
|
20
|
+
pillDismissed: boolean;
|
|
21
|
+
/** Deeplink entry: hide the indicator until the D11 rule is decided. */
|
|
22
|
+
awaitingDeeplinkCheck: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* How the lookup phase ended: `resolve` (answered), `clear` (left the
|
|
25
|
+
* screen — blur), `hide` (D11 deeplink rule hid it; the user is still here).
|
|
26
|
+
*/
|
|
27
|
+
settledBy: 'resolve' | 'clear' | 'hide' | null;
|
|
28
|
+
}
|
|
29
|
+
export interface BeginUnreadSessionOptions {
|
|
30
|
+
routeKey: string;
|
|
31
|
+
conversationId: string;
|
|
32
|
+
/** Bot threads: no lookup, no indicator, gate open. */
|
|
33
|
+
skip: boolean;
|
|
34
|
+
awaitDeeplinkCheck: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface UnreadIndicatorStore extends UnreadIndicatorState {
|
|
37
|
+
begin: (options: BeginUnreadSessionOptions) => number;
|
|
38
|
+
resolve: (token: number, anchor: UnreadAnchor | null) => void;
|
|
39
|
+
clear: (token: number) => void;
|
|
40
|
+
dismissPill: (token: number) => void;
|
|
41
|
+
confirmDeeplinkCheck: (token: number, hide: boolean) => void;
|
|
42
|
+
rearmDeeplinkCheck: (token: number) => void;
|
|
43
|
+
reset: () => void;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=unreadIndicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unreadIndicator.d.ts","sourceRoot":"","sources":["../../../../src/types/unreadIndicator.ts"],"names":[],"mappings":"AAEA,sDAAsD;AACtD,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,wEAAwE;IACxE,qBAAqB,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,SAAS,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;CAChD;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,KAAK,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,MAAM,CAAC;IACtD,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9D,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7D,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When ChatDetail may mark the conversation read. Since OpenIM rc43 every
|
|
3
|
+
* call is a server round-trip (two SDK requests), so it's edge-triggered and
|
|
4
|
+
* throttled instead of fired on every scroll event. Pure, for unit tests.
|
|
5
|
+
*/
|
|
6
|
+
export type MarkReadReason = 'list-load' | 'reached-bottom' | 'incoming' | 'fab' | 'window-reload' | 'focus' | 'app-active' | 'gate-open' | 'leave';
|
|
7
|
+
export interface MarkReadInput {
|
|
8
|
+
reason: MarkReadReason;
|
|
9
|
+
/** The unread lookup hasn't answered yet (its anchor must be captured first). */
|
|
10
|
+
gateClosed: boolean;
|
|
11
|
+
focused: boolean;
|
|
12
|
+
appActive: boolean;
|
|
13
|
+
listLoaded: boolean;
|
|
14
|
+
/** The window isn't at the newest message (deeplink / jump window). */
|
|
15
|
+
hasMoreNew: boolean;
|
|
16
|
+
atBottom: boolean;
|
|
17
|
+
isDeeplinkFirstLoad: boolean;
|
|
18
|
+
/** A mark-read became due while the screen was focused. */
|
|
19
|
+
dirtyWhileFocused: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** A list (re)load just landed — not something the user did. */
|
|
22
|
+
export declare const isListLoadReason: (reason: MarkReadReason) => boolean;
|
|
23
|
+
export declare const shouldRequestMarkRead: (input: MarkReadInput) => boolean;
|
|
24
|
+
export declare const MARK_READ_THROTTLE_MS = 1000;
|
|
25
|
+
/** 0 → call now; otherwise the delay of the trailing call. */
|
|
26
|
+
export declare const nextMarkReadDelay: (now: number, lastCallAt: number, throttleMs?: number) => number;
|
|
27
|
+
//# sourceMappingURL=markReadPolicy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markReadPolicy.d.ts","sourceRoot":"","sources":["../../../../src/utils/markReadPolicy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,cAAc,GACtB,WAAW,GACX,gBAAgB,GAChB,UAAU,GACV,KAAK,GACL,eAAe,GACf,OAAO,GACP,YAAY,GACZ,WAAW,GACX,OAAO,CAAC;AAEZ,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,iFAAiF;IACjF,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,uEAAuE;IACvE,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,2DAA2D;IAC3D,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,GAAI,QAAQ,cAAc,KAAG,OACJ,CAAC;AAEvD,eAAO,MAAM,qBAAqB,GAAI,OAAO,aAAa,KAAG,OAS5D,CAAC;AAEF,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,GAC5B,KAAK,MAAM,EACX,YAAY,MAAM,EAClB,mBAAkC,KACjC,MAAoD,CAAC"}
|
|
@@ -10,4 +10,10 @@ export type SettledResult<T> = {
|
|
|
10
10
|
* ship it, so a rejection would otherwise short-circuit Promise.all.
|
|
11
11
|
*/
|
|
12
12
|
export declare const allSettled: <T extends readonly unknown[]>(promises: readonly [...T]) => Promise<{ [K in keyof T]: SettledResult<Awaited<T[K]>>; }>;
|
|
13
|
+
/**
|
|
14
|
+
* Rejects with `Error('timeout')` if `promise` hasn't settled within `ms`.
|
|
15
|
+
* A settle that lands after the timeout is ignored, and the timer is always
|
|
16
|
+
* cleared on settle so nothing is left pending.
|
|
17
|
+
*/
|
|
18
|
+
export declare const withTimeout: <T>(promise: Promise<T>, ms: number) => Promise<T>;
|
|
13
19
|
//# sourceMappingURL=promise.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../../../src/utils/promise.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,CAAC,CAAC,IACvB;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GACjC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,SAAS,OAAO,EAAE,EACrD,UAAU,SAAS,CAAC,GAAG,CAAC,CAAC,KACxB,OAAO,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAE,CAOK,CAAC"}
|
|
1
|
+
{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../../../src/utils/promise.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,CAAC,CAAC,IACvB;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GACjC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,SAAS,OAAO,EAAE,EACrD,UAAU,SAAS,CAAC,GAAG,CAAC,CAAC,KACxB,OAAO,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAE,CAOK,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,SAAS,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,MAAM,KAAG,OAAO,CAAC,CAAC,CAatE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { MessageItem } from '@droppii/openim-rn-client-sdk';
|
|
2
|
+
import type { UnreadAnchor } from '../types/unreadIndicator';
|
|
3
|
+
/** Height of the divider at the top of the anchor row (Figma: 27px). */
|
|
4
|
+
export declare const UNREAD_DIVIDER_HEIGHT = 27;
|
|
5
|
+
export declare const messageBelongsToConversation: (message: Pick<MessageItem, "sendID" | "recvID" | "groupID">, conversationId: string) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Validates the server's first-unread message before it's trusted: a finite
|
|
8
|
+
* positive `seq`, a non-empty `clientMsgID`, and a message that belongs to
|
|
9
|
+
* this conversation. Anything else → `null` (no indicator).
|
|
10
|
+
*/
|
|
11
|
+
export declare const toUnreadAnchor: (message: MessageItem | null | undefined, conversationId: string) => UnreadAnchor | null;
|
|
12
|
+
/**
|
|
13
|
+
* The list row that carries the divider: the first RENDERED message at or
|
|
14
|
+
* after the anchor. The anchor itself may be filtered out of the rendered list
|
|
15
|
+
* (internal / bot notification messages), so the match is by `seq` as well as
|
|
16
|
+
* by id. Only valid when the boundary is inside the loaded window — the raw
|
|
17
|
+
* window's oldest `seq` is at or before the anchor, or there's no older
|
|
18
|
+
* history — otherwise `null` (the anchor is out of window).
|
|
19
|
+
* Returns the row's list key (same as `keyExtractor` for real messages).
|
|
20
|
+
*/
|
|
21
|
+
export declare const resolveUnreadAnchorRowId: (rendered: readonly MessageItem[], anchor: UnreadAnchor | null, window: {
|
|
22
|
+
oldestLoadedSeq: number;
|
|
23
|
+
hasMoreOld: boolean;
|
|
24
|
+
}) => string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the top edge of a row (where the divider sits) is inside the
|
|
27
|
+
* viewport with at least `minVisiblePx` of it showing. A tall row clipped at
|
|
28
|
+
* the top — only its bottom part visible — does NOT count.
|
|
29
|
+
*/
|
|
30
|
+
export declare const isRowTopInViewport: (rowTop: number | undefined, scroll: number, scrollLength: number, minVisiblePx?: number) => boolean;
|
|
31
|
+
/** D11: a deeplink to a message older than the first unread hides the indicator. */
|
|
32
|
+
export declare const isDeeplinkTargetBeforeAnchor: (targetSeq?: number, anchorSeq?: number) => boolean;
|
|
33
|
+
//# sourceMappingURL=unreadAnchor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unreadAnchor.d.ts","sourceRoot":"","sources":["../../../../src/utils/unreadAnchor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAO7D,wEAAwE;AACxE,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,eAAO,MAAM,4BAA4B,GACvC,SAAS,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC,EAC3D,gBAAgB,MAAM,KACrB,OAKmE,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,SAAS,WAAW,GAAG,IAAI,GAAG,SAAS,EACvC,gBAAgB,MAAM,KACrB,YAAY,GAAG,IASjB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GACnC,UAAU,SAAS,WAAW,EAAE,EAChC,QAAQ,YAAY,GAAG,IAAI,EAC3B,QAAQ;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,KACvD,MAAM,GAAG,IAWX,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,MAAM,GAAG,SAAS,EAC1B,QAAQ,MAAM,EACd,cAAc,MAAM,EACpB,qBAAoC,KACnC,OAG6C,CAAC;AAEjD,oFAAoF;AACpF,eAAO,MAAM,4BAA4B,GACvC,YAAY,MAAM,EAClB,YAAY,MAAM,KACjB,OACmE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BeginUnreadSessionOptions, UnreadAnchor, UnreadIndicatorState } from '../types/unreadIndicator';
|
|
2
|
+
/**
|
|
3
|
+
* Pure transitions behind `useUnreadIndicatorStore` — kept free of React and
|
|
4
|
+
* zustand so they can be unit-tested. Every transition after `begin` is
|
|
5
|
+
* token-scoped: a token that isn't the current session's leaves the state
|
|
6
|
+
* untouched (same reference).
|
|
7
|
+
*/
|
|
8
|
+
export declare const UNREAD_GATE_WATCHDOG_SLACK_MS = 500;
|
|
9
|
+
export declare const INITIAL_UNREAD_INDICATOR_STATE: UnreadIndicatorState;
|
|
10
|
+
export declare const beginUnreadSession: (s: UnreadIndicatorState, { routeKey, conversationId, skip, awaitDeeplinkCheck, }: BeginUnreadSessionOptions, now: number) => UnreadIndicatorState;
|
|
11
|
+
export declare const resolveUnreadSession: (s: UnreadIndicatorState, token: number, anchor: UnreadAnchor | null) => UnreadIndicatorState;
|
|
12
|
+
export declare const clearUnreadSession: (s: UnreadIndicatorState, token: number) => UnreadIndicatorState;
|
|
13
|
+
export declare const dismissUnreadPill: (s: UnreadIndicatorState, token: number) => UnreadIndicatorState;
|
|
14
|
+
export declare const confirmUnreadDeeplinkCheck: (s: UnreadIndicatorState, token: number, hide: boolean) => UnreadIndicatorState;
|
|
15
|
+
export declare const rearmUnreadDeeplinkCheck: (s: UnreadIndicatorState, token: number) => UnreadIndicatorState;
|
|
16
|
+
export declare const resetUnreadSession: (s: UnreadIndicatorState) => UnreadIndicatorState;
|
|
17
|
+
/** When the watchdog opens a still-pending gate on its own. */
|
|
18
|
+
export declare const getUnreadGateDeadline: (s: UnreadIndicatorState, timeoutMs: number) => number;
|
|
19
|
+
/**
|
|
20
|
+
* Whether mark-read must wait. Closed only for MY session while its lookup is
|
|
21
|
+
* still pending and within the watchdog deadline. No session yet (not focused,
|
|
22
|
+
* or access not confirmed) is fail-closed; a session superseded by another
|
|
23
|
+
* visit is not this screen's gate.
|
|
24
|
+
*/
|
|
25
|
+
export declare const isUnreadGateClosed: (s: UnreadIndicatorState, myToken: number | null, now: number, timeoutMs: number) => boolean;
|
|
26
|
+
//# sourceMappingURL=unreadIndicatorState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unreadIndicatorState.d.ts","sourceRoot":"","sources":["../../../../src/utils/unreadIndicatorState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,YAAY,EACZ,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAElC;;;;;GAKG;AAIH,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,eAAO,MAAM,8BAA8B,EAAE,oBAU5C,CAAC;AAIF,eAAO,MAAM,kBAAkB,GAC7B,GAAG,oBAAoB,EACvB,yDAKG,yBAAyB,EAC5B,KAAK,MAAM,KACV,oBAQD,CAAC;AAEH,eAAO,MAAM,oBAAoB,GAC/B,GAAG,oBAAoB,EACvB,OAAO,MAAM,EACb,QAAQ,YAAY,GAAG,IAAI,KAC1B,oBAGyD,CAAC;AAI7D,eAAO,MAAM,kBAAkB,GAC7B,GAAG,oBAAoB,EACvB,OAAO,MAAM,KACZ,oBAUI,CAAC;AAER,eAAO,MAAM,iBAAiB,GAC5B,GAAG,oBAAoB,EACvB,OAAO,MAAM,KACZ,oBACuE,CAAC;AAE3E,eAAO,MAAM,0BAA0B,GACrC,GAAG,oBAAoB,EACvB,OAAO,MAAM,EACb,MAAM,OAAO,KACZ,oBAMF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,GAAG,oBAAoB,EACvB,OAAO,MAAM,KACZ,oBAGwC,CAAC;AAE5C,eAAO,MAAM,kBAAkB,GAC7B,GAAG,oBAAoB,KACtB,oBAGD,CAAC;AAEH,+DAA+D;AAC/D,eAAO,MAAM,qBAAqB,GAChC,GAAG,oBAAoB,EACvB,WAAW,MAAM,KAChB,MAAoE,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,GAAG,oBAAoB,EACvB,SAAS,MAAM,GAAG,IAAI,EACtB,KAAK,MAAM,EACX,WAAW,MAAM,KAChB,OAIF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@droppii-org/chat-mobile",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.110",
|
|
4
4
|
"description": "Droppii chat mobile",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"example-legacy": "yarn workspace @droppii-org/chat-mobile-example-legacy"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@droppii/openim-rn-client-sdk": "git+ssh://git@github.com/droppii/open-im-sdk-reactnative.git#v1.0.0-
|
|
73
|
+
"@droppii/openim-rn-client-sdk": "git+ssh://git@github.com/droppii/open-im-sdk-reactnative.git#v1.0.0-rc44",
|
|
74
74
|
"@legendapp/list": "^3.3.10",
|
|
75
75
|
"axios": "^1.16.1",
|
|
76
76
|
"lodash": "^4.18.1",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { memo, useCallback, useEffect, useRef } from 'react';
|
|
1
|
+
import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { DeviceEventEmitter } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useKeyboardScrollToEnd } from '@legendapp/list/keyboard';
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
} from '../../hooks/conversation/useGetConversationDetail';
|
|
41
41
|
import {
|
|
42
42
|
GroupJoinSource,
|
|
43
|
+
PeerType,
|
|
43
44
|
type MessageItem,
|
|
44
45
|
} from '@droppii/openim-rn-client-sdk';
|
|
45
46
|
import { useMessages } from '../../hooks/message/useMessages';
|
|
@@ -51,7 +52,12 @@ import { useSingleAccessGuard } from '../../hooks/conversation/useSingleAccessGu
|
|
|
51
52
|
import { useIsJoinedGroup } from '../../hooks/useIsJoinedGroup';
|
|
52
53
|
import { UIUtils } from '../../utils/UIUtils';
|
|
53
54
|
import { trans } from '../../translation';
|
|
54
|
-
import {
|
|
55
|
+
import {
|
|
56
|
+
getGroupIdFromConversationId,
|
|
57
|
+
isConversationParticipant,
|
|
58
|
+
isSingleConversationId,
|
|
59
|
+
} from '../../utils/conversation';
|
|
60
|
+
import { useUnreadIndicator } from './hooks/useUnreadIndicator';
|
|
55
61
|
import { ChatDetailLoading } from './components/ChatDetailLoading';
|
|
56
62
|
|
|
57
63
|
interface ChatDetailScreenProps extends Omit<
|
|
@@ -111,6 +117,25 @@ const ChatDetail = memo(
|
|
|
111
117
|
[]
|
|
112
118
|
);
|
|
113
119
|
|
|
120
|
+
// Bot from the conversation itself: ChatDetailContext's flag is derived
|
|
121
|
+
// from an id this screen sets in an effect, so it's still false on the
|
|
122
|
+
// first effect pass.
|
|
123
|
+
const isBotThread = conversation?.peerType === PeerType.Bot;
|
|
124
|
+
// 1v1: only a participant may look up / mark read. Groups: the gate's
|
|
125
|
+
// `isReady` already enforced join/access before this screen mounted.
|
|
126
|
+
const accessConfirmed =
|
|
127
|
+
!!currentUser?.userID &&
|
|
128
|
+
(!isSingleConversationId(conversationId) ||
|
|
129
|
+
isConversationParticipant(conversationId, currentUser.userID));
|
|
130
|
+
// Must stay above useMessages (see useUnreadDeeplinkCheck).
|
|
131
|
+
const { unreadToken, unreadTokenRef, markChildNavigation } =
|
|
132
|
+
useUnreadIndicator({
|
|
133
|
+
conversationId,
|
|
134
|
+
isBotConversation: isBotThread,
|
|
135
|
+
targetMessageId,
|
|
136
|
+
accessConfirmed,
|
|
137
|
+
});
|
|
138
|
+
|
|
114
139
|
const {
|
|
115
140
|
messages,
|
|
116
141
|
initLoading,
|
|
@@ -222,9 +247,34 @@ const ChatDetail = memo(
|
|
|
222
247
|
});
|
|
223
248
|
}, [currentUser, unpinMessage, customMessageItemFactory]);
|
|
224
249
|
|
|
250
|
+
// Library-initiated child navigation keeps the unread indicator across the
|
|
251
|
+
// blur it causes; markChildNavigation must run before the callback does.
|
|
225
252
|
const handlePressMenu = useCallback(() => {
|
|
253
|
+
markChildNavigation();
|
|
226
254
|
onPressMenu?.(conversationId);
|
|
227
|
-
}, [conversationId, onPressMenu]);
|
|
255
|
+
}, [conversationId, onPressMenu, markChildNavigation]);
|
|
256
|
+
|
|
257
|
+
const handlePressSearch = useMemo(
|
|
258
|
+
() =>
|
|
259
|
+
onPressSearch
|
|
260
|
+
? (id: string) => {
|
|
261
|
+
markChildNavigation();
|
|
262
|
+
onPressSearch(id);
|
|
263
|
+
}
|
|
264
|
+
: undefined,
|
|
265
|
+
[onPressSearch, markChildNavigation]
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
const handlePressAddMember = useMemo(
|
|
269
|
+
() =>
|
|
270
|
+
onPressAddMember
|
|
271
|
+
? () => {
|
|
272
|
+
markChildNavigation();
|
|
273
|
+
onPressAddMember();
|
|
274
|
+
}
|
|
275
|
+
: undefined,
|
|
276
|
+
[onPressAddMember, markChildNavigation]
|
|
277
|
+
);
|
|
228
278
|
|
|
229
279
|
const handlePressJoinGroup = useCallback(() => {
|
|
230
280
|
if (!conversation?.groupID) return;
|
|
@@ -248,8 +298,8 @@ const ChatDetail = memo(
|
|
|
248
298
|
targetUserId={targetUserId}
|
|
249
299
|
showAddMember={resolvedShowAddMember}
|
|
250
300
|
onBack={onBack ?? handleBackDefault}
|
|
251
|
-
onPressSearch={
|
|
252
|
-
onPressAddMember={
|
|
301
|
+
onPressSearch={handlePressSearch}
|
|
302
|
+
onPressAddMember={handlePressAddMember}
|
|
253
303
|
onPressMenu={handlePressMenu}
|
|
254
304
|
onPressAvatar={handlePressMenu}
|
|
255
305
|
/>
|
|
@@ -283,6 +333,9 @@ const ChatDetail = memo(
|
|
|
283
333
|
dismissAreaTouchProps={dismissAreaTouchProps}
|
|
284
334
|
isComposerPanelOpen={isComposerPanelOpen}
|
|
285
335
|
onDismissAreaScrollBeginDrag={notifyScrollBeginDrag}
|
|
336
|
+
unreadToken={unreadToken}
|
|
337
|
+
unreadTokenRef={unreadTokenRef}
|
|
338
|
+
deeplinkTargetId={targetMessageId || undefined}
|
|
286
339
|
/>
|
|
287
340
|
</TimelinePressGuardProvider>
|
|
288
341
|
|