ordering-ui-react-native 0.18.78 → 0.18.80
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/package.json +1 -1
- package/themes/business/src/components/Chat/index.tsx +7 -6
- package/themes/business/src/components/NewOrderNotification/index.tsx +11 -5
- package/themes/business/src/components/OrderDetails/Delivery.tsx +22 -1
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +2 -2
package/package.json
CHANGED
|
@@ -312,14 +312,15 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
312
312
|
quality: 1
|
|
313
313
|
},
|
|
314
314
|
(response: any) => {
|
|
315
|
-
|
|
315
|
+
const image = response.assets[0];
|
|
316
|
+
if (image.didCancel) {
|
|
316
317
|
console.log('User cancelled image picker');
|
|
317
|
-
} else if (
|
|
318
|
-
console.log('ImagePicker Error: ',
|
|
319
|
-
showToast(ToastType.Error,
|
|
318
|
+
} else if (image.errorMessage) {
|
|
319
|
+
console.log('ImagePicker Error: ', image.errorMessage);
|
|
320
|
+
showToast(ToastType.Error, image.errorMessage);
|
|
320
321
|
} else {
|
|
321
|
-
if (
|
|
322
|
-
const url = `data:${
|
|
322
|
+
if (image.uri) {
|
|
323
|
+
const url = `data:${image.type};base64,${image.base64}`;
|
|
323
324
|
setImage && setImage(url);
|
|
324
325
|
} else {
|
|
325
326
|
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
@@ -48,6 +48,7 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
48
48
|
const notificationSound = new Sound(theme.sounds.notification, '', () => { });
|
|
49
49
|
|
|
50
50
|
let _timeout: any = null
|
|
51
|
+
let times = 0
|
|
51
52
|
|
|
52
53
|
const handleCloseEvents = () => {
|
|
53
54
|
notificationSound.stop()
|
|
@@ -57,14 +58,19 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
57
58
|
|
|
58
59
|
const handlePlayNotificationSound = (eventObj: any = null) => {
|
|
59
60
|
setCurrentEvent(eventObj)
|
|
60
|
-
|
|
61
|
+
if (times > 0) {
|
|
62
|
+
if (times === 3) {
|
|
63
|
+
times = 0
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
return
|
|
67
|
+
}
|
|
61
68
|
_timeout = setInterval(() => {
|
|
62
|
-
if (times
|
|
69
|
+
if (times < SOUND_LOOP) {
|
|
63
70
|
notificationSound.play()
|
|
64
71
|
times++
|
|
65
72
|
} else {
|
|
66
73
|
clearInterval(_timeout)
|
|
67
|
-
times = 1
|
|
68
74
|
return
|
|
69
75
|
}
|
|
70
76
|
}, 2500)
|
|
@@ -89,10 +95,10 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
97
|
if (evtType === 3 || value.author_id === user.id) return
|
|
92
|
-
handlePlayNotificationSound({
|
|
98
|
+
setTimeout(() => handlePlayNotificationSound({
|
|
93
99
|
evt: evtType,
|
|
94
100
|
orderId: value?.driver ? value?.order_id : evtList[evtType].event === 'messages' ? value?.order?.id : value?.id
|
|
95
|
-
})
|
|
101
|
+
}), 1000)
|
|
96
102
|
}
|
|
97
103
|
|
|
98
104
|
useEffect(() => {
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
useToast,
|
|
14
14
|
useSession,
|
|
15
15
|
ToastType,
|
|
16
|
-
useUtils
|
|
16
|
+
useUtils,
|
|
17
|
+
useConfig
|
|
17
18
|
} from 'ordering-components/native';
|
|
18
19
|
|
|
19
20
|
//Components
|
|
@@ -59,7 +60,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
59
60
|
} = props;
|
|
60
61
|
const [, { showToast }] = useToast();
|
|
61
62
|
const [{ parsePrice, parseNumber }] = useUtils();
|
|
63
|
+
const [{ configs }] = useConfig();
|
|
62
64
|
const { order } = props.order
|
|
65
|
+
|
|
66
|
+
const isAllowedDriverRejectOrder = configs?.allow_driver_reject_order?.value === '1'
|
|
63
67
|
const theme = useTheme();
|
|
64
68
|
const [, t] = useLanguage();
|
|
65
69
|
const [session] = useSession();
|
|
@@ -295,6 +299,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
295
299
|
};
|
|
296
300
|
|
|
297
301
|
const handleViewActionOrder = (action: string) => {
|
|
302
|
+
if (action === 'reject' && !isAllowedDriverRejectOrder) {
|
|
303
|
+
setAlertState({
|
|
304
|
+
open: true,
|
|
305
|
+
content: [
|
|
306
|
+
t('DRIVER_NOT_ALLOWED_TO_REJECT_ORDER', 'The driver is not allowed to reject an order.'),
|
|
307
|
+
],
|
|
308
|
+
key: null,
|
|
309
|
+
})
|
|
310
|
+
return
|
|
311
|
+
}
|
|
298
312
|
if (!isGrantedPermissions) {
|
|
299
313
|
navigation.navigate('RequestPermissions')
|
|
300
314
|
return
|
|
@@ -311,6 +325,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
311
325
|
};
|
|
312
326
|
|
|
313
327
|
const handleArrowBack: any = () => {
|
|
328
|
+
if (alertState?.open && !isAllowedDriverRejectOrder) {
|
|
329
|
+
setAlertState({
|
|
330
|
+
...alertState,
|
|
331
|
+
open: false
|
|
332
|
+
})
|
|
333
|
+
return
|
|
334
|
+
}
|
|
314
335
|
navigation?.canGoBack() && navigation.goBack();
|
|
315
336
|
};
|
|
316
337
|
|
|
@@ -611,11 +611,11 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
611
611
|
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
612
612
|
: t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
|
|
613
613
|
</OText>
|
|
614
|
-
{event?.data?.charge_id && (
|
|
614
|
+
{/* {event?.data?.charge_id && (
|
|
615
615
|
<OText>
|
|
616
616
|
{`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
|
|
617
617
|
</OText>
|
|
618
|
-
)}
|
|
618
|
+
)} */}
|
|
619
619
|
</View>
|
|
620
620
|
<OText>
|
|
621
621
|
{(event?.paymethod?.gateway === 'cash' && order?.cash)
|