react-native-timacare 0.0.23 → 0.0.25
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/index.js +1 -1
- package/lib/commonjs/index.js.flow +2 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/screens/home/index.js +1 -1
- package/lib/commonjs/screens/home/index.js.flow +747 -774
- 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 +40 -197
- package/lib/commonjs/screens/uploadVideo/index.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.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/typescript/screens/home/index.d.ts.map +1 -1
- package/lib/typescript/screens/uploadVideo/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +2 -2
- package/src/screens/home/index.tsx +747 -774
- package/src/screens/uploadVideo/index.tsx +40 -197
|
@@ -17,6 +17,8 @@ import { MText } from '../../components/MText';
|
|
|
17
17
|
import { useNavigation } from '@react-navigation/native';
|
|
18
18
|
import videoStore from './videoStore';
|
|
19
19
|
import {
|
|
20
|
+
checkMultiple,
|
|
21
|
+
requestMultiple,
|
|
20
22
|
openSettings,
|
|
21
23
|
PERMISSIONS,
|
|
22
24
|
request,
|
|
@@ -40,210 +42,39 @@ export const Video = observer(function Video(props: any) {
|
|
|
40
42
|
let second = 3;
|
|
41
43
|
|
|
42
44
|
const requestPermissions = () => {
|
|
43
|
-
|
|
45
|
+
checkMultiple(
|
|
44
46
|
Platform.OS === 'ios'
|
|
45
|
-
? PERMISSIONS.IOS.CAMERA
|
|
46
|
-
: PERMISSIONS.ANDROID.CAMERA
|
|
47
|
-
).then((
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
navigation.goBack();
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
text: 'Đồng ý',
|
|
75
|
-
onPress: () => {
|
|
76
|
-
if (Platform.OS === 'ios') {
|
|
77
|
-
openSettings();
|
|
78
|
-
} else {
|
|
79
|
-
openSettings();
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
]
|
|
84
|
-
);
|
|
85
|
-
break;
|
|
86
|
-
case RESULTS.LIMITED:
|
|
87
|
-
console.log('The permission is limited: some actions are possible');
|
|
88
|
-
Alert.alert(
|
|
89
|
-
`Tima Care cần quyền truy cập camera của bạn`,
|
|
90
|
-
'Chúng tôi cần quyền camera của bạn để bổ chứng từ phản hồi về chính sách liên kết với chúng tôi',
|
|
91
|
-
[
|
|
92
|
-
{
|
|
93
|
-
text: 'Từ chối',
|
|
94
|
-
onPress: () => {
|
|
95
|
-
navigation.goBack();
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
text: 'Đồng ý',
|
|
100
|
-
onPress: () => {
|
|
101
|
-
if (Platform.OS === 'ios') {
|
|
102
|
-
openSettings();
|
|
103
|
-
} else {
|
|
104
|
-
openSettings();
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
]
|
|
109
|
-
);
|
|
110
|
-
break;
|
|
111
|
-
case RESULTS.GRANTED:
|
|
112
|
-
console.log('The permission is granted');
|
|
113
|
-
break;
|
|
114
|
-
case RESULTS.BLOCKED:
|
|
115
|
-
console.log('The permission is denied and not requestable anymore');
|
|
116
|
-
Alert.alert(
|
|
117
|
-
`Tima Care cần quyền truy cập camera của bạn`,
|
|
118
|
-
'Chúng tôi cần quyền camera của bạn để bổ chứng từ phản hồi về chính sách liên kết với chúng tôi',
|
|
119
|
-
[
|
|
120
|
-
{
|
|
121
|
-
text: 'Từ chối',
|
|
122
|
-
onPress: () => {
|
|
123
|
-
navigation.goBack();
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
text: 'Đồng ý',
|
|
128
|
-
onPress: () => {
|
|
129
|
-
if (Platform.OS === 'ios') {
|
|
130
|
-
openSettings();
|
|
131
|
-
} else {
|
|
132
|
-
openSettings();
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
]
|
|
137
|
-
);
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
const requestPermissionsMic = () => {
|
|
144
|
-
request(
|
|
145
|
-
Platform.OS === 'ios'
|
|
146
|
-
? PERMISSIONS.IOS.MICROPHONE
|
|
147
|
-
: PERMISSIONS.ANDROID.RECORD_AUDIO
|
|
148
|
-
).then((result) => {
|
|
149
|
-
switch (result) {
|
|
150
|
-
case RESULTS.UNAVAILABLE:
|
|
151
|
-
console.log(
|
|
152
|
-
'This feature is not available (on this device / in this context)'
|
|
153
|
-
);
|
|
154
|
-
Alert.alert(
|
|
155
|
-
'Thông báo',
|
|
156
|
-
'Mic trên thiết bị không tương thích.\nVui lòng kiểm tra lại thiết bị!',
|
|
157
|
-
[{ text: 'Đồng ý' }]
|
|
158
|
-
);
|
|
159
|
-
break;
|
|
160
|
-
case RESULTS.DENIED:
|
|
161
|
-
console.log(
|
|
162
|
-
'The permission has not been requested / is denied but requestable'
|
|
163
|
-
);
|
|
164
|
-
Alert.alert(
|
|
165
|
-
`Tima Care cần quyền truy cập camera của bạn`,
|
|
166
|
-
'Chúng tôi cần quyền camera của bạn để bổ chứng từ phản hồi về chính sách liên kết với chúng tôi',
|
|
167
|
-
[
|
|
168
|
-
{
|
|
169
|
-
text: 'Từ chối',
|
|
170
|
-
onPress: () => {
|
|
171
|
-
navigation.goBack();
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
text: 'Đồng ý',
|
|
176
|
-
onPress: () => {
|
|
177
|
-
if (Platform.OS === 'ios') {
|
|
178
|
-
openSettings();
|
|
179
|
-
} else {
|
|
180
|
-
openSettings();
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
]
|
|
185
|
-
);
|
|
186
|
-
break;
|
|
187
|
-
case RESULTS.LIMITED:
|
|
188
|
-
console.log('The permission is limited: some actions are possible');
|
|
189
|
-
Alert.alert(
|
|
190
|
-
`Tima Care cần quyền truy cập camera của bạn`,
|
|
191
|
-
'Chúng tôi cần quyền camera của bạn để bổ chứng từ phản hồi về chính sách liên kết với chúng tôi',
|
|
192
|
-
[
|
|
193
|
-
{
|
|
194
|
-
text: 'Từ chối',
|
|
195
|
-
onPress: () => {
|
|
196
|
-
navigation.goBack();
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
text: 'Đồng ý',
|
|
201
|
-
onPress: () => {
|
|
202
|
-
if (Platform.OS === 'ios') {
|
|
203
|
-
openSettings();
|
|
204
|
-
} else {
|
|
205
|
-
openSettings();
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
]
|
|
210
|
-
);
|
|
211
|
-
break;
|
|
212
|
-
case RESULTS.GRANTED:
|
|
213
|
-
console.log('The permission is granted');
|
|
214
|
-
break;
|
|
215
|
-
case RESULTS.BLOCKED:
|
|
216
|
-
console.log('The permission is denied and not requestable anymore');
|
|
217
|
-
Alert.alert(
|
|
218
|
-
`Tima Care cần quyền truy cập camera của bạn`,
|
|
219
|
-
'Chúng tôi cần quyền camera của bạn để bổ chứng từ phản hồi về chính sách liên kết với chúng tôi',
|
|
220
|
-
[
|
|
221
|
-
{
|
|
222
|
-
text: 'Từ chối',
|
|
223
|
-
onPress: () => {
|
|
224
|
-
navigation.goBack();
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
text: 'Đồng ý',
|
|
229
|
-
onPress: () => {
|
|
230
|
-
if (Platform.OS === 'ios') {
|
|
231
|
-
openSettings();
|
|
232
|
-
} else {
|
|
233
|
-
openSettings();
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
]
|
|
238
|
-
);
|
|
239
|
-
break;
|
|
47
|
+
? [PERMISSIONS.IOS.CAMERA, PERMISSIONS.IOS.MICROPHONE]
|
|
48
|
+
: [PERMISSIONS.ANDROID.CAMERA, PERMISSIONS.ANDROID.RECORD_AUDIO]
|
|
49
|
+
).then((statuses) => {
|
|
50
|
+
console.log('Camera', statuses);
|
|
51
|
+
console.log('FaceID', statuses);
|
|
52
|
+
if (Platform.OS === 'android') {
|
|
53
|
+
if (
|
|
54
|
+
statuses[PERMISSIONS.ANDROID.CAMERA] !== 'granted' ||
|
|
55
|
+
statuses[PERMISSIONS.ANDROID.RECORD_AUDIO] !== 'granted'
|
|
56
|
+
) {
|
|
57
|
+
requestMultiple([
|
|
58
|
+
PERMISSIONS.ANDROID.CAMERA,
|
|
59
|
+
PERMISSIONS.ANDROID.RECORD_AUDIO,
|
|
60
|
+
]).then((statuses) => {});
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
if (
|
|
64
|
+
statuses[PERMISSIONS.IOS.CAMERA] !== 'granted' ||
|
|
65
|
+
statuses[PERMISSIONS.IOS.MICROPHONE] !== 'granted'
|
|
66
|
+
) {
|
|
67
|
+
requestMultiple([
|
|
68
|
+
PERMISSIONS.IOS.CAMERA,
|
|
69
|
+
PERMISSIONS.IOS.MICROPHONE,
|
|
70
|
+
]).then((statuses) => {});
|
|
71
|
+
}
|
|
240
72
|
}
|
|
241
73
|
});
|
|
242
74
|
};
|
|
243
75
|
|
|
244
76
|
useEffect(() => {
|
|
245
77
|
requestPermissions();
|
|
246
|
-
requestPermissionsMic();
|
|
247
78
|
interval.current = setInterval(() => {
|
|
248
79
|
second--;
|
|
249
80
|
setCount(second);
|
|
@@ -332,6 +163,18 @@ export const Video = observer(function Video(props: any) {
|
|
|
332
163
|
permissionDialogMessage={
|
|
333
164
|
'We need your permission to use your camera phone'
|
|
334
165
|
}
|
|
166
|
+
androidCameraPermissionOptions={{
|
|
167
|
+
title: 'Permission to use camera',
|
|
168
|
+
message: 'We need your permission to use your camera',
|
|
169
|
+
buttonPositive: 'Ok',
|
|
170
|
+
buttonNegative: 'Cancel',
|
|
171
|
+
}}
|
|
172
|
+
androidRecordAudioPermissionOptions={{
|
|
173
|
+
title: 'Permission to use audio recording',
|
|
174
|
+
message: 'We need your permission to use your audio',
|
|
175
|
+
buttonPositive: 'Ok',
|
|
176
|
+
buttonNegative: 'Cancel',
|
|
177
|
+
}}
|
|
335
178
|
/>
|
|
336
179
|
<View
|
|
337
180
|
style={{
|