From 97cbc87a812b389780d338b2a78e78aaa9c8e7f2 Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Wed, 14 Jun 2023 01:23:16 +0000 Subject: [PATCH] fix haptics core api method --- packages/app/src/App.jsx | 6 +++--- .../app/src/components/Layout/bottomBar/index.jsx | 12 +++++++++--- packages/app/src/cores/haptics/haptics.core.js | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/app/src/App.jsx b/packages/app/src/App.jsx index e2139358..a108ce14 100755 --- a/packages/app/src/App.jsx +++ b/packages/app/src/App.jsx @@ -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") { diff --git a/packages/app/src/components/Layout/bottomBar/index.jsx b/packages/app/src/components/Layout/bottomBar/index.jsx index 86c96c6a..514611ea 100755 --- a/packages/app/src/components/Layout/bottomBar/index.jsx +++ b/packages/app/src/components/Layout/bottomBar/index.jsx @@ -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) + } } } diff --git a/packages/app/src/cores/haptics/haptics.core.js b/packages/app/src/cores/haptics/haptics.core.js index dfb34ec4..0b6953da 100644 --- a/packages/app/src/cores/haptics/haptics.core.js +++ b/packages/app/src/cores/haptics/haptics.core.js @@ -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) {