@droppii-org/chat-mobile 0.2.86 → 0.2.88
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/core/useChatListener.js +4 -0
- package/lib/module/core/useChatListener.js.map +1 -1
- package/lib/module/hooks/contacts/useSearchContacts.js +3 -2
- package/lib/module/hooks/contacts/useSearchContacts.js.map +1 -1
- package/lib/module/hooks/groups/useDismissGroup.js +6 -0
- package/lib/module/hooks/groups/useDismissGroup.js.map +1 -1
- package/lib/module/hooks/groups/useFetchPublicGroup.js +3 -2
- package/lib/module/hooks/groups/useFetchPublicGroup.js.map +1 -1
- package/lib/module/hooks/groups/useGroupAccessGuard.js +6 -0
- package/lib/module/hooks/groups/useGroupAccessGuard.js.map +1 -1
- package/lib/module/hooks/groups/useLeaveGroup.js +9 -2
- package/lib/module/hooks/groups/useLeaveGroup.js.map +1 -1
- package/lib/module/hooks/message/useSearchMessage.js +3 -2
- package/lib/module/hooks/message/useSearchMessage.js.map +1 -1
- package/lib/module/screens/SearchConversation/SearchAllResult.js +29 -22
- package/lib/module/screens/SearchConversation/SearchAllResult.js.map +1 -1
- package/lib/module/screens/SearchConversation/SearchCommunityResult.js +3 -2
- package/lib/module/screens/SearchConversation/SearchCommunityResult.js.map +1 -1
- package/lib/module/screens/SearchConversation/SearchContactsResult.js +4 -2
- package/lib/module/screens/SearchConversation/SearchContactsResult.js.map +1 -1
- package/lib/module/screens/SearchConversation/SearchMessagesResult.js +4 -2
- package/lib/module/screens/SearchConversation/SearchMessagesResult.js.map +1 -1
- package/lib/module/screens/SearchConversation/TabResult.js +10 -5
- package/lib/module/screens/SearchConversation/TabResult.js.map +1 -1
- package/lib/module/utils/groupExit.js +25 -0
- package/lib/module/utils/groupExit.js.map +1 -0
- package/lib/typescript/src/core/useChatListener.d.ts.map +1 -1
- package/lib/typescript/src/hooks/contacts/useSearchContacts.d.ts +2 -1
- package/lib/typescript/src/hooks/contacts/useSearchContacts.d.ts.map +1 -1
- package/lib/typescript/src/hooks/groups/useDismissGroup.d.ts.map +1 -1
- package/lib/typescript/src/hooks/groups/useFetchPublicGroup.d.ts +1 -1
- package/lib/typescript/src/hooks/groups/useFetchPublicGroup.d.ts.map +1 -1
- package/lib/typescript/src/hooks/groups/useGroupAccessGuard.d.ts.map +1 -1
- package/lib/typescript/src/hooks/groups/useLeaveGroup.d.ts.map +1 -1
- package/lib/typescript/src/hooks/message/useSearchMessage.d.ts +2 -1
- package/lib/typescript/src/hooks/message/useSearchMessage.d.ts.map +1 -1
- package/lib/typescript/src/screens/SearchConversation/SearchAllResult.d.ts +2 -1
- package/lib/typescript/src/screens/SearchConversation/SearchAllResult.d.ts.map +1 -1
- package/lib/typescript/src/screens/SearchConversation/SearchCommunityResult.d.ts +2 -1
- package/lib/typescript/src/screens/SearchConversation/SearchCommunityResult.d.ts.map +1 -1
- package/lib/typescript/src/screens/SearchConversation/SearchContactsResult.d.ts +2 -1
- package/lib/typescript/src/screens/SearchConversation/SearchContactsResult.d.ts.map +1 -1
- package/lib/typescript/src/screens/SearchConversation/SearchMessagesResult.d.ts +2 -1
- package/lib/typescript/src/screens/SearchConversation/SearchMessagesResult.d.ts.map +1 -1
- package/lib/typescript/src/screens/SearchConversation/TabResult.d.ts.map +1 -1
- package/lib/typescript/src/utils/groupExit.d.ts +4 -0
- package/lib/typescript/src/utils/groupExit.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/core/useChatListener.ts +4 -0
- package/src/hooks/contacts/useSearchContacts.ts +3 -1
- package/src/hooks/groups/useDismissGroup.tsx +8 -0
- package/src/hooks/groups/useFetchPublicGroup.ts +2 -1
- package/src/hooks/groups/useGroupAccessGuard.ts +6 -0
- package/src/hooks/groups/useLeaveGroup.tsx +12 -2
- package/src/hooks/message/useSearchMessage.ts +3 -1
- package/src/screens/SearchConversation/SearchAllResult.tsx +25 -15
- package/src/screens/SearchConversation/SearchCommunityResult.tsx +7 -2
- package/src/screens/SearchConversation/SearchContactsResult.tsx +7 -1
- package/src/screens/SearchConversation/SearchMessagesResult.tsx +7 -1
- package/src/screens/SearchConversation/TabResult.tsx +7 -0
- package/src/utils/groupExit.ts +26 -0
|
@@ -18,6 +18,7 @@ import { SearchConversationTabResultType } from './types';
|
|
|
18
18
|
interface ISearchContactsResultProps {
|
|
19
19
|
searchTerm: string;
|
|
20
20
|
onPressSearchContact?: (item: IContactSearchItem) => void;
|
|
21
|
+
isActive?: boolean;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
const FILTER_ITEMS: KTagsChoiceSlideBarItemProps[] = [
|
|
@@ -44,7 +45,11 @@ const FILTER_ITEMS: KTagsChoiceSlideBarItemProps[] = [
|
|
|
44
45
|
];
|
|
45
46
|
|
|
46
47
|
const SearchContactsResult = memo(
|
|
47
|
-
({
|
|
48
|
+
({
|
|
49
|
+
searchTerm,
|
|
50
|
+
onPressSearchContact,
|
|
51
|
+
isActive = true,
|
|
52
|
+
}: ISearchContactsResultProps) => {
|
|
48
53
|
const { applicationType } = useChatContext();
|
|
49
54
|
const [contactType, setContactType] = useState<
|
|
50
55
|
ContactCategory | undefined
|
|
@@ -62,6 +67,7 @@ const SearchContactsResult = memo(
|
|
|
62
67
|
query: searchTerm,
|
|
63
68
|
applicationType,
|
|
64
69
|
type: contactType,
|
|
70
|
+
enabled: isActive,
|
|
65
71
|
});
|
|
66
72
|
|
|
67
73
|
const onFilterChanged = useCallback(
|
|
@@ -11,9 +11,14 @@ import { SearchEmpty } from './SearchEmpty';
|
|
|
11
11
|
interface ISearchMessagesResultProps {
|
|
12
12
|
searchTerm: string;
|
|
13
13
|
onPressItem?: (item: ISearchMessageItem) => void;
|
|
14
|
+
isActive?: boolean;
|
|
14
15
|
}
|
|
15
16
|
const SearchMessagesResult = memo(
|
|
16
|
-
({
|
|
17
|
+
({
|
|
18
|
+
searchTerm,
|
|
19
|
+
onPressItem,
|
|
20
|
+
isActive = true,
|
|
21
|
+
}: ISearchMessagesResultProps) => {
|
|
17
22
|
const { applicationType } = useChatContext();
|
|
18
23
|
const {
|
|
19
24
|
dataFlatten,
|
|
@@ -26,6 +31,7 @@ const SearchMessagesResult = memo(
|
|
|
26
31
|
} = useSearchMessage({
|
|
27
32
|
query: searchTerm,
|
|
28
33
|
applicationType,
|
|
34
|
+
enabled: isActive,
|
|
29
35
|
});
|
|
30
36
|
|
|
31
37
|
const renderItem = useCallback(
|
|
@@ -87,6 +87,7 @@ const SearchConversationTabResult = memo(
|
|
|
87
87
|
|
|
88
88
|
const renderScene = useCallback(
|
|
89
89
|
({ route }: { route: TabRoute }) => {
|
|
90
|
+
const isActive = route.key === routes[index]?.key;
|
|
90
91
|
switch (route.key) {
|
|
91
92
|
case SearchConversationTabResultType.All:
|
|
92
93
|
return (
|
|
@@ -95,6 +96,7 @@ const SearchConversationTabResult = memo(
|
|
|
95
96
|
handleChangeTab={handleChangeTab}
|
|
96
97
|
onPressItem={onPressItem}
|
|
97
98
|
onPressSearchContact={onPressSearchContact}
|
|
99
|
+
isActive={isActive}
|
|
98
100
|
/>
|
|
99
101
|
);
|
|
100
102
|
case SearchConversationTabResultType.Conversations:
|
|
@@ -102,6 +104,7 @@ const SearchConversationTabResult = memo(
|
|
|
102
104
|
<SearchContactsResult
|
|
103
105
|
searchTerm={searchTerm}
|
|
104
106
|
onPressSearchContact={onPressSearchContact}
|
|
107
|
+
isActive={isActive}
|
|
105
108
|
/>
|
|
106
109
|
);
|
|
107
110
|
case SearchConversationTabResultType.Messages:
|
|
@@ -109,6 +112,7 @@ const SearchConversationTabResult = memo(
|
|
|
109
112
|
<SearchMessagesResult
|
|
110
113
|
searchTerm={searchTerm}
|
|
111
114
|
onPressItem={onPressItem}
|
|
115
|
+
isActive={isActive}
|
|
112
116
|
/>
|
|
113
117
|
);
|
|
114
118
|
case SearchConversationTabResultType.Community:
|
|
@@ -116,6 +120,7 @@ const SearchConversationTabResult = memo(
|
|
|
116
120
|
<SearchCommunityResult
|
|
117
121
|
searchTerm={searchTerm}
|
|
118
122
|
onPressGroup={onPressGroup}
|
|
123
|
+
isActive={isActive}
|
|
119
124
|
/>
|
|
120
125
|
);
|
|
121
126
|
default:
|
|
@@ -128,6 +133,8 @@ const SearchConversationTabResult = memo(
|
|
|
128
133
|
onPressItem,
|
|
129
134
|
onPressSearchContact,
|
|
130
135
|
onPressGroup,
|
|
136
|
+
index,
|
|
137
|
+
routes,
|
|
131
138
|
]
|
|
132
139
|
);
|
|
133
140
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Groups this user deliberately left or dismissed.
|
|
3
|
+
*
|
|
4
|
+
* Leaving fires the same SDK callbacks as being removed by someone else, and
|
|
5
|
+
* the `reason` on ChatEvent.GroupRemoved cannot tell them apart —
|
|
6
|
+
* OnJoinedGroupDeleted reports a self-initiated quit and a kick identically.
|
|
7
|
+
* The access guard needs the distinction: losing access is worth a modal, but
|
|
8
|
+
* walking out is not — the screen that asked for it is already navigating away,
|
|
9
|
+
* so a modal would land on the inbox the user just arrived at.
|
|
10
|
+
*
|
|
11
|
+
* Cleared on rejoin, so a later involuntary removal of the same group is
|
|
12
|
+
* treated as one. Deliberately not time-based: a timer would make correctness
|
|
13
|
+
* depend on how fast the SDK round-trips.
|
|
14
|
+
*/
|
|
15
|
+
const selfExitedGroups = new Set<string>();
|
|
16
|
+
|
|
17
|
+
export const markSelfExitedGroup = (groupID: string): void => {
|
|
18
|
+
if (groupID) selfExitedGroups.add(groupID);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const clearSelfExitedGroup = (groupID: string): void => {
|
|
22
|
+
selfExitedGroups.delete(groupID);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const wasSelfExitedGroup = (groupID: string): boolean =>
|
|
26
|
+
selfExitedGroups.has(groupID);
|