@smart-link/rn-im 1.0.9 → 1.0.10

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
  });
@@ -1 +1,2 @@
1
1
  export declare const getCookieString: () => Promise<string>;
2
+ export declare const clearCookies: () => Promise<void>;
@@ -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
- return Object.keys(cookies).map((key) => {
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.9",
3
+ "version": "1.0.10",
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.9"
10
+ "@smart-link/im-base": "^1.0.10"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@react-native/eslint-config": "0.73.2",