@smart-link/rn-im 1.0.9 → 1.0.11
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/dist/init.js
CHANGED
@@ -22,6 +22,7 @@ const upload_1 = __importDefault(require("./utils/upload"));
|
|
22
22
|
const file_1 = require("./utils/file");
|
23
23
|
const rn_ui_1 = require("@smart-link/rn-ui");
|
24
24
|
const lodash_es_1 = require("lodash-es");
|
25
|
+
const cookie_1 = require("./utils/cookie");
|
25
26
|
let imManager;
|
26
27
|
let logo;
|
27
28
|
const initImSdk = ({ user, storage, store, server, logo: outLogo, t, logout, undoLimitTime }) => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -102,6 +103,10 @@ const initImSdk = ({ user, storage, store, server, logo: outLogo, t, logout, und
|
|
102
103
|
}
|
103
104
|
}
|
104
105
|
},
|
106
|
+
onDestroyed() {
|
107
|
+
console.log('IM onDestroyed');
|
108
|
+
(0, cookie_1.clearCookies)();
|
109
|
+
},
|
105
110
|
});
|
106
111
|
return imManager;
|
107
112
|
});
|
@@ -69,12 +69,12 @@ const MessageBar = (0, react_1.forwardRef)(({ onKeyboardAt }, ref) => {
|
|
69
69
|
const keyboardHeight = (0, react_1.useRef)(240);
|
70
70
|
const handleChange = (0, react_1.useCallback)((text) => {
|
71
71
|
tempText.current = text;
|
72
|
-
const trimTxt = text.trim();
|
73
|
-
if (
|
72
|
+
// const trimTxt = text.trim();
|
73
|
+
if (text.length && !lazy.current) {
|
74
74
|
setShowSend(true);
|
75
75
|
lazy.current = true;
|
76
76
|
}
|
77
|
-
else if (!
|
77
|
+
else if (!text.length) {
|
78
78
|
setShowSend(false);
|
79
79
|
lazy.current = false;
|
80
80
|
}
|
@@ -154,6 +154,23 @@ const MessageBar = (0, react_1.forwardRef)(({ onKeyboardAt }, ref) => {
|
|
154
154
|
const handleSendText = (0, react_1.useCallback)(() => __awaiter(void 0, void 0, void 0, function* () {
|
155
155
|
var _a, _b;
|
156
156
|
const text = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.getText();
|
157
|
+
if (text.trim().length === 0) {
|
158
|
+
const { close } = rn_ui_1.Modal.open({
|
159
|
+
title: t('tips'),
|
160
|
+
content: t('cantSendEmptyMsg'),
|
161
|
+
footer: {
|
162
|
+
confirmButton: {
|
163
|
+
text: t('confirm'),
|
164
|
+
onPress: () => {
|
165
|
+
close();
|
166
|
+
return true;
|
167
|
+
}
|
168
|
+
},
|
169
|
+
cancelButton: false,
|
170
|
+
}
|
171
|
+
});
|
172
|
+
return;
|
173
|
+
}
|
157
174
|
(_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.clear();
|
158
175
|
tempText.current = '';
|
159
176
|
handleChange('');
|
package/dist/utils/cookie.d.ts
CHANGED
package/dist/utils/cookie.js
CHANGED
@@ -12,14 +12,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
exports.getCookieString = void 0;
|
15
|
+
exports.clearCookies = exports.getCookieString = void 0;
|
16
16
|
const request_1 = require("../utils/request");
|
17
17
|
const cookies_1 = __importDefault(require("@react-native-cookies/cookies"));
|
18
|
+
let cookiesStr = '';
|
18
19
|
const getCookieString = () => __awaiter(void 0, void 0, void 0, function* () {
|
20
|
+
if (cookiesStr)
|
21
|
+
return cookiesStr;
|
19
22
|
const url = (0, request_1.getBaseURL)();
|
20
23
|
const cookies = yield cookies_1.default.get(url);
|
21
|
-
|
24
|
+
cookiesStr = Object.keys(cookies).map((key) => {
|
22
25
|
return `${key}=${cookies[key].value}`;
|
23
26
|
}).join(';');
|
27
|
+
return cookiesStr;
|
24
28
|
});
|
25
29
|
exports.getCookieString = getCookieString;
|
30
|
+
const clearCookies = () => __awaiter(void 0, void 0, void 0, function* () {
|
31
|
+
cookiesStr = '';
|
32
|
+
});
|
33
|
+
exports.clearCookies = clearCookies;
|
package/package.json
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "@smart-link/rn-im",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.11",
|
4
4
|
"description": "",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"dependencies": {
|
7
7
|
"color": "^5.0.0",
|
8
8
|
"lodash-es": "^4.17.21",
|
9
9
|
"emoji-regex": "^10.4.0",
|
10
|
-
"@smart-link/im-base": "^1.0.
|
10
|
+
"@smart-link/im-base": "^1.0.11"
|
11
11
|
},
|
12
12
|
"devDependencies": {
|
13
13
|
"@react-native/eslint-config": "0.73.2",
|