[FIX] hr_attendance: fix checkin/checkout on iOS

To reproduce
============
- With hr_attendance installed on ios application
- click on small button (green/red) to checkin/checkout
- nothing happens

Problem
=======
the method `signInOut` is failling because `navigator.geolocation` is
not defined on iOS

Solution
========
check if `navigator.geolocation` is defined before using it

opw-3649654

closes odoo/odoo#149518

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
This commit is contained in:
Abdelouahab (abla)
2024-01-19 15:21:49 +00:00
parent f232abd716
commit 1acd0b6c5d
@@ -52,19 +52,25 @@ export class ActivityMenu extends Component {
}
async signInOut() {
navigator.geolocation.getCurrentPosition(
async ({coords: {latitude, longitude}}) => {
await this.rpc("/hr_attendance/systray_check_in_out", {
latitude,
longitude
})
await this.searchReadEmployee()
},
async err => {
await this.rpc("/hr_attendance/systray_check_in_out")
await this.searchReadEmployee()
}
)
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(
async ({coords: {latitude, longitude}}) => {
await this.rpc("/hr_attendance/systray_check_in_out", {
latitude,
longitude
})
await this.searchReadEmployee()
},
async err => {
await this.rpc("/hr_attendance/systray_check_in_out")
await this.searchReadEmployee()
}
)
}
else{
await this.rpc("/hr_attendance/systray_check_in_out")
await this.searchReadEmployee()
}
}
}