@messenger-box/platform-mobile 0.0.1-alpha.482 → 0.0.1-alpha.487
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 +8 -0
- package/lib/index.js +25 -17
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
- package/src/screens/inbox/containers/ConversationView.tsx +61 -43
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.0.1-alpha.487](https://github.com/CDEBase/messenger-box/compare/v0.0.1-alpha.486...v0.0.1-alpha.487) (2024-03-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @messenger-box/platform-mobile
|
|
9
|
+
|
|
10
|
+
## [0.0.1-alpha.486](https://github.com/CDEBase/messenger-box/compare/v0.0.1-alpha.485...v0.0.1-alpha.486) (2024-03-15)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @messenger-box/platform-mobile
|
|
13
|
+
|
|
6
14
|
## [0.0.1-alpha.482](https://github.com/CDEBase/messenger-box/compare/v0.0.1-alpha.481...v0.0.1-alpha.482) (2024-03-04)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @messenger-box/platform-mobile
|
package/lib/index.js
CHANGED
|
@@ -1800,14 +1800,13 @@ const createdAtText = (value) => {
|
|
|
1800
1800
|
return (0, date_fns_1.format)(new Date(value), 'MMM dd, yyyy');
|
|
1801
1801
|
};
|
|
1802
1802
|
const ConversationViewComponent = (_a) => {
|
|
1803
|
-
var _b, _c;
|
|
1804
1803
|
var { channelId: ChannelId, role, isShowThreadMessage } = _a, rest = __rest(_a, ["channelId", "role", "isShowThreadMessage"]);
|
|
1805
1804
|
const [channelToTop, setChannelToTop] = (0, react_1.useState)(0);
|
|
1806
1805
|
const [channelMessages, setChannelMessages] = (0, react_1.useState)([]);
|
|
1807
1806
|
const auth = (0, react_redux_1.useSelector)(user_auth0_client_1.userSelector);
|
|
1808
1807
|
const [totalCount, setTotalCount] = (0, react_1.useState)(0);
|
|
1809
1808
|
const [selectedImage, setImage] = (0, react_1.useState)('');
|
|
1810
|
-
const [channelId, setChannelId] = (0, react_1.useState)((
|
|
1809
|
+
const [channelId, setChannelId] = (0, react_1.useState)((rest === null || rest === void 0 ? void 0 : rest.isCreateNewChannel) ? null : ChannelId);
|
|
1811
1810
|
const [loadingOldMessages, setLoadingOldMessages] = (0, react_1.useState)(false);
|
|
1812
1811
|
const color = (0, native_base_1.useColorModeValue)('white', 'black');
|
|
1813
1812
|
// const color = useColorModeValue('black', 'white');
|
|
@@ -1879,7 +1878,7 @@ const ConversationViewComponent = (_a) => {
|
|
|
1879
1878
|
setTotalCount(0);
|
|
1880
1879
|
setSkip(0);
|
|
1881
1880
|
};
|
|
1882
|
-
}, [isFocused]));
|
|
1881
|
+
}, [channelId, isFocused]));
|
|
1883
1882
|
react_1.default.useEffect(() => {
|
|
1884
1883
|
setChannelId(ChannelId);
|
|
1885
1884
|
}, [ChannelId]);
|
|
@@ -1959,15 +1958,23 @@ const ConversationViewComponent = (_a) => {
|
|
|
1959
1958
|
setLoading(false);
|
|
1960
1959
|
};
|
|
1961
1960
|
const createDirectChannel = (0, react_1.useCallback)((msg) => {
|
|
1962
|
-
var _a, _b, _c, _d, _e;
|
|
1963
|
-
|
|
1964
|
-
|
|
1961
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1962
|
+
console.log('createdirect channel');
|
|
1963
|
+
console.log('isCreateNewChannel', rest === null || rest === void 0 ? void 0 : rest.isCreateNewChannel);
|
|
1964
|
+
console.log('userid length', (_a = rest === null || rest === void 0 ? void 0 : rest.newChannelData) === null || _a === void 0 ? void 0 : _a.type);
|
|
1965
|
+
console.log('userid length', (_c = (_b = rest === null || rest === void 0 ? void 0 : rest.newChannelData) === null || _b === void 0 ? void 0 : _b.userIds) === null || _c === void 0 ? void 0 : _c.length);
|
|
1966
|
+
if ((rest === null || rest === void 0 ? void 0 : rest.isCreateNewChannel) &&
|
|
1967
|
+
((_d = rest === null || rest === void 0 ? void 0 : rest.newChannelData) === null || _d === void 0 ? void 0 : _d.type) === (platform_client_1.IRoomType === null || platform_client_1.IRoomType === void 0 ? void 0 : platform_client_1.IRoomType.Direct) &&
|
|
1968
|
+
((_f = (_e = rest === null || rest === void 0 ? void 0 : rest.newChannelData) === null || _e === void 0 ? void 0 : _e.userIds) === null || _f === void 0 ? void 0 : _f.length) > 0) {
|
|
1969
|
+
console.log('add direct channel mutation');
|
|
1970
|
+
(_k = (_j = addDirectChannel({
|
|
1965
1971
|
variables: {
|
|
1966
|
-
receiver: [(
|
|
1972
|
+
receiver: [...((_h = (_g = rest === null || rest === void 0 ? void 0 : rest.newChannelData) === null || _g === void 0 ? void 0 : _g.userIds) !== null && _h !== void 0 ? _h : [])],
|
|
1967
1973
|
displayName: 'DIRECT CHANNEL',
|
|
1968
1974
|
},
|
|
1969
|
-
})) === null ||
|
|
1975
|
+
})) === null || _j === void 0 ? void 0 : _j.then(async (res) => {
|
|
1970
1976
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1977
|
+
console.log('direct ch rest', JSON.stringify(res));
|
|
1971
1978
|
if ((_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.createDirectChannel) === null || _b === void 0 ? void 0 : _b.id) {
|
|
1972
1979
|
setChannelId((_d = (_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.createDirectChannel) === null || _d === void 0 ? void 0 : _d.id);
|
|
1973
1980
|
const notificationData = {
|
|
@@ -1994,9 +2001,9 @@ const ConversationViewComponent = (_a) => {
|
|
|
1994
2001
|
},
|
|
1995
2002
|
});
|
|
1996
2003
|
}
|
|
1997
|
-
});
|
|
2004
|
+
})) === null || _k === void 0 ? void 0 : _k.catch((e) => console.log('error', JSON.stringify(e)));
|
|
1998
2005
|
}
|
|
1999
|
-
}, []);
|
|
2006
|
+
}, [rest]);
|
|
2000
2007
|
const handleSend = (0, react_1.useCallback)(async (message) => {
|
|
2001
2008
|
var _a;
|
|
2002
2009
|
if (!channelId)
|
|
@@ -2113,10 +2120,9 @@ const ConversationViewComponent = (_a) => {
|
|
|
2113
2120
|
return res;
|
|
2114
2121
|
}, [channelMessages, channelId]);
|
|
2115
2122
|
const renderSend = (props) => {
|
|
2116
|
-
|
|
2117
|
-
return (react_1.default.createElement(react_native_gifted_chat_1.Send, Object.assign({}, props, { disabled: channelId || ((_b = (_a = rest === null || rest === void 0 ? void 0 : rest.route) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.isCreateNewChannel) ? false : true }),
|
|
2123
|
+
return (react_1.default.createElement(react_native_gifted_chat_1.Send, Object.assign({}, props, { disabled: channelId || (rest === null || rest === void 0 ? void 0 : rest.isCreateNewChannel) ? false : true }),
|
|
2118
2124
|
react_1.default.createElement(native_base_1.Box, null,
|
|
2119
|
-
react_1.default.createElement(vector_icons_1.MaterialCommunityIcons, { name: "send-circle", style: { marginBottom: 5, marginRight: 5 }, size: 32, color: channelId || (
|
|
2125
|
+
react_1.default.createElement(vector_icons_1.MaterialCommunityIcons, { name: "send-circle", style: { marginBottom: 5, marginRight: 5 }, size: 32, color: channelId || (rest === null || rest === void 0 ? void 0 : rest.isCreateNewChannel) ? '#2e64e5' : '#b8b2b2' }))));
|
|
2120
2126
|
};
|
|
2121
2127
|
const renderMessageText = (props) => {
|
|
2122
2128
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22;
|
|
@@ -2311,10 +2317,12 @@ const ConversationViewComponent = (_a) => {
|
|
|
2311
2317
|
// }
|
|
2312
2318
|
// }}
|
|
2313
2319
|
onSend: (messages) => {
|
|
2314
|
-
var _a, _b, _c, _d, _e
|
|
2315
|
-
return (
|
|
2316
|
-
?
|
|
2317
|
-
|
|
2320
|
+
var _a, _b, _c, _d, _e;
|
|
2321
|
+
return (rest === null || rest === void 0 ? void 0 : rest.isCreateNewChannel) && !channelId
|
|
2322
|
+
? ((_a = rest === null || rest === void 0 ? void 0 : rest.newChannelData) === null || _a === void 0 ? void 0 : _a.type) === (platform_client_1.IRoomType === null || platform_client_1.IRoomType === void 0 ? void 0 : platform_client_1.IRoomType.Direct)
|
|
2323
|
+
? createDirectChannel((_c = (_b = messages[0]) === null || _b === void 0 ? void 0 : _b.text) !== null && _c !== void 0 ? _c : ' ')
|
|
2324
|
+
: null
|
|
2325
|
+
: channelId && handleSend((_e = (_d = messages[0]) === null || _d === void 0 ? void 0 : _d.text) !== null && _e !== void 0 ? _e : ' ');
|
|
2318
2326
|
}, text: msg ? msg : ' ', onInputTextChanged: (text) => setMsg(text), renderFooter: () => (loading ? react_1.default.createElement(native_base_1.Spinner, null) : imageLoading ? react_1.default.createElement(native_base_1.Spinner, null) : ''), scrollToBottom: true, user: {
|
|
2319
2327
|
// _id: currentUser?.id || '',
|
|
2320
2328
|
_id: (auth === null || auth === void 0 ? void 0 : auth.id) || '',
|