@messenger-box/platform-mobile 10.0.3-alpha.20 → 10.0.3-alpha.201
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/components/messages-container-ui/BuildModeView.js +428 -0
- package/lib/components/messages-container-ui/BuildModeView.js.map +1 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.js +55 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.js.map +1 -0
- package/lib/components/messages-container-ui/PlanModeView.js +336 -0
- package/lib/components/messages-container-ui/PlanModeView.js.map +1 -0
- package/lib/compute.js +2 -3
- package/lib/compute.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/module.js.map +1 -1
- package/lib/queries/inboxQueries.js +62 -0
- package/lib/queries/inboxQueries.js.map +1 -0
- package/lib/routes.json +2 -3
- package/lib/screens/inbox/DialogMessages.js +8 -3
- package/lib/screens/inbox/DialogMessages.js.map +1 -1
- package/lib/screens/inbox/DialogThreadMessages.js +6 -11
- package/lib/screens/inbox/DialogThreadMessages.js.map +1 -1
- package/lib/screens/inbox/DialogThreads.js +58 -20
- package/lib/screens/inbox/DialogThreads.js.map +1 -1
- package/lib/screens/inbox/Inbox.js.map +1 -1
- package/lib/screens/inbox/components/CachedImage/consts.js +1 -1
- package/lib/screens/inbox/components/CachedImage/consts.js.map +1 -1
- package/lib/screens/inbox/components/CachedImage/index.js +125 -115
- package/lib/screens/inbox/components/CachedImage/index.js.map +1 -1
- package/lib/screens/inbox/components/DialogItem.js +160 -0
- package/lib/screens/inbox/components/DialogItem.js.map +1 -0
- package/lib/screens/inbox/components/GiftedChatInboxComponent.js +315 -0
- package/lib/screens/inbox/components/GiftedChatInboxComponent.js.map +1 -0
- package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.js +3 -1
- package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.js.map +1 -1
- package/lib/screens/inbox/components/SlackMessageContainer/PaymentMessage.js +194 -0
- package/lib/screens/inbox/components/SlackMessageContainer/PaymentMessage.js.map +1 -0
- package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js +149 -36
- package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js.map +1 -1
- package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js +4 -5
- package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js.map +1 -1
- package/lib/screens/inbox/components/SubscriptionHandler.js +22 -0
- package/lib/screens/inbox/components/SubscriptionHandler.js.map +1 -0
- package/lib/screens/inbox/components/ThreadsViewItem.js +67 -47
- package/lib/screens/inbox/components/ThreadsViewItem.js.map +1 -1
- package/lib/screens/inbox/config/config.js +4 -2
- package/lib/screens/inbox/config/config.js.map +1 -1
- package/lib/screens/inbox/containers/ConversationView.js +1099 -1094
- package/lib/screens/inbox/containers/ConversationView.js.map +1 -1
- package/lib/screens/inbox/containers/Dialogs.js +132 -534
- package/lib/screens/inbox/containers/Dialogs.js.map +1 -1
- package/lib/screens/inbox/containers/ThreadConversationView.js +876 -1357
- package/lib/screens/inbox/containers/ThreadConversationView.js.map +1 -1
- package/lib/screens/inbox/containers/ThreadsView.js +81 -54
- package/lib/screens/inbox/containers/ThreadsView.js.map +1 -1
- package/lib/screens/inbox/hooks/useInboxMessages.js +31 -0
- package/lib/screens/inbox/hooks/useInboxMessages.js.map +1 -0
- package/lib/screens/inbox/hooks/useSafeDialogThreadsMachine.js +108 -0
- package/lib/screens/inbox/hooks/useSafeDialogThreadsMachine.js.map +1 -0
- package/lib/screens/inbox/workflow/dialog-threads-xstate.js +151 -0
- package/lib/screens/inbox/workflow/dialog-threads-xstate.js.map +1 -0
- package/package.json +9 -7
- package/CHANGELOG.md +0 -164
- package/jest.config.js +0 -24
- package/lib/screens/inbox/components/DialogsListItem.js +0 -548
- package/lib/screens/inbox/components/DialogsListItem.js.map +0 -1
- package/lib/screens/inbox/components/ServiceDialogsListItem.js +0 -489
- package/lib/screens/inbox/components/ServiceDialogsListItem.js.map +0 -1
- package/lib/screens/inbox/components/workflow/dialogs-list-item-xstate.js +0 -175
- package/lib/screens/inbox/components/workflow/dialogs-list-item-xstate.js.map +0 -1
- package/lib/screens/inbox/components/workflow/service-dialogs-list-item-xstate.js +0 -191
- package/lib/screens/inbox/components/workflow/service-dialogs-list-item-xstate.js.map +0 -1
- package/lib/screens/inbox/containers/workflow/conversation-xstate.js +0 -380
- package/lib/screens/inbox/containers/workflow/conversation-xstate.js.map +0 -1
- package/lib/screens/inbox/containers/workflow/dialogs-xstate.js +0 -211
- package/lib/screens/inbox/containers/workflow/dialogs-xstate.js.map +0 -1
- package/lib/screens/inbox/containers/workflow/thread-conversation-xstate.js +0 -438
- package/lib/screens/inbox/containers/workflow/thread-conversation-xstate.js.map +0 -1
- package/rollup.config.mjs +0 -45
- package/src/components/index.ts +0 -0
- package/src/compute.ts +0 -63
- package/src/index.ts +0 -7
- package/src/module.ts +0 -10
- package/src/navigation/InboxNavigation.tsx +0 -102
- package/src/navigation/index.ts +0 -1
- package/src/screens/inbox/DialogMessages.tsx +0 -21
- package/src/screens/inbox/DialogThreadMessages.tsx +0 -97
- package/src/screens/inbox/DialogThreads.tsx +0 -129
- package/src/screens/inbox/Inbox.tsx +0 -17
- package/src/screens/inbox/components/CachedImage/consts.ts +0 -6
- package/src/screens/inbox/components/CachedImage/index.tsx +0 -223
- package/src/screens/inbox/components/DialogsHeader.tsx +0 -30
- package/src/screens/inbox/components/DialogsListItem.tsx +0 -819
- package/src/screens/inbox/components/ServiceDialogsListItem.tsx +0 -679
- package/src/screens/inbox/components/SlackMessageContainer/ImageViewerModal.tsx +0 -113
- package/src/screens/inbox/components/SlackMessageContainer/SlackBubble.tsx +0 -313
- package/src/screens/inbox/components/SlackMessageContainer/SlackMessage.tsx +0 -145
- package/src/screens/inbox/components/SlackMessageContainer/index.ts +0 -3
- package/src/screens/inbox/components/SupportServiceDialogsListItem.tsx +0 -301
- package/src/screens/inbox/components/ThreadsViewItem.tsx +0 -321
- package/src/screens/inbox/components/workflow/dialogs-list-item-xstate.ts +0 -145
- package/src/screens/inbox/components/workflow/service-dialogs-list-item-xstate.ts +0 -159
- package/src/screens/inbox/config/config.ts +0 -15
- package/src/screens/inbox/config/index.ts +0 -1
- package/src/screens/inbox/containers/ConversationView.tsx +0 -1782
- package/src/screens/inbox/containers/Dialogs.tsx +0 -794
- package/src/screens/inbox/containers/SupportServiceDialogs.tsx +0 -119
- package/src/screens/inbox/containers/ThreadConversationView.tsx +0 -2312
- package/src/screens/inbox/containers/ThreadsView.tsx +0 -305
- package/src/screens/inbox/containers/workflow/apollo/handleResult.ts +0 -20
- package/src/screens/inbox/containers/workflow/conversation-xstate.ts +0 -313
- package/src/screens/inbox/containers/workflow/dialogs-xstate.ts +0 -196
- package/src/screens/inbox/containers/workflow/thread-conversation-xstate.ts +0 -401
- package/src/screens/index.ts +0 -4
- package/tsconfig.json +0 -13
- package/webpack.config.js +0 -58
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React__default,{useRef,useCallback,useEffect
|
|
1
|
+
import React__default,{useState,useRef,useMemo,useCallback,useEffect}from'react';import {Center,Spinner,Text,Box,FlatList}from'@admin-layout/gluestack-ui-mobile';import {Ionicons}from'@expo/vector-icons';import {useSelector,shallowEqual}from'react-redux';import {useRoute,useNavigation,useFocusEffect}from'@react-navigation/native';import {DialogItem}from'../components/DialogItem.js';import {useGetChannelsByUserWithLastMessageQuery}from'common/graphql';import {RoomType}from'common';import {userSelector}from'@adminide-stack/user-auth0-client';import {config}from'../config/config.js';import colors from'tailwindcss/colors';var __defProp = Object.defineProperty;
|
|
2
2
|
var __defProps = Object.defineProperties;
|
|
3
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -17,576 +17,174 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
const Actions = {
|
|
21
|
-
INITIAL_CONTEXT: "INITIAL_CONTEXT",
|
|
22
|
-
ERROR_HANDLED: "ERROR_HANDLED",
|
|
23
|
-
FETCH_CHANNELS: "FETCH_CHANNELS",
|
|
24
|
-
APPEND_CHANNELS: "APPEND_CHANNELS",
|
|
25
|
-
REFRESH_CHANNELS: "REFRESH_CHANNELS",
|
|
26
|
-
SELECT_CHANNEL: "SELECT_CHANNEL",
|
|
27
|
-
START_LOADING: "START_LOADING",
|
|
28
|
-
STOP_LOADING: "STOP_LOADING",
|
|
29
|
-
LOAD_MORE_CHANNELS: "LOAD_MORE_CHANNELS",
|
|
30
|
-
SET_SEARCH_QUERY: "SET_SEARCH_QUERY"
|
|
31
|
-
};
|
|
32
|
-
const BaseState = {
|
|
33
|
-
Idle: "idle",
|
|
34
|
-
Error: "error",
|
|
35
|
-
Loading: "loading",
|
|
36
|
-
Done: "done",
|
|
37
|
-
FetchChannels: "fetchChannels"
|
|
38
|
-
};
|
|
39
|
-
const MainState = {
|
|
40
|
-
RefreshChannels: "refreshChannels",
|
|
41
|
-
SelectChannel: "selectChannel",
|
|
42
|
-
LoadMoreChannels: "loadMoreChannels"
|
|
43
|
-
};
|
|
44
|
-
function useSafeMachine(machine) {
|
|
45
|
-
const [state, setState] = useState({
|
|
46
|
-
context: {
|
|
47
|
-
channels: [],
|
|
48
|
-
refreshing: false,
|
|
49
|
-
loading: false,
|
|
50
|
-
error: null,
|
|
51
|
-
searchQuery: "",
|
|
52
|
-
selectedChannelId: null,
|
|
53
|
-
channelRole: null,
|
|
54
|
-
channelFilters: {},
|
|
55
|
-
supportServices: false,
|
|
56
|
-
page: 1,
|
|
57
|
-
hasMoreChannels: true,
|
|
58
|
-
loadingMore: false
|
|
59
|
-
},
|
|
60
|
-
value: "idle"
|
|
61
|
-
});
|
|
62
|
-
const send = useCallback((event) => {
|
|
63
|
-
var _a, _b, _c, _d;
|
|
64
|
-
try {
|
|
65
|
-
console.log("Event received:", event.type);
|
|
66
|
-
if (event.type === Actions.INITIAL_CONTEXT) {
|
|
67
|
-
setState((prev) => {
|
|
68
|
-
var _a2, _b2, _c2, _d2;
|
|
69
|
-
return __spreadProps(__spreadValues({}, prev), {
|
|
70
|
-
context: __spreadProps(__spreadValues({}, prev.context), {
|
|
71
|
-
channelRole: ((_a2 = event.data) == null ? void 0 : _a2.channelRole) || null,
|
|
72
|
-
channelFilters: ((_b2 = event.data) == null ? void 0 : _b2.channelFilters) || {},
|
|
73
|
-
supportServices: ((_c2 = event.data) == null ? void 0 : _c2.supportServices) || false,
|
|
74
|
-
selectedChannelId: ((_d2 = event.data) == null ? void 0 : _d2.selectedChannelId) || null,
|
|
75
|
-
loading: true,
|
|
76
|
-
page: 1,
|
|
77
|
-
hasMoreChannels: true
|
|
78
|
-
}),
|
|
79
|
-
value: BaseState.FetchChannels
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
} else if (event.type === Actions.FETCH_CHANNELS) {
|
|
83
|
-
console.log("Setting channels:", ((_b = (_a = event.data) == null ? void 0 : _a.channels) == null ? void 0 : _b.length) || 0);
|
|
84
|
-
setState((prev) => {
|
|
85
|
-
var _a2, _b2, _c2, _d2, _e;
|
|
86
|
-
return __spreadProps(__spreadValues({}, prev), {
|
|
87
|
-
context: __spreadProps(__spreadValues({}, prev.context), {
|
|
88
|
-
channels: ((_a2 = event.data) == null ? void 0 : _a2.channels) || [],
|
|
89
|
-
hasMoreChannels: (((_c2 = (_b2 = event.data) == null ? void 0 : _b2.channels) == null ? void 0 : _c2.length) || 0) > 0,
|
|
90
|
-
loading: ((_d2 = event.data) == null ? void 0 : _d2.stopLoading) ? false : prev.context.loading,
|
|
91
|
-
refreshing: ((_e = event.data) == null ? void 0 : _e.stopLoading) ? false : prev.context.refreshing,
|
|
92
|
-
loadingMore: false
|
|
93
|
-
}),
|
|
94
|
-
value: BaseState.Idle
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
} else if (event.type === Actions.APPEND_CHANNELS) {
|
|
98
|
-
const newChannels = ((_c = event.data) == null ? void 0 : _c.channels) || [];
|
|
99
|
-
console.log("Appending channels:", newChannels.length);
|
|
100
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
101
|
-
context: __spreadProps(__spreadValues({}, prev.context), {
|
|
102
|
-
channels: [...prev.context.channels, ...newChannels],
|
|
103
|
-
hasMoreChannels: newChannels.length >= 10,
|
|
104
|
-
page: prev.context.page + 1,
|
|
105
|
-
loadingMore: false
|
|
106
|
-
}),
|
|
107
|
-
value: BaseState.Idle
|
|
108
|
-
}));
|
|
109
|
-
} else if (event.type === Actions.REFRESH_CHANNELS) {
|
|
110
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
111
|
-
context: __spreadProps(__spreadValues({}, prev.context), {
|
|
112
|
-
refreshing: true,
|
|
113
|
-
page: 1,
|
|
114
|
-
hasMoreChannels: true
|
|
115
|
-
}),
|
|
116
|
-
value: MainState.RefreshChannels
|
|
117
|
-
}));
|
|
118
|
-
} else if (event.type === Actions.SELECT_CHANNEL) {
|
|
119
|
-
setState((prev) => {
|
|
120
|
-
var _a2;
|
|
121
|
-
return __spreadProps(__spreadValues({}, prev), {
|
|
122
|
-
context: __spreadProps(__spreadValues({}, prev.context), {
|
|
123
|
-
selectedChannelId: ((_a2 = event.data) == null ? void 0 : _a2.channelId) || null
|
|
124
|
-
})
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
} else if (event.type === Actions.START_LOADING) {
|
|
128
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
129
|
-
context: __spreadProps(__spreadValues({}, prev.context), {
|
|
130
|
-
loading: true
|
|
131
|
-
})
|
|
132
|
-
}));
|
|
133
|
-
} else if (event.type === Actions.STOP_LOADING) {
|
|
134
|
-
console.log("Explicitly stopping loading state");
|
|
135
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
136
|
-
context: __spreadProps(__spreadValues({}, prev.context), {
|
|
137
|
-
loading: false,
|
|
138
|
-
refreshing: false,
|
|
139
|
-
loadingMore: false
|
|
140
|
-
}),
|
|
141
|
-
value: prev.value === BaseState.FetchChannels ? BaseState.Idle : prev.value
|
|
142
|
-
}));
|
|
143
|
-
} else if (event.type === Actions.LOAD_MORE_CHANNELS) {
|
|
144
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
145
|
-
context: __spreadProps(__spreadValues({}, prev.context), {
|
|
146
|
-
loadingMore: true
|
|
147
|
-
}),
|
|
148
|
-
value: MainState.LoadMoreChannels
|
|
149
|
-
}));
|
|
150
|
-
} else if (event.type === Actions.SET_SEARCH_QUERY) {
|
|
151
|
-
setState((prev) => {
|
|
152
|
-
var _a2;
|
|
153
|
-
return __spreadProps(__spreadValues({}, prev), {
|
|
154
|
-
context: __spreadProps(__spreadValues({}, prev.context), {
|
|
155
|
-
searchQuery: ((_a2 = event.data) == null ? void 0 : _a2.searchQuery) || ""
|
|
156
|
-
})
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
} else if (event.type === Actions.ERROR_HANDLED) {
|
|
160
|
-
console.log("Error handled:", (_d = event.data) == null ? void 0 : _d.message);
|
|
161
|
-
setState((prev) => {
|
|
162
|
-
var _a2;
|
|
163
|
-
return __spreadProps(__spreadValues({}, prev), {
|
|
164
|
-
context: __spreadProps(__spreadValues({}, prev.context), {
|
|
165
|
-
error: ((_a2 = event.data) == null ? void 0 : _a2.message) || null,
|
|
166
|
-
loading: false,
|
|
167
|
-
refreshing: false,
|
|
168
|
-
loadingMore: false
|
|
169
|
-
}),
|
|
170
|
-
value: BaseState.Idle
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
} catch (error) {
|
|
175
|
-
console.error("Error handling event:", error);
|
|
176
|
-
}
|
|
177
|
-
}, []);
|
|
178
|
-
const stateWithMatches = useMemo(() => {
|
|
179
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
180
|
-
matches: (checkState) => {
|
|
181
|
-
return state.value === checkState;
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
}, [state]);
|
|
185
|
-
return [stateWithMatches, send];
|
|
186
|
-
}
|
|
187
20
|
const DialogsComponent = (props) => {
|
|
188
|
-
var _a;
|
|
189
21
|
const {
|
|
190
22
|
channelFilters: channelFilterProp,
|
|
191
23
|
channelRole,
|
|
192
24
|
supportServices
|
|
193
25
|
} = props;
|
|
194
|
-
const channelFilters = __spreadValues({}, channelFilterProp);
|
|
195
|
-
channelFilters.type = (_a = channelFilters == null ? void 0 : channelFilters.type) != null ? _a : RoomType.Direct;
|
|
196
26
|
const {
|
|
197
27
|
params
|
|
198
28
|
} = useRoute();
|
|
199
|
-
const auth = useSelector(userSelector);
|
|
29
|
+
const auth = useSelector(userSelector, shallowEqual);
|
|
200
30
|
const navigation = useNavigation();
|
|
31
|
+
const [isRefreshing, setIsRefreshing] = useState(false);
|
|
201
32
|
const isMountedRef = useRef(true);
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
try {
|
|
214
|
-
return (_b = (_a2 = state == null ? void 0 : state.context) == null ? void 0 : _a2[property]) != null ? _b : defaultValue;
|
|
215
|
-
} catch (error) {
|
|
216
|
-
console.error(`Error accessing state.context.${property}:`, error);
|
|
217
|
-
return defaultValue;
|
|
218
|
-
}
|
|
219
|
-
}, [state]);
|
|
220
|
-
const safeMatches = useCallback((stateValue) => {
|
|
221
|
-
var _a2;
|
|
222
|
-
try {
|
|
223
|
-
return ((_a2 = state == null ? void 0 : state.matches) == null ? void 0 : _a2.call(state, stateValue)) || false;
|
|
224
|
-
} catch (error) {
|
|
225
|
-
console.error(`Error calling state.matches with ${stateValue}:`, error);
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
|
-
}, [state]);
|
|
229
|
-
const safeSend = useCallback((event) => {
|
|
230
|
-
try {
|
|
231
|
-
send(event);
|
|
232
|
-
} catch (error) {
|
|
233
|
-
console.error("Error sending event to state machine:", error, event);
|
|
234
|
-
}
|
|
235
|
-
}, [send]);
|
|
236
|
-
const channels = safeContextProperty("channels", []);
|
|
237
|
-
const refreshing = safeContextProperty("refreshing", false);
|
|
238
|
-
const loading = safeContextProperty("loading", false);
|
|
239
|
-
const searchQuery = safeContextProperty("searchQuery", "");
|
|
240
|
-
const selectedChannelId = safeContextProperty("selectedChannelId", null);
|
|
241
|
-
const loadingMore = safeContextProperty("loadingMore", false);
|
|
242
|
-
const hasMoreChannels = safeContextProperty("hasMoreChannels", true);
|
|
243
|
-
const page = safeContextProperty("page", 1);
|
|
244
|
-
const stateRef = useRef(state);
|
|
245
|
-
useEffect(() => {
|
|
246
|
-
stateRef.current = state;
|
|
247
|
-
}, [state]);
|
|
248
|
-
const safeGetContext = useCallback(() => {
|
|
249
|
-
if (stateRef.current && stateRef.current.context) {
|
|
250
|
-
return stateRef.current.context;
|
|
251
|
-
}
|
|
252
|
-
return {
|
|
253
|
-
channels: [],
|
|
254
|
-
refreshing: false,
|
|
255
|
-
loading: false,
|
|
256
|
-
error: null,
|
|
257
|
-
searchQuery: "",
|
|
258
|
-
selectedChannelId: null,
|
|
259
|
-
channelRole: null,
|
|
260
|
-
channelFilters: {},
|
|
261
|
-
supportServices: false,
|
|
262
|
-
page: 1,
|
|
263
|
-
hasMoreChannels: true,
|
|
264
|
-
loadingMore: false
|
|
265
|
-
};
|
|
266
|
-
}, []);
|
|
267
|
-
useEffect(() => {
|
|
268
|
-
return () => {
|
|
269
|
-
isMountedRef.current = false;
|
|
270
|
-
};
|
|
271
|
-
}, []);
|
|
33
|
+
const lastRefreshTimeRef = useRef(Date.now());
|
|
34
|
+
const activeChannelRef = useRef(null);
|
|
35
|
+
const resetActiveChannelTimeoutRef = useRef(null);
|
|
36
|
+
const MIN_REFRESH_INTERVAL = 2e3;
|
|
37
|
+
const channelFilters = useMemo(() => {
|
|
38
|
+
var _a;
|
|
39
|
+
const filters = __spreadValues({}, channelFilterProp);
|
|
40
|
+
const channelType = (_a = filters == null ? void 0 : filters.type) != null ? _a : RoomType.Direct;
|
|
41
|
+
filters.type = supportServices ? [channelType, RoomType.Service] : channelType;
|
|
42
|
+
return filters;
|
|
43
|
+
}, [channelFilterProp, supportServices]);
|
|
272
44
|
const {
|
|
273
|
-
|
|
274
|
-
|
|
45
|
+
data,
|
|
46
|
+
loading,
|
|
47
|
+
refetch,
|
|
48
|
+
fetchMore
|
|
49
|
+
} = useGetChannelsByUserWithLastMessageQuery({
|
|
275
50
|
variables: {
|
|
276
51
|
role: channelRole,
|
|
277
52
|
criteria: channelFilters,
|
|
278
|
-
supportServices: supportServices ? true : false,
|
|
279
|
-
supportServiceCriteria: {
|
|
280
|
-
type: RoomType.Service
|
|
281
|
-
},
|
|
282
53
|
limit: 15,
|
|
283
54
|
skip: 0
|
|
284
55
|
},
|
|
285
|
-
fetchPolicy: "cache-and-network",
|
|
286
|
-
nextFetchPolicy: "network-only",
|
|
287
56
|
notifyOnNetworkStatusChange: true,
|
|
288
|
-
|
|
57
|
+
fetchPolicy: "cache-and-network"
|
|
289
58
|
});
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
supportServiceCriteria: {
|
|
303
|
-
type: RoomType.Service
|
|
304
|
-
},
|
|
305
|
-
limit: 15,
|
|
306
|
-
skip: skipCount
|
|
307
|
-
});
|
|
308
|
-
const allChannels = [...(_a2 = data == null ? void 0 : data.supportServiceChannels) != null ? _a2 : [], ...(_b = data == null ? void 0 : data.channelsByUser) != null ? _b : []];
|
|
309
|
-
const filteredChannels = (_c = allChannels == null ? void 0 : allChannels.filter((c) => c.members.some((u) => {
|
|
310
|
-
var _a3;
|
|
311
|
-
return u !== null && ((_a3 = u == null ? void 0 : u.user) == null ? void 0 : _a3.id) != (auth == null ? void 0 : auth.id) && u.user.__typename == "UserAccount";
|
|
312
|
-
}))) != null ? _c : [];
|
|
313
|
-
const sortedChannels = filteredChannels && orderBy(filteredChannels, ["updatedAt"], ["desc"]) || [];
|
|
314
|
-
console.log(`\u{1F4CA} Processed channels: ${sortedChannels.length} (page: ${pageNum}, skip: ${skipCount})`);
|
|
315
|
-
if (isMountedRef.current) {
|
|
316
|
-
if (append) {
|
|
317
|
-
safeSend({
|
|
318
|
-
type: Actions.APPEND_CHANNELS,
|
|
319
|
-
data: {
|
|
320
|
-
channels: sortedChannels
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
} else {
|
|
324
|
-
safeSend({
|
|
325
|
-
type: Actions.FETCH_CHANNELS,
|
|
326
|
-
data: {
|
|
327
|
-
channels: sortedChannels
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
safeSend({
|
|
332
|
-
type: Actions.STOP_LOADING
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
} catch (error) {
|
|
336
|
-
console.error("Error fetching channels:", error);
|
|
337
|
-
if (isMountedRef.current) {
|
|
338
|
-
safeSend({
|
|
339
|
-
type: Actions.ERROR_HANDLED,
|
|
340
|
-
data: {
|
|
341
|
-
message: "Failed to fetch channels"
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}, [getChannelsRefetch, channelRole, channelFilters, supportServices, auth == null ? void 0 : auth.id, safeSend]);
|
|
347
|
-
useEffect(() => {
|
|
348
|
-
if (loading) {
|
|
349
|
-
const safetyTimeout = setTimeout(() => {
|
|
350
|
-
console.log("\u26A0\uFE0F Safety timeout triggered - forcing loading state to stop");
|
|
351
|
-
if (isMountedRef.current) {
|
|
352
|
-
safeSend({
|
|
353
|
-
type: Actions.STOP_LOADING
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
}, 5e3);
|
|
357
|
-
return () => clearTimeout(safetyTimeout);
|
|
358
|
-
}
|
|
359
|
-
}, [loading, safeSend]);
|
|
360
|
-
const fastRefresh = useCallback(async () => {
|
|
361
|
-
var _a2, _b, _c;
|
|
362
|
-
try {
|
|
363
|
-
console.log("\u{1F504} Fast refreshing channels...");
|
|
364
|
-
const clearRefreshingTimeout = setTimeout(() => {
|
|
365
|
-
if (isMountedRef.current) {
|
|
366
|
-
console.log("\u26A0\uFE0F Fast refresh timeout - stopping refresh state");
|
|
367
|
-
safeSend({
|
|
368
|
-
type: Actions.STOP_LOADING
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
}, 3e3);
|
|
372
|
-
const {
|
|
373
|
-
data
|
|
374
|
-
} = await getChannelsRefetch({
|
|
375
|
-
role: channelRole,
|
|
376
|
-
criteria: channelFilters,
|
|
377
|
-
supportServices: supportServices ? true : false,
|
|
378
|
-
supportServiceCriteria: {
|
|
379
|
-
type: RoomType.Service
|
|
380
|
-
},
|
|
381
|
-
limit: 10,
|
|
382
|
-
skip: 0
|
|
383
|
-
});
|
|
384
|
-
clearTimeout(clearRefreshingTimeout);
|
|
385
|
-
if (!isMountedRef.current)
|
|
386
|
-
return;
|
|
387
|
-
const allChannels = [...(_a2 = data == null ? void 0 : data.supportServiceChannels) != null ? _a2 : [], ...(_b = data == null ? void 0 : data.channelsByUser) != null ? _b : []];
|
|
388
|
-
const filteredChannels = (_c = allChannels == null ? void 0 : allChannels.filter((c) => c.members.some((u) => {
|
|
389
|
-
var _a3;
|
|
390
|
-
return u !== null && ((_a3 = u == null ? void 0 : u.user) == null ? void 0 : _a3.id) != (auth == null ? void 0 : auth.id) && u.user.__typename == "UserAccount";
|
|
391
|
-
}))) != null ? _c : [];
|
|
392
|
-
const sortedChannels = filteredChannels && orderBy(filteredChannels, ["updatedAt"], ["desc"]) || [];
|
|
393
|
-
console.log(`\u{1F4CA} Fast refresh completed: ${sortedChannels.length} channels`);
|
|
394
|
-
if (isMountedRef.current) {
|
|
395
|
-
safeSend({
|
|
396
|
-
type: Actions.FETCH_CHANNELS,
|
|
397
|
-
data: {
|
|
398
|
-
channels: sortedChannels,
|
|
399
|
-
stopLoading: true
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
} catch (error) {
|
|
404
|
-
console.error("Error during fast refresh:", error);
|
|
405
|
-
if (isMountedRef.current) {
|
|
406
|
-
safeSend({
|
|
407
|
-
type: Actions.STOP_LOADING
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}, [getChannelsRefetch, channelRole, channelFilters, supportServices, auth == null ? void 0 : auth.id, safeSend]);
|
|
412
|
-
useEffect(() => {
|
|
413
|
-
const context = safeGetContext();
|
|
414
|
-
const isAlreadyFetching = context.refreshing || context.loading;
|
|
415
|
-
if (!isAlreadyFetching) {
|
|
416
|
-
if (safeMatches(BaseState.FetchChannels)) {
|
|
417
|
-
console.log("\u{1F504} Fetching channels...");
|
|
418
|
-
fetchChannelsDirectly(1, false);
|
|
419
|
-
} else if (safeMatches(MainState.RefreshChannels)) {
|
|
420
|
-
console.log("\u{1F504} Refreshing channels...");
|
|
421
|
-
fetchChannelsDirectly(1, false);
|
|
422
|
-
} else if (safeMatches(MainState.LoadMoreChannels)) {
|
|
423
|
-
console.log("\u{1F504} Loading more channels...");
|
|
424
|
-
fetchChannelsDirectly(page, true);
|
|
425
|
-
}
|
|
426
|
-
} else {
|
|
427
|
-
console.log("\u23E9 Skipping fetch because isAlreadyFetching:", isAlreadyFetching);
|
|
428
|
-
}
|
|
429
|
-
}, [fetchChannelsDirectly, safeMatches, safeGetContext, state.value, page]);
|
|
430
|
-
useEffect(() => {
|
|
431
|
-
console.log("State changed to:", state.value);
|
|
432
|
-
console.log("Context:", JSON.stringify({
|
|
433
|
-
channelsCount: channels.length,
|
|
434
|
-
loading,
|
|
435
|
-
refreshing
|
|
436
|
-
}));
|
|
437
|
-
}, [state.value, channels.length, loading, refreshing]);
|
|
438
|
-
useEffect(() => {
|
|
439
|
-
if (isMountedRef.current) {
|
|
440
|
-
console.log("\u{1F680} Initializing state machine with props", {
|
|
441
|
-
channelRole,
|
|
442
|
-
channelFilters,
|
|
443
|
-
supportServices,
|
|
444
|
-
selectedChannelId: params == null ? void 0 : params.channelId
|
|
445
|
-
});
|
|
446
|
-
safeSend({
|
|
447
|
-
type: Actions.INITIAL_CONTEXT,
|
|
448
|
-
data: {
|
|
449
|
-
channelRole,
|
|
450
|
-
channelFilters,
|
|
451
|
-
supportServices,
|
|
452
|
-
selectedChannelId: params == null ? void 0 : params.channelId
|
|
453
|
-
}
|
|
454
|
-
});
|
|
455
|
-
const initSafetyTimeout = setTimeout(() => {
|
|
456
|
-
if (isMountedRef.current && loading) {
|
|
457
|
-
console.log("\u26A0\uFE0F Init safety timeout triggered - forcing loading state to stop");
|
|
458
|
-
safeSend({
|
|
459
|
-
type: Actions.STOP_LOADING
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
}, 8e3);
|
|
463
|
-
return () => clearTimeout(initSafetyTimeout);
|
|
464
|
-
}
|
|
465
|
-
}, []);
|
|
466
|
-
const focusRefreshRef = useRef(null);
|
|
467
|
-
useFocusEffect(useCallback(() => {
|
|
468
|
-
let hasTriggeredRefresh = false;
|
|
469
|
-
const now = Date.now();
|
|
470
|
-
const lastRefresh = focusRefreshRef.current;
|
|
471
|
-
const shouldRefresh = lastRefresh === null || now - lastRefresh > 2e3;
|
|
472
|
-
const context = safeGetContext();
|
|
473
|
-
const isAlreadyFetching = context.refreshing || context.loading;
|
|
474
|
-
if (isMountedRef.current && !hasTriggeredRefresh && !isAlreadyFetching && shouldRefresh && (channels.length > 0 || safeMatches(BaseState.Idle))) {
|
|
475
|
-
hasTriggeredRefresh = true;
|
|
476
|
-
focusRefreshRef.current = now;
|
|
477
|
-
console.log("\u{1F504} Focus effect: triggering fast refresh");
|
|
478
|
-
safeSend({
|
|
479
|
-
type: Actions.START_LOADING,
|
|
480
|
-
data: {
|
|
481
|
-
refreshing: true
|
|
482
|
-
}
|
|
483
|
-
});
|
|
484
|
-
setTimeout(() => {
|
|
485
|
-
if (isMountedRef.current) {
|
|
486
|
-
fastRefresh();
|
|
487
|
-
}
|
|
488
|
-
}, 100);
|
|
489
|
-
} else {
|
|
490
|
-
console.log("\u23E9 Skipping focus refresh:", {
|
|
491
|
-
isAlreadyFetching,
|
|
492
|
-
hasTriggeredRefresh,
|
|
493
|
-
shouldRefresh,
|
|
494
|
-
timeGap: lastRefresh === null ? "first refresh" : now - lastRefresh
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
return () => {
|
|
498
|
-
hasTriggeredRefresh = false;
|
|
499
|
-
};
|
|
500
|
-
}, [safeSend, channels.length, safeMatches, safeGetContext, fastRefresh]));
|
|
501
|
-
const handleSelectChannel = useCallback((id, title) => {
|
|
502
|
-
safeSend({
|
|
503
|
-
type: Actions.SELECT_CHANNEL,
|
|
504
|
-
data: {
|
|
505
|
-
channelId: id
|
|
506
|
-
}
|
|
59
|
+
console.log("data__Dialogs", data);
|
|
60
|
+
console.log("channelFilters__Dialogs", channelFilters);
|
|
61
|
+
const processedChannels = useMemo(() => {
|
|
62
|
+
const rawChannels = (data == null ? void 0 : data.channelsByUser) || [];
|
|
63
|
+
if (!rawChannels.length) return [];
|
|
64
|
+
return rawChannels.filter((c) => {
|
|
65
|
+
if (!(c == null ? void 0 : c.members)) return false;
|
|
66
|
+
return c.members.some((member) => (member == null ? void 0 : member.user) && member.user.id !== (auth == null ? void 0 : auth.id) && member.user.__typename === "UserAccount");
|
|
67
|
+
}).sort((a, b) => {
|
|
68
|
+
const dateA = new Date((a == null ? void 0 : a.updatedAt) || (a == null ? void 0 : a.createdAt)).getTime();
|
|
69
|
+
const dateB = new Date((b == null ? void 0 : b.updatedAt) || (b == null ? void 0 : b.createdAt)).getTime();
|
|
70
|
+
return dateB - dateA;
|
|
507
71
|
});
|
|
72
|
+
}, [data == null ? void 0 : data.channelsByUser, auth == null ? void 0 : auth.id]);
|
|
73
|
+
const handleSelectChannel = useCallback((id, title) => {
|
|
74
|
+
if (activeChannelRef.current === id) return;
|
|
75
|
+
activeChannelRef.current = id;
|
|
76
|
+
if (resetActiveChannelTimeoutRef.current) {
|
|
77
|
+
clearTimeout(resetActiveChannelTimeoutRef.current);
|
|
78
|
+
}
|
|
79
|
+
resetActiveChannelTimeoutRef.current = setTimeout(() => {
|
|
80
|
+
activeChannelRef.current = null;
|
|
81
|
+
}, 2e3);
|
|
508
82
|
navigation.navigate(config.INBOX_MESSEGE_PATH, {
|
|
509
83
|
channelId: id,
|
|
510
84
|
role: channelRole,
|
|
511
85
|
title,
|
|
512
86
|
hideTabBar: true,
|
|
513
|
-
timestamp:
|
|
87
|
+
timestamp: Date.now(),
|
|
88
|
+
orgName: params == null ? void 0 : params.orgName
|
|
514
89
|
});
|
|
515
|
-
}, [navigation, channelRole,
|
|
90
|
+
}, [navigation, channelRole, params == null ? void 0 : params.orgName]);
|
|
516
91
|
const handleSelectServiceChannel = useCallback((id, title, postParentId) => {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
92
|
+
if (activeChannelRef.current === id) return;
|
|
93
|
+
activeChannelRef.current = id;
|
|
94
|
+
if (resetActiveChannelTimeoutRef.current) {
|
|
95
|
+
clearTimeout(resetActiveChannelTimeoutRef.current);
|
|
96
|
+
}
|
|
97
|
+
resetActiveChannelTimeoutRef.current = setTimeout(() => {
|
|
98
|
+
activeChannelRef.current = null;
|
|
99
|
+
}, 2e3);
|
|
100
|
+
const path = postParentId !== void 0 && postParentId !== null ? config.THREAD_MESSEGE_PATH : config.THREADS_PATH;
|
|
101
|
+
navigation.navigate(path, {
|
|
524
102
|
channelId: id,
|
|
525
103
|
role: channelRole,
|
|
526
104
|
title,
|
|
527
105
|
postParentId,
|
|
528
|
-
hideTabBar: true
|
|
106
|
+
hideTabBar: true,
|
|
107
|
+
orgName: params == null ? void 0 : params.orgName
|
|
529
108
|
});
|
|
530
|
-
}, [navigation, channelRole,
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
109
|
+
}, [navigation, channelRole, params == null ? void 0 : params.orgName]);
|
|
110
|
+
const renderItem = useCallback(({
|
|
111
|
+
item: channel
|
|
112
|
+
}) => /* @__PURE__ */ React__default.createElement(DialogItem, { onOpen: (channel == null ? void 0 : channel.type) === RoomType.Service ? handleSelectServiceChannel : handleSelectChannel, currentUser: auth, channel }), [auth, handleSelectChannel, handleSelectServiceChannel]);
|
|
113
|
+
const ListFooterComponent = useMemo(() => {
|
|
114
|
+
if (loading && processedChannels.length > 0 && !isRefreshing) {
|
|
115
|
+
return /* @__PURE__ */ React__default.createElement(Center, { className: "py-4" }, /* @__PURE__ */ React__default.createElement(Spinner, { color: colors.blue[500], size: "small" }));
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}, [loading, processedChannels.length, isRefreshing]);
|
|
119
|
+
const ListEmptyComponent = useMemo(() => {
|
|
120
|
+
if (loading && processedChannels.length === 0) {
|
|
121
|
+
return /* @__PURE__ */ React__default.createElement(Center, { className: "flex-1 justify-center items-center", style: {
|
|
122
|
+
minHeight: 300
|
|
123
|
+
} }, /* @__PURE__ */ React__default.createElement(Spinner, { color: colors.blue[500], size: "large" }), /* @__PURE__ */ React__default.createElement(Text, { className: "mt-4 text-gray-500" }, "Loading conversations..."));
|
|
535
124
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
fastRefresh();
|
|
546
|
-
}, [safeSend, refreshing, fastRefresh]);
|
|
547
|
-
const handleSearchChange = useCallback((text) => {
|
|
548
|
-
safeSend({
|
|
549
|
-
type: Actions.SET_SEARCH_QUERY,
|
|
550
|
-
data: {
|
|
551
|
-
searchQuery: text
|
|
125
|
+
return /* @__PURE__ */ React__default.createElement(Center, { className: "flex-1 justify-center items-center px-6", style: {
|
|
126
|
+
minHeight: 300
|
|
127
|
+
} }, /* @__PURE__ */ React__default.createElement(Box, { className: "w-16 h-16 rounded-full bg-blue-500 flex items-center justify-center mb-5" }, /* @__PURE__ */ React__default.createElement(Ionicons, { name: "chatbubble-ellipses", size: 30, color: "white" })), /* @__PURE__ */ React__default.createElement(Text, { className: "text-2xl font-bold text-center mb-2" }, "No messages yet"), /* @__PURE__ */ React__default.createElement(Text, { className: "text-gray-600 text-center" }, "When you start conversations with others,", "\n", "they'll appear here."));
|
|
128
|
+
}, [loading, processedChannels.length]);
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
return () => {
|
|
131
|
+
isMountedRef.current = false;
|
|
132
|
+
if (resetActiveChannelTimeoutRef.current) {
|
|
133
|
+
clearTimeout(resetActiveChannelTimeoutRef.current);
|
|
552
134
|
}
|
|
553
|
-
}
|
|
554
|
-
}, [
|
|
135
|
+
};
|
|
136
|
+
}, []);
|
|
137
|
+
useFocusEffect(useCallback(() => {
|
|
138
|
+
activeChannelRef.current = null;
|
|
139
|
+
const now = Date.now();
|
|
140
|
+
if (now - lastRefreshTimeRef.current >= MIN_REFRESH_INTERVAL) {
|
|
141
|
+
lastRefreshTimeRef.current = now;
|
|
142
|
+
refetch().catch(console.error);
|
|
143
|
+
}
|
|
144
|
+
return () => {
|
|
145
|
+
};
|
|
146
|
+
}, [refetch, MIN_REFRESH_INTERVAL]));
|
|
147
|
+
const handlePullToRefresh = useCallback(async () => {
|
|
148
|
+
setIsRefreshing(true);
|
|
149
|
+
try {
|
|
150
|
+
await refetch();
|
|
151
|
+
} catch (error) {
|
|
152
|
+
console.error("Refresh error:", error);
|
|
153
|
+
} finally {
|
|
154
|
+
setIsRefreshing(false);
|
|
155
|
+
}
|
|
156
|
+
}, [refetch]);
|
|
555
157
|
const handleLoadMore = useCallback(() => {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
type: Actions.LOAD_MORE_CHANNELS
|
|
560
|
-
});
|
|
561
|
-
} else {
|
|
562
|
-
console.log("Skip loading more: loadingMore=", loadingMore, "hasMoreChannels=", hasMoreChannels);
|
|
158
|
+
var _a;
|
|
159
|
+
if (loading || !((_a = data == null ? void 0 : data.channelsByUser) == null ? void 0 : _a.length) || processedChannels.length < 10) {
|
|
160
|
+
return;
|
|
563
161
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
162
|
+
fetchMore({
|
|
163
|
+
variables: {
|
|
164
|
+
skip: processedChannels.length
|
|
165
|
+
},
|
|
166
|
+
updateQuery: (prev, {
|
|
167
|
+
fetchMoreResult
|
|
168
|
+
}) => {
|
|
169
|
+
var _a2;
|
|
170
|
+
if (!((_a2 = fetchMoreResult == null ? void 0 : fetchMoreResult.channelsByUser) == null ? void 0 : _a2.length)) return prev;
|
|
171
|
+
return __spreadProps(__spreadValues({}, fetchMoreResult), {
|
|
172
|
+
channelsByUser: [...prev.channelsByUser || [], ...fetchMoreResult.channelsByUser || []]
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}).catch((error) => {
|
|
176
|
+
console.error("Load more error:", error);
|
|
576
177
|
});
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
paddingVertical: 5
|
|
589
|
-
} }, /* @__PURE__ */ React__default.createElement(Box, { className: "w-16 h-16 rounded-full bg-blue-500 flex items-center justify-center mb-5" }, /* @__PURE__ */ React__default.createElement(Ionicons, { name: "chatbubble-ellipses", size: 30, color: "white" })), /* @__PURE__ */ React__default.createElement(Text, { className: "text-2xl font-bold text-center mb-2" }, "No messages yet"), /* @__PURE__ */ React__default.createElement(Text, { className: "text-gray-600 text-center mb-8" }, "When you start conversations with others,", "\n", "they'll appear here.")));
|
|
590
|
-
}, keyExtractor: (item) => `channel-${item.id}` }));
|
|
178
|
+
}, [fetchMore, loading, data == null ? void 0 : data.channelsByUser, processedChannels.length]);
|
|
179
|
+
const keyExtractor = useCallback((item) => `channel-${item.id}`, []);
|
|
180
|
+
const ItemSeparatorComponent = useCallback(() => /* @__PURE__ */ React__default.createElement(Box, { className: "h-px bg-gray-200 mx-4" }), []);
|
|
181
|
+
const getItemLayout = useCallback((_data, index) => ({
|
|
182
|
+
length: 80,
|
|
183
|
+
offset: 80 * index,
|
|
184
|
+
index
|
|
185
|
+
}), []);
|
|
186
|
+
return /* @__PURE__ */ React__default.createElement(Box, { className: "flex-1 px-2" }, /* @__PURE__ */ React__default.createElement(FlatList, { data: processedChannels, renderItem, keyExtractor, onRefresh: handlePullToRefresh, refreshing: isRefreshing, ListEmptyComponent, ListFooterComponent, ItemSeparatorComponent, onEndReached: handleLoadMore, onEndReachedThreshold: 0.5, initialNumToRender: 10, maxToRenderPerBatch: 10, windowSize: 10, removeClippedSubviews: true, updateCellsBatchingPeriod: 50, getItemLayout, contentContainerStyle: {
|
|
187
|
+
flexGrow: 1
|
|
188
|
+
} }));
|
|
591
189
|
};
|
|
592
190
|
const Dialogs = React__default.memo(DialogsComponent);export{Dialogs};//# sourceMappingURL=Dialogs.js.map
|