react-native-timacare 0.0.25 → 0.0.27
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/lib/commonjs/screens/home/Store.js +1 -1
- package/lib/commonjs/screens/home/Store.js.flow +2 -2
- package/lib/commonjs/screens/home/Store.js.map +1 -1
- package/lib/commonjs/screens/home/index.js +1 -1
- package/lib/commonjs/screens/home/index.js.flow +7 -3
- package/lib/commonjs/screens/home/index.js.map +1 -1
- package/lib/commonjs/screens/uploadVideo/index.js +1 -1
- package/lib/commonjs/screens/uploadVideo/index.js.flow +42 -32
- package/lib/commonjs/screens/uploadVideo/index.js.map +1 -1
- package/lib/commonjs/screens/uploadVideo/videoStore.js +1 -1
- package/lib/commonjs/screens/uploadVideo/videoStore.js.flow +4 -1
- package/lib/commonjs/screens/uploadVideo/videoStore.js.map +1 -1
- package/lib/module/screens/home/Store.js +1 -1
- package/lib/module/screens/home/Store.js.map +1 -1
- package/lib/module/screens/home/index.js +1 -1
- package/lib/module/screens/home/index.js.map +1 -1
- package/lib/module/screens/uploadVideo/index.js +1 -1
- package/lib/module/screens/uploadVideo/index.js.map +1 -1
- package/lib/module/screens/uploadVideo/videoStore.js +1 -1
- package/lib/module/screens/uploadVideo/videoStore.js.map +1 -1
- package/lib/typescript/screens/home/index.d.ts.map +1 -1
- package/lib/typescript/screens/uploadVideo/index.d.ts.map +1 -1
- package/lib/typescript/screens/uploadVideo/videoStore.d.ts +1 -1
- package/lib/typescript/screens/uploadVideo/videoStore.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/screens/home/Store.tsx +2 -2
- package/src/screens/home/index.tsx +7 -3
- package/src/screens/uploadVideo/index.tsx +42 -32
- package/src/screens/uploadVideo/videoStore.tsx +4 -1
|
@@ -32,6 +32,7 @@ export const Video = observer(function Video(props: any) {
|
|
|
32
32
|
const [count, setCount] = useState(3);
|
|
33
33
|
const interval = React.useRef(null);
|
|
34
34
|
const [isRecording, setIsRecording] = React.useState(false);
|
|
35
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
35
36
|
|
|
36
37
|
const content = `Hôm nay ngày ${formatDDMMYYY(new Date())} tôi tên là ${
|
|
37
38
|
props.route.params.loan.fullname
|
|
@@ -47,29 +48,29 @@ export const Video = observer(function Video(props: any) {
|
|
|
47
48
|
? [PERMISSIONS.IOS.CAMERA, PERMISSIONS.IOS.MICROPHONE]
|
|
48
49
|
: [PERMISSIONS.ANDROID.CAMERA, PERMISSIONS.ANDROID.RECORD_AUDIO]
|
|
49
50
|
).then((statuses) => {
|
|
50
|
-
console.log(
|
|
51
|
-
|
|
52
|
-
if (Platform.OS === 'android') {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
} else {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
51
|
+
console.log(statuses);
|
|
52
|
+
|
|
53
|
+
// if (Platform.OS === 'android') {
|
|
54
|
+
// if (
|
|
55
|
+
// statuses[PERMISSIONS.ANDROID.CAMERA] !== 'granted' ||
|
|
56
|
+
// statuses[PERMISSIONS.ANDROID.RECORD_AUDIO] !== 'granted'
|
|
57
|
+
// ) {
|
|
58
|
+
// requestMultiple([
|
|
59
|
+
// PERMISSIONS.ANDROID.CAMERA,
|
|
60
|
+
// PERMISSIONS.ANDROID.RECORD_AUDIO,
|
|
61
|
+
// ]).then((statuses) => {});
|
|
62
|
+
// }
|
|
63
|
+
// } else {
|
|
64
|
+
// if (
|
|
65
|
+
// statuses[PERMISSIONS.IOS.CAMERA] !== 'granted' ||
|
|
66
|
+
// statuses[PERMISSIONS.IOS.MICROPHONE] !== 'granted'
|
|
67
|
+
// ) {
|
|
68
|
+
// requestMultiple([
|
|
69
|
+
// PERMISSIONS.IOS.CAMERA,
|
|
70
|
+
// PERMISSIONS.IOS.MICROPHONE,
|
|
71
|
+
// ]).then((statuses) => {});
|
|
72
|
+
// }
|
|
73
|
+
// }
|
|
73
74
|
});
|
|
74
75
|
};
|
|
75
76
|
|
|
@@ -87,6 +88,7 @@ export const Video = observer(function Video(props: any) {
|
|
|
87
88
|
const stopRecording = () => {
|
|
88
89
|
camera.current.stopRecording();
|
|
89
90
|
setIsRecording(false);
|
|
91
|
+
setIsLoading(true);
|
|
90
92
|
};
|
|
91
93
|
|
|
92
94
|
const startVideo = async () => {
|
|
@@ -109,14 +111,22 @@ export const Video = observer(function Video(props: any) {
|
|
|
109
111
|
uri: data.uri,
|
|
110
112
|
type: 'video/*',
|
|
111
113
|
});
|
|
112
|
-
videoStore.uploadVideo(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
videoStore.uploadVideo(
|
|
115
|
+
props.route.params.loan.id,
|
|
116
|
+
formData,
|
|
117
|
+
() => {
|
|
118
|
+
setIsLoading(false);
|
|
119
|
+
Alert.alert('Thông báo', 'Tải video lên thành công', [
|
|
120
|
+
{
|
|
121
|
+
text: 'Ok',
|
|
122
|
+
onPress: () => navigation.goBack(),
|
|
123
|
+
},
|
|
124
|
+
]);
|
|
125
|
+
},
|
|
126
|
+
() => {
|
|
127
|
+
setIsLoading(false);
|
|
128
|
+
}
|
|
129
|
+
);
|
|
120
130
|
};
|
|
121
131
|
|
|
122
132
|
return (
|
|
@@ -216,7 +226,7 @@ export const Video = observer(function Video(props: any) {
|
|
|
216
226
|
)}
|
|
217
227
|
</View>
|
|
218
228
|
</View>
|
|
219
|
-
<
|
|
229
|
+
<Loading isLoading={isLoading} />
|
|
220
230
|
</SafeAreaView>
|
|
221
231
|
);
|
|
222
232
|
});
|
|
@@ -7,7 +7,7 @@ class Store {
|
|
|
7
7
|
@observable isLoading = false;
|
|
8
8
|
|
|
9
9
|
@action
|
|
10
|
-
async uploadVideo(loanID, body, onSuccess
|
|
10
|
+
async uploadVideo(loanID, body, onSuccess?, onError) {
|
|
11
11
|
try {
|
|
12
12
|
this.isLoading = true;
|
|
13
13
|
const response = await Api.getInstance().uploadVideo(loanID, body);
|
|
@@ -18,13 +18,16 @@ class Store {
|
|
|
18
18
|
if (onSuccess) onSuccess();
|
|
19
19
|
} else {
|
|
20
20
|
Alert.alert('Thông báo', response.data.meta.errorMessage);
|
|
21
|
+
if (onError) onError();
|
|
21
22
|
}
|
|
22
23
|
} else {
|
|
23
24
|
this.isLoading = false;
|
|
24
25
|
Alert.alert('Thông báo', 'Lỗi đã xảy ra. Vui lòng thực hiện lại');
|
|
26
|
+
if (onError) onError();
|
|
25
27
|
}
|
|
26
28
|
} catch (error) {
|
|
27
29
|
console.log(error);
|
|
30
|
+
if (onError) onError();
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
}
|