@smart-link/rn-im 1.0.22 → 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 +52 -81
- 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 -134
- 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 +7 -11
- 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,27 +1,3 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
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
1
|
var __rest = (this && this.__rest) || function (s, e) {
|
26
2
|
var t = {};
|
27
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
@@ -33,24 +9,23 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
33
9
|
}
|
34
10
|
return t;
|
35
11
|
};
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
const
|
40
|
-
const { width } = react_native_1.Dimensions.get('window');
|
12
|
+
import { dp, useTheme } from '@smart-link/rn-ui';
|
13
|
+
import React, { useRef } from 'react';
|
14
|
+
import { View, Animated, Dimensions, StyleSheet } from 'react-native';
|
15
|
+
const { width } = Dimensions.get('window');
|
41
16
|
/* 进度条组件 */
|
42
|
-
const Bar =
|
17
|
+
const Bar = React.memo((_a) => {
|
43
18
|
var { width: widthProp, progress } = _a, props = __rest(_a, ["width", "progress"]);
|
44
|
-
const theme =
|
45
|
-
const _progress =
|
46
|
-
|
47
|
-
|
19
|
+
const theme = useTheme();
|
20
|
+
const _progress = useRef(new Animated.Value(0));
|
21
|
+
React.useEffect(() => {
|
22
|
+
Animated.spring(_progress.current, {
|
48
23
|
toValue: progress,
|
49
24
|
useNativeDriver: false,
|
50
25
|
}).start();
|
51
26
|
}, [progress]);
|
52
|
-
return (<
|
53
|
-
<
|
27
|
+
return (<View style={[styles.background, { width: widthProp }, props.barStyle]}>
|
28
|
+
<Animated.View style={[
|
54
29
|
styles.fillStyle,
|
55
30
|
{
|
56
31
|
backgroundColor: theme.primaryColor,
|
@@ -60,18 +35,18 @@ const Bar = react_1.default.memo((_a) => {
|
|
60
35
|
}),
|
61
36
|
},
|
62
37
|
]}/>
|
63
|
-
</
|
38
|
+
</View>);
|
64
39
|
});
|
65
|
-
const styles =
|
40
|
+
const styles = StyleSheet.create({
|
66
41
|
background: {
|
67
|
-
height:
|
42
|
+
height: dp(10),
|
68
43
|
backgroundColor: '#ccc',
|
69
44
|
flexDirection: 'row',
|
70
|
-
borderRadius:
|
45
|
+
borderRadius: dp(30),
|
71
46
|
},
|
72
47
|
fillStyle: {
|
73
|
-
height:
|
74
|
-
borderRadius:
|
48
|
+
height: dp(10),
|
49
|
+
borderRadius: dp(30),
|
75
50
|
},
|
76
51
|
});
|
77
|
-
|
52
|
+
export default Bar;
|
@@ -1,64 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
exports.getImageStyle = void 0;
|
30
|
-
const react_1 = __importStar(require("react"));
|
31
|
-
const react_native_1 = require("react-native");
|
32
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
33
|
-
const useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
|
34
|
-
const default_assets_1 = require("../../../default-assets");
|
35
|
-
const useFormatMsgTime_1 = __importDefault(require("../../../hooks/useFormatMsgTime"));
|
36
|
-
const backup_1 = require("../../../api/backup");
|
37
|
-
const { width } = react_native_1.Dimensions.get('window');
|
38
|
-
const getImageStyle = (img, scale) => {
|
39
|
-
const imgInfo = react_native_1.Image.resolveAssetSource(img);
|
1
|
+
import React, { useEffect, useState } from 'react';
|
2
|
+
import { View, Text, StyleSheet, Dimensions, Image } from 'react-native';
|
3
|
+
import { Button, dp, Line, Modal, NavigationPage, Space, Toast } from '@smart-link/rn-ui';
|
4
|
+
import useTranslation from '../../../hooks/useTranslation';
|
5
|
+
import { messageBackupImg } from '../../../default-assets';
|
6
|
+
import useFormatMsgTime from '../../../hooks/useFormatMsgTime';
|
7
|
+
import { deleteMyBackupMessage, getMyLastBackupTime } from '../../../api/backup';
|
8
|
+
const { width } = Dimensions.get('window');
|
9
|
+
export const getImageStyle = (img, scale) => {
|
10
|
+
const imgInfo = Image.resolveAssetSource(img);
|
40
11
|
return {
|
41
12
|
width: width * scale,
|
42
13
|
height: ((width * imgInfo.height) / imgInfo.width) * scale,
|
43
14
|
};
|
44
15
|
};
|
45
|
-
exports.getImageStyle = getImageStyle;
|
46
16
|
const MessageBackup = ({ navigation, route }) => {
|
47
|
-
const { t } = (
|
48
|
-
const [noRecord, setNoRecord] =
|
49
|
-
const [lastBackupTime, setLastBackupTime] =
|
50
|
-
const time = (
|
51
|
-
|
17
|
+
const { t } = useTranslation();
|
18
|
+
const [noRecord, setNoRecord] = useState(true);
|
19
|
+
const [lastBackupTime, setLastBackupTime] = useState(Date.now());
|
20
|
+
const time = useFormatMsgTime(lastBackupTime);
|
21
|
+
useEffect(() => {
|
52
22
|
navigation.setOptions({
|
53
23
|
title: t('cloudBackup_title'),
|
54
24
|
});
|
55
25
|
navigation.addListener('focus', () => {
|
56
26
|
// 获取上次备份时间
|
57
27
|
console.log('focus');
|
58
|
-
|
28
|
+
getMyLastBackupTime()
|
59
29
|
.then(res => {
|
60
30
|
if (res.data) {
|
61
|
-
|
31
|
+
Toast.loading;
|
62
32
|
setLastBackupTime(new Date(res.data).getTime());
|
63
33
|
setNoRecord(false);
|
64
34
|
}
|
@@ -68,29 +38,29 @@ const MessageBackup = ({ navigation, route }) => {
|
|
68
38
|
});
|
69
39
|
});
|
70
40
|
}, [t, navigation, route]);
|
71
|
-
return (<
|
72
|
-
<
|
73
|
-
<
|
74
|
-
{noRecord ? (<
|
75
|
-
<
|
76
|
-
<
|
77
|
-
<
|
41
|
+
return (<NavigationPage noPadding>
|
42
|
+
<View style={styles.container}>
|
43
|
+
<Image style={styles.img} source={messageBackupImg.cloud}/>
|
44
|
+
{noRecord ? (<Text style={styles.title}>{t('cloudBackup_noRecord')}</Text>) : (<Text style={styles.title}>{t('cloudBackup_record', { time: time })}</Text>)}
|
45
|
+
<Space size="m"/>
|
46
|
+
<Line style={{ marginVertical: dp(10) }}/>
|
47
|
+
<Button style={styles.button} type={'primary'} onPress={() => {
|
78
48
|
navigation.navigate('StartBackupPage');
|
79
49
|
}}>
|
80
50
|
{t('cloudBackup_startText')}
|
81
|
-
</
|
51
|
+
</Button>
|
82
52
|
{!noRecord && (<>
|
83
|
-
<
|
53
|
+
<Button style={styles.button} type={'primary'} onPress={() => {
|
84
54
|
navigation.navigate('RestoreBackupPage');
|
85
55
|
}}>
|
86
56
|
{t('cloudBackup_restoreText')}
|
87
|
-
</
|
88
|
-
<
|
89
|
-
const model =
|
57
|
+
</Button>
|
58
|
+
<Button style={styles.button} onPress={() => {
|
59
|
+
const model = Modal.confirm({
|
90
60
|
title: t('cloudBackup_clearText'),
|
91
61
|
message: t('cloudBackup_clearTipsMessage'),
|
92
62
|
onOk: () => {
|
93
|
-
|
63
|
+
deleteMyBackupMessage().then(res => {
|
94
64
|
if (res.data) {
|
95
65
|
setNoRecord(true);
|
96
66
|
}
|
@@ -104,30 +74,30 @@ const MessageBackup = ({ navigation, route }) => {
|
|
104
74
|
});
|
105
75
|
}}>
|
106
76
|
{t('cloudBackup_clearText')}
|
107
|
-
</
|
77
|
+
</Button>
|
108
78
|
</>)}
|
109
|
-
</
|
110
|
-
</
|
79
|
+
</View>
|
80
|
+
</NavigationPage>);
|
111
81
|
};
|
112
|
-
const styles =
|
82
|
+
const styles = StyleSheet.create({
|
113
83
|
container: {
|
114
84
|
flex: 1,
|
115
85
|
alignItems: 'center',
|
116
|
-
paddingTop:
|
86
|
+
paddingTop: dp(40),
|
117
87
|
width,
|
118
88
|
},
|
119
|
-
img:
|
89
|
+
img: getImageStyle(messageBackupImg.cloud, 0.8),
|
120
90
|
title: {
|
121
|
-
fontSize:
|
91
|
+
fontSize: dp(16),
|
122
92
|
textAlign: 'center',
|
123
93
|
},
|
124
94
|
button: {
|
125
|
-
marginVertical:
|
126
|
-
width:
|
95
|
+
marginVertical: dp(8),
|
96
|
+
width: dp(width - 40),
|
127
97
|
},
|
128
98
|
tips: {
|
129
|
-
fontSize:
|
130
|
-
paddingVertical:
|
99
|
+
fontSize: dp(16),
|
100
|
+
paddingVertical: dp(20),
|
131
101
|
},
|
132
102
|
});
|
133
|
-
|
103
|
+
export default MessageBackup;
|
@@ -1,52 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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 utils_1 = require("./utils");
|
33
|
-
const MessageBackup_1 = require("./MessageBackup");
|
34
|
-
const default_assets_1 = require("../../../default-assets");
|
35
|
-
const useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
|
36
|
-
const Bar_1 = __importDefault(require("./Bar"));
|
37
|
-
const { width } = react_native_1.Dimensions.get('window');
|
1
|
+
import { Button, dp, NavigationPage } from '@smart-link/rn-ui';
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
3
|
+
import { View, StyleSheet, Dimensions, Image, Text } from 'react-native';
|
4
|
+
import { MessageRestoreUtils } from './utils';
|
5
|
+
import { getImageStyle } from './MessageBackup';
|
6
|
+
import { messageBackupImg } from '../../../default-assets';
|
7
|
+
import useTranslation from '../../../hooks/useTranslation';
|
8
|
+
import Bar from './Bar';
|
9
|
+
const { width } = Dimensions.get('window');
|
38
10
|
const RestoreBackupPage = ({ navigation }) => {
|
39
|
-
const { t, i18n } = (
|
40
|
-
const [progress, setProgress] =
|
41
|
-
const [paused, setPaused] =
|
42
|
-
const messageRestore =
|
43
|
-
|
11
|
+
const { t, i18n } = useTranslation();
|
12
|
+
const [progress, setProgress] = useState(0);
|
13
|
+
const [paused, setPaused] = useState(false);
|
14
|
+
const messageRestore = useRef();
|
15
|
+
useEffect(() => {
|
44
16
|
navigation.setOptions({
|
45
17
|
title: t('cloudBackup_restoreText'),
|
46
18
|
});
|
47
19
|
}, [t, navigation]);
|
48
|
-
|
49
|
-
messageRestore.current = new
|
20
|
+
useEffect(() => {
|
21
|
+
messageRestore.current = new MessageRestoreUtils(p => {
|
50
22
|
setProgress(p);
|
51
23
|
});
|
52
24
|
messageRestore.current.start();
|
@@ -71,65 +43,65 @@ const RestoreBackupPage = ({ navigation }) => {
|
|
71
43
|
setPaused(false);
|
72
44
|
};
|
73
45
|
const finished = progress >= 100;
|
74
|
-
return (<
|
75
|
-
<
|
76
|
-
<
|
77
|
-
<
|
78
|
-
{!finished ? (<
|
79
|
-
<
|
80
|
-
<
|
81
|
-
</
|
82
|
-
<
|
83
|
-
</
|
84
|
-
{!finished && !paused && (<
|
46
|
+
return (<NavigationPage noPadding>
|
47
|
+
<View style={styles.container}>
|
48
|
+
<Image style={styles.img} source={messageBackupImg.cloud_begin}/>
|
49
|
+
<View style={styles.progress}>
|
50
|
+
{!finished ? (<Text style={styles.text}>{t('cloudBackup_inRestore')}</Text>) : (<Text style={styles.text}>{t('cloudBackup_completed')}</Text>)}
|
51
|
+
<View style={styles.progressBar}>
|
52
|
+
<Bar width={dp(width - 80)} progress={progress}/>
|
53
|
+
</View>
|
54
|
+
<Text style={styles.progressText}>{progress}%</Text>
|
55
|
+
</View>
|
56
|
+
{!finished && !paused && (<Button style={styles.button} type={'primary'} onPress={pause}>
|
85
57
|
{t('cloudBackup_pause')}
|
86
|
-
</
|
87
|
-
{!finished && paused && (<
|
58
|
+
</Button>)}
|
59
|
+
{!finished && paused && (<Button style={styles.button} type={'primary'} onPress={resume}>
|
88
60
|
{t('cloudBackup_resume')}
|
89
|
-
</
|
90
|
-
{!finished && (<
|
61
|
+
</Button>)}
|
62
|
+
{!finished && (<Button style={styles.button} danger onPress={cancel}>
|
91
63
|
{t('cancel')}
|
92
|
-
</
|
64
|
+
</Button>)}
|
93
65
|
|
94
|
-
{finished && (<
|
66
|
+
{finished && (<Button style={styles.button} type="default" onPress={() => {
|
95
67
|
navigation.goBack();
|
96
68
|
}}>
|
97
69
|
{i18n.t('back')}
|
98
|
-
</
|
99
|
-
</
|
100
|
-
</
|
70
|
+
</Button>)}
|
71
|
+
</View>
|
72
|
+
</NavigationPage>);
|
101
73
|
};
|
102
|
-
const styles =
|
74
|
+
const styles = StyleSheet.create({
|
103
75
|
container: {
|
104
76
|
flex: 1,
|
105
77
|
alignItems: 'center',
|
106
|
-
paddingTop:
|
78
|
+
paddingTop: dp(20),
|
107
79
|
width,
|
108
80
|
},
|
109
|
-
img:
|
81
|
+
img: getImageStyle(messageBackupImg.cloud_begin, 0.8),
|
110
82
|
text: {
|
111
83
|
textAlign: 'center',
|
112
|
-
marginVertical:
|
84
|
+
marginVertical: dp(8),
|
113
85
|
},
|
114
86
|
button: {
|
115
|
-
marginVertical:
|
116
|
-
width:
|
87
|
+
marginVertical: dp(8),
|
88
|
+
width: dp(width - 40),
|
117
89
|
},
|
118
90
|
progress: {
|
119
|
-
paddingTop:
|
120
|
-
paddingBottom:
|
91
|
+
paddingTop: dp(30),
|
92
|
+
paddingBottom: dp(20),
|
121
93
|
},
|
122
94
|
progressBar: {
|
123
95
|
flexDirection: 'row',
|
124
96
|
alignItems: 'center',
|
125
97
|
},
|
126
98
|
percent: {
|
127
|
-
marginLeft:
|
128
|
-
fontSize:
|
99
|
+
marginLeft: dp(4),
|
100
|
+
fontSize: dp(14),
|
129
101
|
},
|
130
102
|
progressText: {
|
131
|
-
fontSize:
|
103
|
+
fontSize: dp(14),
|
132
104
|
textAlign: 'center',
|
133
105
|
},
|
134
106
|
});
|
135
|
-
|
107
|
+
export default RestoreBackupPage;
|
@@ -1,52 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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 utils_1 = require("./utils");
|
33
|
-
const MessageBackup_1 = require("./MessageBackup");
|
34
|
-
const default_assets_1 = require("../../../default-assets");
|
35
|
-
const useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
|
36
|
-
const Bar_1 = __importDefault(require("./Bar"));
|
37
|
-
const { width } = react_native_1.Dimensions.get('window');
|
1
|
+
import { Button, dp, NavigationPage } from '@smart-link/rn-ui';
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
3
|
+
import { View, StyleSheet, Dimensions, Image, Text } from 'react-native';
|
4
|
+
import { MessageBackupUtils } from './utils';
|
5
|
+
import { getImageStyle } from './MessageBackup';
|
6
|
+
import { messageBackupImg } from '../../../default-assets';
|
7
|
+
import useTranslation from '../../../hooks/useTranslation';
|
8
|
+
import Bar from './Bar';
|
9
|
+
const { width } = Dimensions.get('window');
|
38
10
|
const StartBackupPage = ({ navigation }) => {
|
39
|
-
const { t, i18n } = (
|
40
|
-
const [progress, setProgress] =
|
41
|
-
const [paused, setPaused] =
|
42
|
-
const messageBack =
|
43
|
-
|
11
|
+
const { t, i18n } = useTranslation();
|
12
|
+
const [progress, setProgress] = useState(0);
|
13
|
+
const [paused, setPaused] = useState(false);
|
14
|
+
const messageBack = useRef();
|
15
|
+
useEffect(() => {
|
44
16
|
navigation.setOptions({
|
45
17
|
title: t('cloudBackup_startText'),
|
46
18
|
});
|
47
19
|
}, [t, navigation]);
|
48
|
-
|
49
|
-
messageBack.current = new
|
20
|
+
useEffect(() => {
|
21
|
+
messageBack.current = new MessageBackupUtils(p => {
|
50
22
|
setProgress(p);
|
51
23
|
});
|
52
24
|
messageBack.current.start();
|
@@ -71,65 +43,65 @@ const StartBackupPage = ({ navigation }) => {
|
|
71
43
|
setPaused(false);
|
72
44
|
};
|
73
45
|
const finished = progress >= 100;
|
74
|
-
return (<
|
75
|
-
<
|
76
|
-
<
|
77
|
-
<
|
78
|
-
{!finished ? (<
|
79
|
-
<
|
80
|
-
<
|
81
|
-
</
|
82
|
-
<
|
83
|
-
</
|
84
|
-
{!finished && !paused && (<
|
46
|
+
return (<NavigationPage noPadding>
|
47
|
+
<View style={styles.container}>
|
48
|
+
<Image style={styles.img} source={messageBackupImg.cloud_begin}/>
|
49
|
+
<View style={styles.progress}>
|
50
|
+
{!finished ? (<Text style={styles.text}>{t('cloudBackup_inBackup')}</Text>) : (<Text style={styles.text}>{t('cloudBackup_completed')}</Text>)}
|
51
|
+
<View style={styles.progressBar}>
|
52
|
+
<Bar width={dp(width - 80)} progress={progress}/>
|
53
|
+
</View>
|
54
|
+
<Text style={styles.progressText}>{progress}%</Text>
|
55
|
+
</View>
|
56
|
+
{!finished && !paused && (<Button style={styles.button} type={'primary'} onPress={pause}>
|
85
57
|
{t('cloudBackup_pause')}
|
86
|
-
</
|
87
|
-
{!finished && paused && (<
|
58
|
+
</Button>)}
|
59
|
+
{!finished && paused && (<Button style={styles.button} type={'primary'} onPress={resume}>
|
88
60
|
{t('cloudBackup_resume')}
|
89
|
-
</
|
90
|
-
{!finished && (<
|
61
|
+
</Button>)}
|
62
|
+
{!finished && (<Button style={styles.button} danger onPress={cancel}>
|
91
63
|
{t('cancel')}
|
92
|
-
</
|
64
|
+
</Button>)}
|
93
65
|
|
94
|
-
{finished && (<
|
66
|
+
{finished && (<Button style={styles.button} type="default" onPress={() => {
|
95
67
|
navigation.goBack();
|
96
68
|
}}>
|
97
69
|
{i18n.t('back')}
|
98
|
-
</
|
99
|
-
</
|
100
|
-
</
|
70
|
+
</Button>)}
|
71
|
+
</View>
|
72
|
+
</NavigationPage>);
|
101
73
|
};
|
102
|
-
const styles =
|
74
|
+
const styles = StyleSheet.create({
|
103
75
|
container: {
|
104
76
|
flex: 1,
|
105
77
|
alignItems: 'center',
|
106
|
-
paddingTop:
|
78
|
+
paddingTop: dp(20),
|
107
79
|
width,
|
108
80
|
},
|
109
|
-
img:
|
81
|
+
img: getImageStyle(messageBackupImg.cloud_begin, 0.8),
|
110
82
|
text: {
|
111
83
|
textAlign: 'center',
|
112
|
-
marginVertical:
|
84
|
+
marginVertical: dp(8),
|
113
85
|
},
|
114
86
|
button: {
|
115
|
-
marginVertical:
|
116
|
-
width:
|
87
|
+
marginVertical: dp(8),
|
88
|
+
width: dp(width - 40),
|
117
89
|
},
|
118
90
|
progress: {
|
119
|
-
paddingTop:
|
120
|
-
paddingBottom:
|
91
|
+
paddingTop: dp(30),
|
92
|
+
paddingBottom: dp(20),
|
121
93
|
},
|
122
94
|
progressBar: {
|
123
95
|
flexDirection: 'row',
|
124
96
|
alignItems: 'center',
|
125
97
|
},
|
126
98
|
percent: {
|
127
|
-
marginLeft:
|
128
|
-
fontSize:
|
99
|
+
marginLeft: dp(4),
|
100
|
+
fontSize: dp(14),
|
129
101
|
},
|
130
102
|
progressText: {
|
131
|
-
fontSize:
|
103
|
+
fontSize: dp(14),
|
132
104
|
textAlign: 'center',
|
133
105
|
},
|
134
106
|
});
|
135
|
-
|
107
|
+
export default StartBackupPage;
|
@@ -1,12 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.RestoreBackupPage = exports.StartBackupPage = exports.default = void 0;
|
7
|
-
var MessageBackup_1 = require("./MessageBackup");
|
8
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(MessageBackup_1).default; } });
|
9
|
-
var StartBackupPage_1 = require("./StartBackupPage");
|
10
|
-
Object.defineProperty(exports, "StartBackupPage", { enumerable: true, get: function () { return __importDefault(StartBackupPage_1).default; } });
|
11
|
-
var RestoreBackupPage_1 = require("./RestoreBackupPage");
|
12
|
-
Object.defineProperty(exports, "RestoreBackupPage", { enumerable: true, get: function () { return __importDefault(RestoreBackupPage_1).default; } });
|
1
|
+
export { default } from './MessageBackup';
|
2
|
+
export { default as StartBackupPage } from './StartBackupPage';
|
3
|
+
export { default as RestoreBackupPage } from './RestoreBackupPage';
|