fix haptics core api method

This commit is contained in:
SrGooglo 2023-06-14 01:23:16 +00:00
parent e3d86418a7
commit 97cbc87a81
3 changed files with 14 additions and 8 deletions

View File

@ -124,11 +124,11 @@ class ComtyApp extends React.Component {
autoHide: false,
})
window.app.splash = SplashScreen
window.app.version = config.package.version
window.localStorage.setItem("last_version", window.app.version)
window.app.message = antd.message
window.localStorage.setItem("last_version", window.app.version)
// check if electron library is available
if (typeof window.electron !== "undefined") {

View File

@ -236,7 +236,9 @@ export class BottomBar extends React.Component {
this._navTouchStart = setTimeout(() => {
this.setState({ quickNavVisible: true })
app.cores.haptics.vibrate(80)
if (app.cores.haptics?.vibrate) {
app.cores.haptics.vibrate(80)
}
// remove the timeout
this._navTouchStart = null
@ -283,7 +285,9 @@ export class BottomBar extends React.Component {
if (item.location) {
app.setLocation(item.location)
app.cores.haptics.vibrate([40, 80])
if (app.cores.haptics?.vibrate) {
app.cores.haptics.vibrate([40, 80])
}
}
}
@ -317,7 +321,9 @@ export class BottomBar extends React.Component {
closest.classList.add("hover")
app.cores.haptics.vibrate(40)
if (app.cores.haptics?.vibrate) {
app.cores.haptics.vibrate(40)
}
}
}

View File

@ -13,10 +13,10 @@ export default class HapticsCore extends Core {
public = {
isGlobalDisabled: HapticsCore.isGlobalDisabled,
vibration: this.vibration.bind(this),
vibrate: this.vibrate.bind(this),
}
vibration(...args) {
vibrate(...args) {
const disabled = this.isGlobalDisabled
if (disabled) {