@smart-link/rn-im 1.0.18 → 1.0.19
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/hooks/useDownloadSource.d.ts +3 -0
- package/dist/hooks/useDownloadSource.js +68 -0
- package/dist/pages/conversation/setting/OptionGroupMoreMember.js +1 -1
- package/dist/pages/conversation/setting/Setting.js +5 -6
- package/dist/pages/message/MessageBackup/utils.js +1 -1
- package/dist/pages/message/components/TextMixQuote.js +10 -7
- package/dist/slice/contact/contact.slice.d.ts +2 -2
- package/dist/slice/contact/contact.slice.js +1 -1
- package/dist/slice/index.d.ts +3 -3
- package/dist/slice/index.js +0 -1
- package/dist/slice/panel/panel.slice.d.ts +2 -2
- package/dist/slice/panel/panel.slice.js +1 -1
- package/dist/slice/video/video.slice.d.ts +3 -3
- package/dist/slice/video/video.slice.js +1 -2
- package/package.json +7 -7
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.useDownloadImgSource = void 0;
|
13
|
+
const react_1 = require("react");
|
14
|
+
const init_1 = require("../init");
|
15
|
+
function useDownload({ fileId, localPath, filename }) {
|
16
|
+
const [local, setLocal] = (0, react_1.useState)(localPath);
|
17
|
+
(0, react_1.useEffect)(() => {
|
18
|
+
let cancel = false;
|
19
|
+
const load = () => __awaiter(this, void 0, void 0, function* () {
|
20
|
+
const imManager = (0, init_1.getImManager)();
|
21
|
+
if (!localPath && fileId) {
|
22
|
+
const tmp = yield imManager.loadResourceFromCache(fileId);
|
23
|
+
if (tmp) {
|
24
|
+
!cancel && setLocal(tmp);
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
const file = yield imManager.download({
|
28
|
+
fileId,
|
29
|
+
filename: filename || fileId,
|
30
|
+
resourceType: 'file',
|
31
|
+
});
|
32
|
+
yield imManager.updateResource({
|
33
|
+
url: fileId,
|
34
|
+
localPath: file,
|
35
|
+
});
|
36
|
+
if (cancel) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
setLocal(file);
|
40
|
+
}
|
41
|
+
});
|
42
|
+
load();
|
43
|
+
return () => {
|
44
|
+
cancel = true;
|
45
|
+
};
|
46
|
+
}, [localPath, fileId, filename]);
|
47
|
+
return local;
|
48
|
+
}
|
49
|
+
function useDownloadImgSource(payload) {
|
50
|
+
const { imageName, imagePath, imageFileId } = payload;
|
51
|
+
return useDownload({
|
52
|
+
localPath: imagePath,
|
53
|
+
fileId: imageFileId,
|
54
|
+
filename: imageName,
|
55
|
+
resourceType: 'picture'
|
56
|
+
});
|
57
|
+
}
|
58
|
+
exports.useDownloadImgSource = useDownloadImgSource;
|
59
|
+
function useDownloadSource(payload) {
|
60
|
+
const { localPath, fileId, filename, } = payload;
|
61
|
+
return useDownload({
|
62
|
+
localPath,
|
63
|
+
fileId,
|
64
|
+
filename,
|
65
|
+
resourceType: 'picture',
|
66
|
+
});
|
67
|
+
}
|
68
|
+
exports.default = useDownloadSource;
|
@@ -62,7 +62,7 @@ const OptionGroupMoreMember = (props) => {
|
|
62
62
|
</react_native_1.TouchableOpacity>);
|
63
63
|
};
|
64
64
|
const list = (0, react_1.useMemo)(() => {
|
65
|
-
const allMembersData = allMembers.
|
65
|
+
const allMembersData = allMembers.filter((item) => {
|
66
66
|
if (keyword) {
|
67
67
|
return item.memberName.indexOf(keyword) > -1;
|
68
68
|
}
|
@@ -22,8 +22,9 @@ const { LIAISON } = im_base_1.GroupType;
|
|
22
22
|
// 最大显示人数
|
23
23
|
const MAX_SHOW_MEMBER_COUNT = 23;
|
24
24
|
const ConversationSetting = ({ navigation }) => {
|
25
|
-
var _a
|
25
|
+
var _a;
|
26
26
|
const { t } = (0, useTranslation_1.default)();
|
27
|
+
const { allMembers } = (0, useImSelector_1.useMessage)();
|
27
28
|
const { currentConversation } = (0, useImSelector_1.useConversation)();
|
28
29
|
const { groupDetail } = (0, useImSelector_1.useChatGroup)();
|
29
30
|
const title = t('chatSetting');
|
@@ -59,7 +60,6 @@ const ConversationSetting = ({ navigation }) => {
|
|
59
60
|
}, t);
|
60
61
|
};
|
61
62
|
const { id, type, name, avatars, enableNoDisturb = 'off', enableTop = 'off', notice = '', enableInviteValidate = 'off', memberLevel = MEMBER, groupType, } = currentConversation;
|
62
|
-
const groupMemberList = (_a = groupDetail === null || groupDetail === void 0 ? void 0 : groupDetail.groupMemberList.slice().reverse()) !== null && _a !== void 0 ? _a : [];
|
63
63
|
console.log('type: ', type, '[memberLevel]', memberLevel);
|
64
64
|
const isMgr = memberLevel === MGR || memberLevel === OWNER;
|
65
65
|
// 离开群组
|
@@ -136,7 +136,7 @@ const ConversationSetting = ({ navigation }) => {
|
|
136
136
|
</>);
|
137
137
|
break;
|
138
138
|
case im_base_1.ConversationType.C2G:
|
139
|
-
let avatarList =
|
139
|
+
let avatarList = allMembers
|
140
140
|
.map(item => {
|
141
141
|
var _a;
|
142
142
|
return {
|
@@ -147,12 +147,12 @@ const ConversationSetting = ({ navigation }) => {
|
|
147
147
|
};
|
148
148
|
})
|
149
149
|
.splice(0, MAX_SHOW_MEMBER_COUNT);
|
150
|
-
let fMaster =
|
150
|
+
let fMaster = allMembers.find(item => item.memberLevel === OWNER);
|
151
151
|
// 假设 fMaster 是要插入的对象,且它有一个唯一标识,比如 userId
|
152
152
|
if (fMaster) {
|
153
153
|
const fMasterWithRequiredFields = {
|
154
154
|
userId: fMaster.userId,
|
155
|
-
userName: (
|
155
|
+
userName: (_a = fMaster.memberName) !== null && _a !== void 0 ? _a : '',
|
156
156
|
avatars: fMaster.memberAvatars,
|
157
157
|
memberLevel: fMaster.memberLevel,
|
158
158
|
};
|
@@ -173,7 +173,6 @@ const ConversationSetting = ({ navigation }) => {
|
|
173
173
|
checkMode: 'multi',
|
174
174
|
});
|
175
175
|
}} removeUser={removeUser} toMoreMember={() => {
|
176
|
-
(0, init_1.getImManager)().store.dispatch(im_base_1.MessagePanelActions.loadAllMembers(id));
|
177
176
|
navigation.navigate('OptionGroupMoreMember');
|
178
177
|
}}/>
|
179
178
|
<rn_ui_1.Space size={'m'}/>
|
@@ -41,6 +41,7 @@ const LocalImage_1 = __importDefault(require("../../../components/LocalImage"));
|
|
41
41
|
const useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
|
42
42
|
const init_1 = require("../../../init");
|
43
43
|
const PayloadFile_1 = __importDefault(require("./Payload/PayloadFile"));
|
44
|
+
const useDownloadSource_1 = __importStar(require("../../../hooks/useDownloadSource"));
|
44
45
|
const voiceLeft = require('../../../../assets/voice-left.png');
|
45
46
|
const { width } = react_native_1.Dimensions.get('window');
|
46
47
|
exports.QuoteTextMix = (0, react_1.memo)(props => {
|
@@ -56,9 +57,10 @@ exports.QuoteTextMix = (0, react_1.memo)(props => {
|
|
56
57
|
});
|
57
58
|
exports.QuotePicture = (0, react_1.memo)(props => {
|
58
59
|
const { quoteTitle, quoteMessage, quoteStyle, color, textStyle, borderColor, backgroundColor, onPressQuote } = props;
|
59
|
-
const { height, width
|
60
|
+
const { height, width } = quoteMessage.payload;
|
60
61
|
const theme = (0, rn_ui_1.useTheme)();
|
61
62
|
console.log('QuotePicture', quoteMessage);
|
63
|
+
const localImg = (0, useDownloadSource_1.default)(quoteMessage.payload);
|
62
64
|
const sizeStyle = (0, golden_rectangle_1.calculate)(height || 100, width || 61.8, 100);
|
63
65
|
return (<react_native_1.TouchableOpacity activeOpacity={0.5} onPress={onPressQuote} style={[quoteStyle, styles.leftBorder, { backgroundColor: (0, color_1.dark)(color, 6) }]}>
|
64
66
|
<react_native_1.Text style={[textStyle, styles.replyUserName]}>
|
@@ -66,7 +68,7 @@ exports.QuotePicture = (0, react_1.memo)(props => {
|
|
66
68
|
{' : '}
|
67
69
|
</react_native_1.Text>
|
68
70
|
<react_native_1.View style={styles.h5}/>
|
69
|
-
{(!
|
71
|
+
{(!localImg) && (<react_native_1.View style={[
|
70
72
|
styles.pictureEmpty,
|
71
73
|
Object.assign({ backgroundColor,
|
72
74
|
borderColor }, sizeStyle),
|
@@ -75,22 +77,23 @@ exports.QuotePicture = (0, react_1.memo)(props => {
|
|
75
77
|
<react_native_1.ActivityIndicator color={theme.primaryColor} animating={true}/>
|
76
78
|
</react_native_1.View>)}
|
77
79
|
|
78
|
-
{
|
80
|
+
{localImg && (<LocalImage_1.default style={sizeStyle} resizeMode="cover" localPath={localImg}/>)}
|
79
81
|
</react_native_1.TouchableOpacity>);
|
80
82
|
});
|
81
83
|
exports.QuoteVideo = (0, react_1.memo)(props => {
|
82
84
|
const { quoteTitle, quoteMessage, quoteStyle, color, textStyle, borderColor, backgroundColor, onPressQuote } = props;
|
83
|
-
const { duration, height, width
|
85
|
+
const { duration, height, width } = quoteMessage.payload;
|
84
86
|
const theme = (0, rn_ui_1.useTheme)();
|
85
87
|
console.log('QuoteVideo: ', quoteMessage);
|
86
88
|
const sizeStyle = (0, golden_rectangle_1.calculate)(height, width);
|
89
|
+
const localImg = (0, useDownloadSource_1.useDownloadImgSource)(quoteMessage.payload);
|
87
90
|
return (<react_native_1.TouchableOpacity activeOpacity={0.5} onPress={onPressQuote} style={[quoteStyle, styles.leftBorder, { backgroundColor: (0, color_1.dark)(color, 6) }]}>
|
88
91
|
<react_native_1.Text style={[textStyle, styles.replyUserName]}>
|
89
92
|
{quoteTitle}
|
90
93
|
{' : '}
|
91
94
|
</react_native_1.Text>
|
92
95
|
<react_native_1.View style={styles.h5}/>
|
93
|
-
{(!
|
96
|
+
{(!localImg) && (<react_native_1.View style={[
|
94
97
|
styles.pictureEmpty,
|
95
98
|
Object.assign({ backgroundColor,
|
96
99
|
borderColor }, sizeStyle),
|
@@ -99,8 +102,8 @@ exports.QuoteVideo = (0, react_1.memo)(props => {
|
|
99
102
|
<react_native_1.ActivityIndicator color={theme.primaryColor} animating={true}/>
|
100
103
|
</react_native_1.View>)}
|
101
104
|
|
102
|
-
{
|
103
|
-
<LocalImage_1.default style={sizeStyle} resizeMode="cover" localPath={
|
105
|
+
{localImg && (<react_native_1.View style={{ width: sizeStyle.width }}>
|
106
|
+
<LocalImage_1.default style={sizeStyle} resizeMode="cover" localPath={localImg}/>
|
104
107
|
<react_native_1.View style={styles.playView}>
|
105
108
|
<AntDesign_1.default size={30} name="playcircleo" color="#fff"/>
|
106
109
|
</react_native_1.View>
|
@@ -7,6 +7,6 @@ export interface ContactState {
|
|
7
7
|
currentRoot: 'organization' | 'role' | 'none';
|
8
8
|
choosePurpose: 'createGroup' | 'contact' | 'addMember' | 'none';
|
9
9
|
}
|
10
|
-
export declare const setSelectUsers: import("
|
11
|
-
declare const _default: import("
|
10
|
+
export declare const setSelectUsers: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/contact/setSelectUsers">, setSelectGroups: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/contact/setSelectGroups">, setCurrentRoot: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/contact/setCurrentRoot">, onSelectUser: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/contact/onSelectUser">, startCreateGroup: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithoutPayload<"chat/contact/startCreateGroup">, startAddMember: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithoutPayload<"chat/contact/startAddMember">, resetState: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithoutPayload<"chat/contact/resetState">, startSendContact: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithoutPayload<"chat/contact/startSendContact">, onDefaultCheckedUser: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/contact/onDefaultCheckedUser">;
|
11
|
+
declare const _default: import("../../../node_modules/redux").Reducer<ContactState>;
|
12
12
|
export default _default;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
var _a;
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
4
|
exports.onDefaultCheckedUser = exports.startSendContact = exports.resetState = exports.startAddMember = exports.startCreateGroup = exports.onSelectUser = exports.setCurrentRoot = exports.setSelectGroups = exports.setSelectUsers = void 0;
|
5
|
-
const toolkit_1 = require("
|
5
|
+
const toolkit_1 = require("../../../node_modules/@reduxjs/toolkit");
|
6
6
|
const initialState = {
|
7
7
|
selectUsers: {},
|
8
8
|
selectGroups: {},
|
package/dist/slice/index.d.ts
CHANGED
@@ -2,8 +2,8 @@ import { VideoState } from './video/video.slice';
|
|
2
2
|
import { ContactState } from './contact/contact.slice';
|
3
3
|
import { PanelState } from './panel/panel.slice';
|
4
4
|
export declare const chatReducers: {
|
5
|
-
'chat/video': import("
|
6
|
-
'chat/contact': import("
|
7
|
-
'chat/panel': import("
|
5
|
+
'chat/video': import("../../node_modules/redux").Reducer<VideoState>;
|
6
|
+
'chat/contact': import("../../node_modules/redux").Reducer<ContactState>;
|
7
|
+
'chat/panel': import("../../node_modules/redux").Reducer<PanelState>;
|
8
8
|
};
|
9
9
|
export type { VideoState, ContactState, PanelState };
|
package/dist/slice/index.js
CHANGED
@@ -7,7 +7,6 @@ exports.chatReducers = void 0;
|
|
7
7
|
const video_slice_1 = __importDefault(require("./video/video.slice"));
|
8
8
|
const contact_slice_1 = __importDefault(require("./contact/contact.slice"));
|
9
9
|
const panel_slice_1 = __importDefault(require("./panel/panel.slice"));
|
10
|
-
// @ts-ignore
|
11
10
|
exports.chatReducers = {
|
12
11
|
'chat/video': video_slice_1.default,
|
13
12
|
'chat/contact': contact_slice_1.default,
|
@@ -3,6 +3,6 @@ export interface PanelState {
|
|
3
3
|
type: 'emoji' | 'option' | 'voice';
|
4
4
|
messageBarHeight: number;
|
5
5
|
}
|
6
|
-
export declare const setMessageBarHeight: import("
|
7
|
-
declare const _default: import("
|
6
|
+
export declare const setMessageBarHeight: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/panel/setMessageBarHeight">;
|
7
|
+
declare const _default: import("../../../node_modules/redux").Reducer<PanelState>;
|
8
8
|
export default _default;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.setMessageBarHeight = void 0;
|
4
|
-
const toolkit_1 = require("
|
4
|
+
const toolkit_1 = require("../../../node_modules/@reduxjs/toolkit");
|
5
5
|
const panelSlice = (0, toolkit_1.createSlice)({
|
6
6
|
name: 'chat/panel',
|
7
7
|
initialState: {
|
@@ -7,11 +7,11 @@ export type VideoState = {
|
|
7
7
|
videoDownloadError: boolean;
|
8
8
|
videoDownloadProgress: number;
|
9
9
|
};
|
10
|
-
export declare const showVideoPlayer: import("
|
10
|
+
export declare const showVideoPlayer: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithPayload<{
|
11
11
|
videoLocalPath: string;
|
12
12
|
videoImagePath: string;
|
13
13
|
videoImageHeight: number;
|
14
14
|
videoImageWidth: number;
|
15
|
-
}, "chat/video/showVideoPlayer">, cancelVideoPlayer: import("
|
16
|
-
declare const _default: import("
|
15
|
+
}, "chat/video/showVideoPlayer">, cancelVideoPlayer: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithoutPayload<"chat/video/cancelVideoPlayer">, setVideoDownloadProgress: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/video/setVideoDownloadProgress">, setShowVideoPlay: import("../../../node_modules/@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/video/setShowVideoPlay">;
|
16
|
+
declare const _default: import("../../../node_modules/redux").Reducer<VideoState>;
|
17
17
|
export default _default;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
var _a;
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
4
|
exports.setShowVideoPlay = exports.setVideoDownloadProgress = exports.cancelVideoPlayer = exports.showVideoPlayer = void 0;
|
5
|
-
const toolkit_1 = require("
|
5
|
+
const toolkit_1 = require("../../../node_modules/@reduxjs/toolkit");
|
6
6
|
const videoSlice = (0, toolkit_1.createSlice)({
|
7
7
|
name: 'chat/video',
|
8
8
|
initialState: {
|
@@ -35,6 +35,5 @@ const videoSlice = (0, toolkit_1.createSlice)({
|
|
35
35
|
}
|
36
36
|
}
|
37
37
|
});
|
38
|
-
// @ts-ignore;
|
39
38
|
_a = videoSlice.actions, exports.showVideoPlayer = _a.showVideoPlayer, exports.cancelVideoPlayer = _a.cancelVideoPlayer, exports.setVideoDownloadProgress = _a.setVideoDownloadProgress, exports.setShowVideoPlay = _a.setShowVideoPlay;
|
40
39
|
exports.default = videoSlice.reducer;
|
package/package.json
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@smart-link/rn-im",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.19",
|
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
|
-
"emoji-regex": "^10.4.0"
|
10
|
-
"@smart-link/im-base": "^1.0.16"
|
9
|
+
"emoji-regex": "^10.4.0"
|
11
10
|
},
|
12
11
|
"devDependencies": {
|
13
12
|
"@react-native/eslint-config": "0.73.2",
|
@@ -21,7 +20,8 @@
|
|
21
20
|
"rimraf": "^6.0.1",
|
22
21
|
"tsc-alias": "^1.8.10",
|
23
22
|
"typescript": "5.0.4",
|
24
|
-
"react-native": "^0.73.0"
|
23
|
+
"react-native": "^0.73.0",
|
24
|
+
"redux": "^4.2.1"
|
25
25
|
},
|
26
26
|
"peerDependencies": {
|
27
27
|
"@baronha/react-native-photo-editor": "1.1.6",
|
@@ -36,6 +36,7 @@
|
|
36
36
|
"@react-navigation/native": "6.1.7",
|
37
37
|
"@react-navigation/native-stack": "6.9.13",
|
38
38
|
"@reduxjs/toolkit": "^1.5.0",
|
39
|
+
"@smart-link/im-base": "^1.0.18",
|
39
40
|
"ahooks": "^3.8.0",
|
40
41
|
"axios": "^0.30.0",
|
41
42
|
"dayjs": "^1.11.9",
|
@@ -63,8 +64,7 @@
|
|
63
64
|
"react-redux": "^8.1.3",
|
64
65
|
"redux": "^4.2.1",
|
65
66
|
"redux-thunk": "^2.4.2",
|
66
|
-
"@smart-link/rn-ui": "^1.0.6"
|
67
|
-
"@smart-link/rn-base": "^1.0.7"
|
67
|
+
"@smart-link/rn-ui": "^1.0.6"
|
68
68
|
},
|
69
69
|
"files": [
|
70
70
|
"dist/**",
|
@@ -74,7 +74,7 @@
|
|
74
74
|
"scripts": {
|
75
75
|
"clean": "rimraf ./dist",
|
76
76
|
"build": "pnpm run clean && tsc && tsc-alias",
|
77
|
-
"build:watch": "concurrently \"tsc -w\" \"tsc-alias -w\"",
|
77
|
+
"build:watch": "tsc && concurrently \"tsc -w\" \"tsc-alias -w\"",
|
78
78
|
"release": "pnpm build && pnpm publish --tag latest --access public --no-git-checks"
|
79
79
|
}
|
80
80
|
}
|