@smart-link/rn-im 1.0.23 → 1.0.24
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/api/addressList.js +6 -17
- package/dist/api/backup.js +8 -20
- package/dist/api/file.js +6 -35
- package/dist/api/user.js +6 -16
- package/dist/components/CachedImage.js +14 -42
- package/dist/components/Camera/Camera.js +26 -54
- package/dist/components/Camera/CameraCapture.js +99 -128
- package/dist/components/Camera/CameraResult.js +33 -61
- package/dist/components/ChatAvatar/ChatAvatar.d.ts +1 -1
- package/dist/components/ChatAvatar/ChatAvatar.js +34 -62
- package/dist/components/ChatAvatar/ChatAvatarId.d.ts +2 -2
- package/dist/components/ChatAvatar/ChatAvatarId.js +26 -51
- package/dist/components/ChatAvatar/ChatAvatarLocal.d.ts +2 -2
- package/dist/components/ChatAvatar/ChatAvatarLocal.js +23 -25
- package/dist/components/ChatAvatar/index.js +2 -23
- package/dist/components/Favicon.js +6 -34
- package/dist/components/FormatTimeText.js +5 -10
- package/dist/components/Highlighter.js +9 -34
- package/dist/components/IndicatorText.js +14 -39
- package/dist/components/LocalImage.js +7 -32
- package/dist/components/NetworkUnconnected.js +14 -42
- package/dist/components/PopoverWrapper.js +22 -47
- package/dist/components/VideoPlayer.js +111 -138
- package/dist/components/styles.js +10 -13
- package/dist/default-assets.d.ts +1 -0
- package/dist/default-assets.js +8 -10
- package/dist/hooks/useDownloadSource.js +7 -12
- package/dist/hooks/useFormatMsgTime.js +5 -13
- package/dist/hooks/useImReady.js +7 -10
- package/dist/hooks/useImSelector.js +34 -48
- package/dist/hooks/useTranslation.js +5 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -28
- package/dist/init.js +30 -40
- package/dist/interface.js +1 -2
- package/dist/locales/en/addressList.js +1 -3
- package/dist/locales/index.js +4 -27
- package/dist/locales/lao/addressList.js +1 -3
- package/dist/locales/zh/addressList.js +1 -3
- package/dist/pages/address-list/AddressList.js +33 -61
- package/dist/pages/address-list/CardInfo.js +10 -18
- package/dist/pages/address-list/ChooseContact.js +50 -78
- package/dist/pages/address-list/Icons.js +7 -14
- package/dist/pages/address-list/Organization.js +59 -89
- package/dist/pages/address-list/UserDetail.js +55 -83
- package/dist/pages/address-list/UserJobs.js +31 -33
- package/dist/pages/address-list/UserSearch.js +29 -54
- package/dist/pages/address-list/addressList.routes.js +11 -16
- package/dist/pages/collection/Collection.js +53 -81
- package/dist/pages/collection/ContentFactory.js +53 -82
- package/dist/pages/collection/collection.routes.js +3 -9
- package/dist/pages/conversation/ForwardToConversation.js +63 -91
- package/dist/pages/conversation/List.js +74 -102
- package/dist/pages/conversation/components/ConversationCard.js +46 -74
- package/dist/pages/conversation/components/ConversationOption.js +27 -55
- package/dist/pages/conversation/conversation.routes.js +17 -23
- package/dist/pages/conversation/setting/GroupTransfer.js +32 -60
- package/dist/pages/conversation/setting/OptionAvatars.js +62 -90
- package/dist/pages/conversation/setting/OptionCancelGroup.js +14 -42
- package/dist/pages/conversation/setting/OptionConversation.js +20 -48
- package/dist/pages/conversation/setting/OptionGroup.js +20 -48
- package/dist/pages/conversation/setting/OptionGroupManage.js +21 -49
- package/dist/pages/conversation/setting/OptionGroupMoreMember.js +48 -53
- package/dist/pages/conversation/setting/OptionGroupNameOrNoticeEdit.js +49 -77
- package/dist/pages/conversation/setting/Setting.js +49 -54
- package/dist/pages/conversation/setting/SettingChatBg.js +26 -54
- package/dist/pages/index.js +7 -27
- package/dist/pages/message/ChooseMember.js +56 -84
- package/dist/pages/message/MessageBackup/Bar.js +18 -43
- package/dist/pages/message/MessageBackup/MessageBackup.js +42 -72
- package/dist/pages/message/MessageBackup/RestoreBackupPage.js +48 -76
- package/dist/pages/message/MessageBackup/StartBackupPage.js +48 -76
- package/dist/pages/message/MessageBackup/index.js +3 -12
- package/dist/pages/message/MessageBackup/utils.js +14 -22
- package/dist/pages/message/MessageList.js +141 -135
- package/dist/pages/message/MessageRecord.js +49 -73
- package/dist/pages/message/components/BusiNotifyCard.js +60 -85
- package/dist/pages/message/components/ChatBg.js +11 -36
- package/dist/pages/message/components/MessageItem.js +82 -110
- package/dist/pages/message/components/MessageItemQuote.js +30 -58
- package/dist/pages/message/components/MessageItemTips.js +27 -55
- package/dist/pages/message/components/MessageOption.js +96 -120
- package/dist/pages/message/components/MessagePayload.js +36 -64
- package/dist/pages/message/components/MessagePictureAlbum.js +32 -60
- package/dist/pages/message/components/MessageReceiptStatus.js +18 -43
- package/dist/pages/message/components/MessageUndo.js +18 -48
- package/dist/pages/message/components/MultipleBar/index.js +48 -76
- package/dist/pages/message/components/Payload/PayloadContact.js +30 -58
- package/dist/pages/message/components/Payload/PayloadFile.js +41 -65
- package/dist/pages/message/components/Payload/PayloadMultiple.js +38 -66
- package/dist/pages/message/components/Payload/PayloadNotify.js +28 -56
- package/dist/pages/message/components/Payload/PayloadPicture.js +21 -49
- package/dist/pages/message/components/Payload/PayloadShare.js +39 -67
- package/dist/pages/message/components/Payload/PayloadText.js +39 -67
- package/dist/pages/message/components/Payload/PayloadVideo.js +28 -56
- package/dist/pages/message/components/Payload/PayloadVoice.js +80 -93
- package/dist/pages/message/components/Payload/PayloadWrapper.js +18 -43
- package/dist/pages/message/components/Payload/type.js +1 -2
- package/dist/pages/message/components/ReceiptBack.js +31 -61
- package/dist/pages/message/components/TextMixMessage.js +13 -38
- package/dist/pages/message/components/TextMixQuote.js +129 -158
- package/dist/pages/message/components/TextMixQuoteMessage.js +16 -44
- package/dist/pages/message/components/UploadProgress.js +12 -37
- package/dist/pages/message/components/messageBar/EmojiPanel.js +25 -50
- package/dist/pages/message/components/messageBar/Icons.js +56 -74
- package/dist/pages/message/components/messageBar/MessageBar.js +84 -115
- package/dist/pages/message/components/messageBar/MessageInput.js +30 -55
- package/dist/pages/message/components/messageBar/OptionPanel.js +54 -82
- package/dist/pages/message/components/messageBar/VoiceBar.js +122 -100
- package/dist/pages/message/components/messageBar/index.js +2 -23
- package/dist/pages/message/message.routes.js +11 -40
- package/dist/pages/search/Search.js +38 -66
- package/dist/pages/search/SearchChatRecords.js +64 -92
- package/dist/pages/search/SearchFile.js +68 -96
- package/dist/pages/search/SearchManager.js +60 -65
- package/dist/pages/search/SearchPicturePage.js +16 -44
- package/dist/pages/search/components/ChatRecords.js +46 -74
- package/dist/pages/search/components/MyGroupChat.js +41 -69
- package/dist/pages/search/components/PictureMulipleBar.js +35 -63
- package/dist/pages/search/components/SearchFileList.js +59 -64
- package/dist/pages/search/components/SearchPictures.js +68 -98
- package/dist/pages/search/components/SearchShareLinkList.js +50 -55
- package/dist/pages/search/components/SearchUser.js +25 -53
- package/dist/pages/search/components/useSearchMessage.js +12 -16
- package/dist/pages/search/search.routes.js +11 -17
- package/dist/pages/search/utils.js +4 -12
- package/dist/pages/types.js +1 -2
- package/dist/slice/contact/contact.action.js +1 -2
- package/dist/slice/contact/contact.slice.js +4 -8
- package/dist/slice/index.js +7 -13
- package/dist/slice/panel/panel.slice.d.ts +2 -1
- package/dist/slice/panel/panel.slice.js +8 -7
- package/dist/slice/video/video.action.d.ts +1 -0
- package/dist/slice/video/video.action.js +56 -38
- package/dist/slice/video/video.slice.d.ts +1 -1
- package/dist/slice/video/video.slice.js +7 -8
- package/dist/utils/audio.d.ts +3 -0
- package/dist/utils/audio.js +10 -0
- package/dist/utils/color.js +2 -9
- package/dist/utils/common-action-sheet.js +9 -14
- package/dist/utils/cookie.js +6 -14
- package/dist/utils/emoji.js +9 -12
- package/dist/utils/file-icon.js +33 -60
- package/dist/utils/file-operate.js +1 -2
- package/dist/utils/file.d.ts +1 -1
- package/dist/utils/file.js +74 -87
- package/dist/utils/golden-rectangle.js +3 -7
- package/dist/utils/phone.js +13 -22
- package/dist/utils/request.js +7 -15
- package/dist/utils/scroll.js +5 -9
- package/dist/utils/summary.js +4 -11
- package/dist/utils/take-camera.js +12 -19
- package/dist/utils/text-mix.js +4 -11
- package/dist/utils/upload.js +20 -41
- package/package.json +6 -7
@@ -1,55 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
}
|
8
|
-
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
-
};
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
30
|
-
const react_1 = __importStar(require("react"));
|
31
|
-
const react_native_1 = require("react-native");
|
32
|
-
const useTranslation_1 = __importDefault(require("../hooks/useTranslation"));
|
33
|
-
const NetworkUnconnected = (0, react_1.memo)(() => {
|
34
|
-
const { t } = (0, useTranslation_1.default)();
|
35
|
-
return (<react_native_1.View style={styles.network}>
|
36
|
-
<react_native_1.Text style={styles.text} numberOfLines={1}>
|
1
|
+
import { dp } from '@smart-link/rn-ui';
|
2
|
+
import React, { memo } from 'react';
|
3
|
+
import { StyleSheet, Text, View } from 'react-native';
|
4
|
+
import useTranslation from '../hooks/useTranslation';
|
5
|
+
const NetworkUnconnected = memo(() => {
|
6
|
+
const { t } = useTranslation();
|
7
|
+
return (<View style={styles.network}>
|
8
|
+
<Text style={styles.text} numberOfLines={1}>
|
37
9
|
{t('checkNetwork')}
|
38
|
-
</
|
39
|
-
</
|
10
|
+
</Text>
|
11
|
+
</View>);
|
40
12
|
});
|
41
|
-
const styles =
|
13
|
+
const styles = StyleSheet.create({
|
42
14
|
network: {
|
43
15
|
flexDirection: 'row',
|
44
|
-
paddingVertical:
|
16
|
+
paddingVertical: dp(10),
|
45
17
|
backgroundColor: '#feebeb',
|
46
18
|
justifyContent: 'center',
|
47
19
|
},
|
48
20
|
text: {
|
49
21
|
color: '#666',
|
50
|
-
lineHeight:
|
22
|
+
lineHeight: dp(21),
|
51
23
|
alignItems: 'center',
|
52
24
|
justifyContent: 'center',
|
53
25
|
},
|
54
26
|
});
|
55
|
-
|
27
|
+
export default NetworkUnconnected;
|
@@ -1,48 +1,23 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
const react_1 = __importStar(require("react"));
|
27
|
-
const react_native_1 = require("react-native");
|
28
|
-
const popover_1 = require("@smart-link/rn-ui/dist/components/popover");
|
29
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
30
|
-
const elements_1 = require("@react-navigation/elements");
|
1
|
+
import React, { memo, useCallback, useEffect, useState } from 'react';
|
2
|
+
import { Dimensions, NativeModules, StatusBar, StyleSheet, View, } from 'react-native';
|
3
|
+
import { PopoverBase } from '@smart-link/rn-ui/dist/components/popover';
|
4
|
+
import { dp } from '@smart-link/rn-ui';
|
5
|
+
import { useHeaderHeight } from '@react-navigation/elements';
|
31
6
|
const PopoverWrapper = ({ showArrow = true, measureTarget = true, visible, fullscreen, nativeEvent, children, onClose }) => {
|
32
7
|
var _a, _b;
|
33
|
-
const { height, width } =
|
34
|
-
const headerHeight =
|
35
|
-
const [contentHeight, setContentHeight] =
|
36
|
-
const [fromRect, setFromRect] =
|
8
|
+
const { height, width } = Dimensions.get('window');
|
9
|
+
const headerHeight = useHeaderHeight();
|
10
|
+
const [contentHeight, setContentHeight] = useState(0);
|
11
|
+
const [fromRect, setFromRect] = useState({ x: (_a = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.pageX) !== null && _a !== void 0 ? _a : 0,
|
37
12
|
y: (_b = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.pageY) !== null && _b !== void 0 ? _b : 0,
|
38
13
|
width: 0,
|
39
14
|
height: 0, });
|
40
|
-
const onLayout =
|
15
|
+
const onLayout = useCallback((event) => {
|
41
16
|
setContentHeight(event.nativeEvent.layout.height);
|
42
17
|
}, []);
|
43
|
-
|
18
|
+
useEffect(() => {
|
44
19
|
if (!measureTarget && (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.pageX)) {
|
45
|
-
setFromRect(prev => { var _a, _b; return (Object.assign(Object.assign({}, prev), { x: (_a = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.pageX) !== null && _a !== void 0 ? _a : 0, y: ((_b = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.pageY) !== null && _b !== void 0 ? _b : 0) -
|
20
|
+
setFromRect(prev => { var _a, _b; return (Object.assign(Object.assign({}, prev), { x: (_a = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.pageX) !== null && _a !== void 0 ? _a : 0, y: ((_b = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.pageY) !== null && _b !== void 0 ? _b : 0) - StatusBar.currentHeight })); });
|
46
21
|
}
|
47
22
|
if (!measureTarget || !(nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.target))
|
48
23
|
return;
|
@@ -54,25 +29,25 @@ const PopoverWrapper = ({ showArrow = true, measureTarget = true, visible, fulls
|
|
54
29
|
height,
|
55
30
|
});
|
56
31
|
};
|
57
|
-
|
32
|
+
NativeModules.UIManager.measure(nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.target, callback);
|
58
33
|
}, [visible, measureTarget, nativeEvent]);
|
59
|
-
const padding =
|
60
|
-
const viewHeight = height -
|
61
|
-
return (<
|
34
|
+
const padding = dp(12);
|
35
|
+
const viewHeight = height - StatusBar.currentHeight - 46 - 48 - padding * 2;
|
36
|
+
return (<PopoverBase calculateStatusBar useNativeDriver showArrow={showArrow} duration={100} contentStyle={styles.content} backgroundStyle={styles.bg} visible={visible} fromRect={fromRect} placement={fromRect.y + contentHeight > viewHeight ? 'top' : 'bottom'} displayArea={measureTarget ? {
|
62
37
|
x: padding,
|
63
38
|
y: headerHeight,
|
64
39
|
width: width - padding * 2,
|
65
|
-
height: height -
|
40
|
+
height: height - StatusBar.currentHeight - 46 - headerHeight - padding * 2,
|
66
41
|
} : undefined} onClose={onClose}>
|
67
|
-
<
|
68
|
-
</
|
42
|
+
<View onLayout={onLayout}>{children}</View>
|
43
|
+
</PopoverBase>);
|
69
44
|
};
|
70
|
-
const styles =
|
45
|
+
const styles = StyleSheet.create({
|
71
46
|
bg: {
|
72
47
|
backgroundColor: 'transparent',
|
73
48
|
},
|
74
49
|
content: {
|
75
|
-
borderRadius:
|
50
|
+
borderRadius: dp(6),
|
76
51
|
},
|
77
52
|
});
|
78
|
-
|
53
|
+
export default memo(PopoverWrapper);
|
@@ -1,70 +1,39 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
-
};
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
const react_1 = __importStar(require("react"));
|
30
|
-
const react_native_1 = require("react-native");
|
31
|
-
const react_native_video_1 = __importDefault(require("react-native-video"));
|
32
|
-
const MaterialIcons_1 = __importDefault(require("react-native-vector-icons/MaterialIcons"));
|
33
|
-
const AntDesign_1 = __importDefault(require("react-native-vector-icons/AntDesign"));
|
34
|
-
const FontAwesome_1 = __importDefault(require("react-native-vector-icons/FontAwesome"));
|
35
|
-
const Progress = __importStar(require("react-native-progress"));
|
36
|
-
const slider_1 = __importDefault(require("@react-native-community/slider"));
|
37
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
38
|
-
const file_1 = require("../utils/file");
|
39
|
-
const im_base_1 = require("@smart-link/im-base");
|
40
|
-
const useTranslation_1 = __importDefault(require("../hooks/useTranslation"));
|
41
|
-
const useImSelector_1 = require("../hooks/useImSelector");
|
42
|
-
const video_slice_1 = require("../slice/video/video.slice");
|
43
|
-
const react_redux_1 = require("react-redux");
|
44
|
-
const { width: screenWidth } = react_native_1.Dimensions.get('screen');
|
45
|
-
const VideoPlayer = (0, react_1.memo)(() => {
|
46
|
-
const { showVideoPlay = false, videoLocalPath, videoImagePath, videoImageHeight, videoImageWidth, videoDownloadError, videoDownloadProgress = 0, } = (0, useImSelector_1.useVideo)();
|
1
|
+
import React, { memo, useEffect, useState } from 'react';
|
2
|
+
import { Modal, StyleSheet, Text, TouchableOpacity, View, ImageBackground, StatusBar, Platform, Dimensions, } from 'react-native';
|
3
|
+
import Video from 'react-native-video';
|
4
|
+
import MaterialIcons from "react-native-vector-icons/MaterialIcons";
|
5
|
+
import AntDesign from "react-native-vector-icons/AntDesign";
|
6
|
+
import FontAwesome from "react-native-vector-icons/FontAwesome";
|
7
|
+
import * as Progress from "react-native-progress";
|
8
|
+
import Slider from '@react-native-community/slider';
|
9
|
+
import { dp } from '@smart-link/rn-ui';
|
10
|
+
import { toAbsolutePath } from '../utils/file';
|
11
|
+
import { numberToTime } from '@smart-link/im-base';
|
12
|
+
import useTranslation from '../hooks/useTranslation';
|
13
|
+
import { useVideo } from '../hooks/useImSelector';
|
14
|
+
import { stopVideoPlayer } from "../slice/video/video.action";
|
15
|
+
import { getImManager } from "../init";
|
16
|
+
const { width: screenWidth } = Dimensions.get('screen');
|
17
|
+
const VideoPlayer = memo(() => {
|
18
|
+
const { showVideoPlay = false, videoLocalPath, videoImagePath, videoImageHeight, videoImageWidth, videoDownloadError, videoDownloadProgress = 0, } = useVideo();
|
47
19
|
// @ts-ignore
|
48
|
-
const player =
|
49
|
-
const
|
50
|
-
const { t } = (0, useTranslation_1.default)();
|
20
|
+
const player = React.useRef(null);
|
21
|
+
const { t } = useTranslation();
|
51
22
|
const videoImageSize = {
|
52
23
|
width: screenWidth,
|
53
|
-
height: (videoImageHeight > 500 ?
|
54
|
-
};
|
55
|
-
const [isError, setIsError] = (0, react_1.useState)(false);
|
56
|
-
const [duration, setDuration] = (0, react_1.useState)(0);
|
57
|
-
const [currentTime, setCurrentTime] = (0, react_1.useState)(0);
|
58
|
-
const [paused, setPaused] = (0, react_1.useState)(false);
|
59
|
-
const [pageX, setPageX] = (0, react_1.useState)(0);
|
60
|
-
const [pageXTime, setPageXTime] = (0, react_1.useState)(0);
|
61
|
-
const onBuffer = () => {
|
24
|
+
height: (videoImageHeight > 500 ? dp(500) : videoImageHeight * videoImageWidth / screenWidth)
|
62
25
|
};
|
26
|
+
const [isError, setIsError] = useState(false);
|
27
|
+
const [duration, setDuration] = useState(0);
|
28
|
+
const [currentTime, setCurrentTime] = useState(0);
|
29
|
+
const [paused, setPaused] = useState(false);
|
30
|
+
const [pageX, setPageX] = useState(0);
|
31
|
+
const [pageXTime, setPageXTime] = useState(0);
|
63
32
|
const onLoad = (data) => {
|
64
|
-
console.log('onLoad: ', data);
|
65
33
|
setDuration(data.duration);
|
66
34
|
};
|
67
|
-
const videoError = () => {
|
35
|
+
const videoError = (e) => {
|
36
|
+
console.log(e);
|
68
37
|
setIsError(true);
|
69
38
|
};
|
70
39
|
const onProgress = (data) => {
|
@@ -84,7 +53,7 @@ const VideoPlayer = (0, react_1.memo)(() => {
|
|
84
53
|
setPaused(false);
|
85
54
|
};
|
86
55
|
const onPressSeek = (evt) => {
|
87
|
-
if (
|
56
|
+
if (Platform.OS === 'ios') {
|
88
57
|
let { nativeEvent } = evt;
|
89
58
|
setPageX(nativeEvent.pageX);
|
90
59
|
setPageXTime(currentTime);
|
@@ -96,9 +65,9 @@ const VideoPlayer = (0, react_1.memo)(() => {
|
|
96
65
|
setPaused(true);
|
97
66
|
};
|
98
67
|
const onMoveSeek = (evt) => {
|
99
|
-
if (
|
68
|
+
if (Platform.OS === 'ios') {
|
100
69
|
let { nativeEvent } = evt;
|
101
|
-
let time = (nativeEvent.pageX - pageX) /
|
70
|
+
let time = (nativeEvent.pageX - pageX) / dp(200) * duration + pageXTime;
|
102
71
|
if (time < 0) {
|
103
72
|
time = 0;
|
104
73
|
}
|
@@ -116,7 +85,7 @@ const VideoPlayer = (0, react_1.memo)(() => {
|
|
116
85
|
setPageXTime(0);
|
117
86
|
setPaused(false);
|
118
87
|
};
|
119
|
-
|
88
|
+
useEffect(() => {
|
120
89
|
var _a;
|
121
90
|
if (showVideoPlay) {
|
122
91
|
(_a = player.current) === null || _a === void 0 ? void 0 : _a.seek(0);
|
@@ -124,73 +93,77 @@ const VideoPlayer = (0, react_1.memo)(() => {
|
|
124
93
|
setPaused(false);
|
125
94
|
setPageX(0);
|
126
95
|
setPageXTime(0);
|
96
|
+
setIsError(false);
|
127
97
|
}
|
128
98
|
}, [showVideoPlay]);
|
99
|
+
const stop = () => {
|
100
|
+
getImManager().store.dispatch(stopVideoPlayer());
|
101
|
+
setIsError(false);
|
102
|
+
};
|
129
103
|
if (!videoLocalPath && !videoImagePath) {
|
130
104
|
return null;
|
131
105
|
}
|
132
|
-
return (<
|
133
|
-
|
134
|
-
{
|
135
|
-
<
|
136
|
-
<react_native_1.View style={styles.video}>
|
106
|
+
return (<Modal animationType="fade" transparent={false} visible={showVideoPlay} onRequestClose={stop}>
|
107
|
+
{Platform.OS === 'android' &&
|
108
|
+
<StatusBar backgroundColor={'#000'}/>}
|
109
|
+
<View style={styles.video}>
|
137
110
|
|
138
111
|
{!videoLocalPath && videoImagePath &&
|
139
|
-
<
|
140
|
-
<Progress.Pie progress={videoDownloadProgress} size={
|
141
|
-
</
|
112
|
+
<ImageBackground style={[styles.videoImage, videoImageSize]} source={{ uri: toAbsolutePath(videoImagePath) }}>
|
113
|
+
<Progress.Pie progress={videoDownloadProgress} size={64} borderWidth={3} color={'#fff'}/>
|
114
|
+
</ImageBackground>}
|
142
115
|
|
143
116
|
{(isError || videoDownloadError) &&
|
144
|
-
<
|
145
|
-
<
|
146
|
-
<
|
147
|
-
</
|
117
|
+
<View style={styles.error}>
|
118
|
+
<MaterialIcons name={'error'} size={dp(50)} color={'#fff'}/>
|
119
|
+
<Text style={styles.errorText}>{t('videoLoadingError')}</Text>
|
120
|
+
</View>}
|
148
121
|
{!isError && videoLocalPath &&
|
149
|
-
<
|
150
|
-
<
|
151
|
-
<
|
152
|
-
</
|
122
|
+
<Video ref={player} source={{ uri: toAbsolutePath(videoLocalPath) }} paused={paused} resizeMode={'contain'} progressUpdateInterval={100} onLoad={onLoad} onProgress={onProgress} onEnd={onEnd} onError={videoError} style={styles.player}/>}
|
123
|
+
<TouchableOpacity activeOpacity={0.75} style={styles.cancel} onPress={stop}>
|
124
|
+
<AntDesign name='close' size={dp(25)} color={'#fff'}/>
|
125
|
+
</TouchableOpacity>
|
153
126
|
<PlayBar paused={paused} currentTime={currentTime} duration={duration} onPause={onPause} onResume={onResume} onPressSeek={onPressSeek} onMoveSeek={onMoveSeek} onReleaseSeek={onReleaseSeek}/>
|
154
|
-
</
|
155
|
-
</
|
127
|
+
</View>
|
128
|
+
</Modal>);
|
156
129
|
});
|
157
|
-
const PlayBar =
|
130
|
+
const PlayBar = memo(props => {
|
158
131
|
const { paused = false, currentTime, duration, onPause, onResume, onPressSeek, onMoveSeek, onReleaseSeek, } = props;
|
159
132
|
let percentWidth = 0;
|
160
133
|
if (duration !== 0) {
|
161
|
-
percentWidth =
|
134
|
+
percentWidth = dp(200) * currentTime / duration;
|
162
135
|
}
|
163
|
-
return (<
|
136
|
+
return (<View style={styles.playBar}>
|
164
137
|
{paused &&
|
165
|
-
<
|
166
|
-
<
|
167
|
-
</
|
138
|
+
<TouchableOpacity style={styles.pauseResume} onPress={onResume}>
|
139
|
+
<FontAwesome name='play' size={dp(13)} color={'#fff'}/>
|
140
|
+
</TouchableOpacity>}
|
168
141
|
{!paused &&
|
169
|
-
<
|
170
|
-
<
|
171
|
-
</
|
172
|
-
<
|
173
|
-
<
|
174
|
-
<
|
175
|
-
{
|
176
|
-
<
|
142
|
+
<TouchableOpacity style={styles.pauseResume} onPress={onPause}>
|
143
|
+
<FontAwesome name='pause' size={dp(13)} color={'#fff'}/>
|
144
|
+
</TouchableOpacity>}
|
145
|
+
<View style={{ width: dp(5) }}/>
|
146
|
+
<Text style={styles.time}>{numberToTime(currentTime)}</Text>
|
147
|
+
<View style={{ width: dp(10) }}/>
|
148
|
+
{Platform.OS === 'ios' ? <View style={styles.progress}>
|
149
|
+
<View style={[styles.percent, { width: percentWidth }]}>
|
177
150
|
<SeekBottom onPressSeek={onPressSeek} onMoveSeek={onMoveSeek} onReleaseSeek={onReleaseSeek}/>
|
178
|
-
</
|
179
|
-
</
|
180
|
-
<
|
181
|
-
<
|
182
|
-
<
|
183
|
-
</
|
151
|
+
</View>
|
152
|
+
</View> :
|
153
|
+
<Slider style={{ width: dp(200), height: dp(30) }} disabled={duration === 0} value={currentTime} minimumValue={0} maximumValue={duration} minimumTrackTintColor="#fff" thumbTintColor="#fff" onSlidingStart={onPressSeek} onValueChange={onMoveSeek} onSlidingComplete={onReleaseSeek}/>}
|
154
|
+
<View style={{ width: dp(10) }}/>
|
155
|
+
<Text style={styles.time}>{numberToTime(duration)}</Text>
|
156
|
+
</View>);
|
184
157
|
});
|
185
|
-
const SeekBottom =
|
158
|
+
const SeekBottom = memo(props => {
|
186
159
|
const { onPressSeek, onMoveSeek, onReleaseSeek, } = props;
|
187
160
|
return (<>
|
188
|
-
<
|
189
|
-
</
|
190
|
-
<
|
161
|
+
<View style={styles.seekRange} onStartShouldSetResponder={() => true} onMoveShouldSetResponder={() => true} onResponderGrant={onPressSeek} onResponderMove={onMoveSeek} onResponderRelease={onReleaseSeek} onResponderTerminationRequest={() => false}>
|
162
|
+
</View>
|
163
|
+
<View style={styles.seek}/>
|
191
164
|
</>);
|
192
165
|
});
|
193
|
-
const styles =
|
166
|
+
const styles = StyleSheet.create({
|
194
167
|
video: {
|
195
168
|
flex: 1,
|
196
169
|
backgroundColor: '#000',
|
@@ -206,9 +179,9 @@ const styles = react_native_1.StyleSheet.create({
|
|
206
179
|
alignItems: 'center',
|
207
180
|
},
|
208
181
|
errorText: {
|
209
|
-
fontSize:
|
182
|
+
fontSize: dp(18),
|
210
183
|
color: '#fff',
|
211
|
-
lineHeight:
|
184
|
+
lineHeight: dp(40),
|
212
185
|
},
|
213
186
|
player: {
|
214
187
|
position: 'absolute',
|
@@ -218,71 +191,71 @@ const styles = react_native_1.StyleSheet.create({
|
|
218
191
|
right: 0,
|
219
192
|
},
|
220
193
|
cancel: {
|
221
|
-
height:
|
222
|
-
width:
|
223
|
-
borderRadius:
|
224
|
-
backgroundColor: '#
|
194
|
+
height: dp(40),
|
195
|
+
width: dp(40),
|
196
|
+
borderRadius: dp(5),
|
197
|
+
backgroundColor: '#999',
|
225
198
|
position: 'absolute',
|
226
|
-
top:
|
227
|
-
right:
|
199
|
+
top: dp(70),
|
200
|
+
right: dp(30),
|
228
201
|
justifyContent: 'center',
|
229
202
|
alignItems: 'center',
|
230
203
|
opacity: 0.7,
|
231
204
|
},
|
232
205
|
playBar: {
|
233
206
|
position: 'absolute',
|
234
|
-
bottom:
|
207
|
+
bottom: dp(80),
|
235
208
|
backgroundColor: 'rgba(51,51,51,0.7)',
|
236
209
|
flexDirection: 'row',
|
237
|
-
paddingVertical:
|
238
|
-
ios:
|
239
|
-
default:
|
210
|
+
paddingVertical: Platform.select({
|
211
|
+
ios: dp(10),
|
212
|
+
default: dp(5)
|
240
213
|
}),
|
241
|
-
paddingHorizontal:
|
242
|
-
borderRadius:
|
214
|
+
paddingHorizontal: dp(10),
|
215
|
+
borderRadius: dp(5),
|
243
216
|
justifyContent: 'center',
|
244
217
|
alignItems: 'center',
|
245
218
|
},
|
246
219
|
pauseResume: {
|
247
220
|
justifyContent: 'center',
|
248
221
|
alignItems: 'center',
|
249
|
-
width:
|
222
|
+
width: dp(20),
|
250
223
|
},
|
251
224
|
progress: {
|
252
225
|
flexDirection: 'row',
|
253
|
-
height:
|
254
|
-
width:
|
255
|
-
borderRadius:
|
226
|
+
height: dp(2),
|
227
|
+
width: dp(200),
|
228
|
+
borderRadius: dp(1),
|
256
229
|
backgroundColor: '#666',
|
257
230
|
},
|
258
231
|
percent: {
|
259
232
|
height: (2),
|
260
|
-
width:
|
233
|
+
width: dp(100),
|
261
234
|
backgroundColor: '#fff'
|
262
235
|
},
|
263
236
|
time: {
|
264
|
-
fontSize:
|
237
|
+
fontSize: dp(12),
|
265
238
|
color: '#fff'
|
266
239
|
},
|
267
240
|
seekRange: {
|
268
|
-
height:
|
269
|
-
width:
|
270
|
-
borderRadius:
|
241
|
+
height: dp(50),
|
242
|
+
width: dp(50),
|
243
|
+
borderRadius: dp(25),
|
271
244
|
position: 'absolute',
|
272
|
-
top:
|
273
|
-
right:
|
245
|
+
top: dp(-23),
|
246
|
+
right: dp(-25),
|
274
247
|
opacity: 0,
|
275
248
|
zIndex: 999,
|
276
249
|
},
|
277
250
|
seek: {
|
278
251
|
backgroundColor: '#fff',
|
279
|
-
height:
|
280
|
-
width:
|
281
|
-
borderRadius:
|
282
|
-
top:
|
283
|
-
right:
|
252
|
+
height: dp(12),
|
253
|
+
width: dp(12),
|
254
|
+
borderRadius: dp(6),
|
255
|
+
top: dp(-5),
|
256
|
+
right: dp(-6),
|
284
257
|
position: 'absolute',
|
285
258
|
zIndex: 1,
|
286
259
|
}
|
287
260
|
});
|
288
|
-
|
261
|
+
export default VideoPlayer;
|
@@ -1,23 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
exports.plain = exports.borderStyle = exports.shadowStyle = void 0;
|
4
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
5
|
-
exports.shadowStyle = {
|
1
|
+
import { dp } from '@smart-link/rn-ui';
|
2
|
+
export const shadowStyle = {
|
6
3
|
shadowColor: 'rgba(0, 0, 0, 0.08)',
|
7
4
|
shadowOffset: {
|
8
5
|
width: 0,
|
9
|
-
height:
|
6
|
+
height: dp(3),
|
10
7
|
},
|
11
|
-
shadowRadius:
|
8
|
+
shadowRadius: dp(3),
|
12
9
|
shadowOpacity: 1,
|
13
10
|
elevation: 1.5,
|
14
11
|
};
|
15
|
-
|
16
|
-
borderRadius:
|
12
|
+
export const borderStyle = {
|
13
|
+
borderRadius: dp(5),
|
17
14
|
};
|
18
|
-
|
15
|
+
export const plain = {
|
19
16
|
color: '#000',
|
20
|
-
fontSize:
|
21
|
-
paddingHorizontal:
|
22
|
-
paddingVertical:
|
17
|
+
fontSize: dp(14),
|
18
|
+
paddingHorizontal: dp(12),
|
19
|
+
paddingVertical: dp(10),
|
23
20
|
};
|
package/dist/default-assets.d.ts
CHANGED
package/dist/default-assets.js
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
exports.messageBackupImg = exports.receiptStatus = exports.defaultAvatars = void 0;
|
4
|
-
const im_base_1 = require("@smart-link/im-base");
|
5
|
-
exports.defaultAvatars = {
|
1
|
+
import { MessageStatus } from "@smart-link/im-base";
|
2
|
+
export const defaultAvatars = {
|
6
3
|
MAN: require('../assets/avatars-man.jpg'),
|
7
4
|
WOMAN: require('../assets/avatars-woman.jpg'),
|
8
5
|
EMPTY: require('../assets/avatars-empty.png'),
|
@@ -11,12 +8,13 @@ exports.defaultAvatars = {
|
|
11
8
|
GROUP_OWNER: require('../assets/group-owner.png'),
|
12
9
|
GROUP_MGR: require('../assets/group-mgr.png'),
|
13
10
|
};
|
14
|
-
|
15
|
-
[
|
16
|
-
[
|
17
|
-
[
|
11
|
+
export const receiptStatus = {
|
12
|
+
[MessageStatus.READ]: require('../assets/hook-blue-double.png'),
|
13
|
+
[MessageStatus.ARRIVED]: require('../assets/hook-black-double.png'),
|
14
|
+
[MessageStatus.EMITTED]: require('../assets/hook-black.png'),
|
18
15
|
};
|
19
|
-
|
16
|
+
export const messageBackupImg = {
|
20
17
|
cloud: require('../assets/cloud-backup.png'),
|
21
18
|
cloud_begin: require('../assets/cloud-backup-begin.png'),
|
22
19
|
};
|
20
|
+
export const noMessageImg = require('../assets/no_message.png');
|