[DE mobile] For Bug 58655

This commit is contained in:
SergeyEzhin 2022-09-28 02:03:02 +03:00
parent 9f37a4c70d
commit 13cedf86f1

View file

@ -3,7 +3,6 @@ import { inject, observer } from 'mobx-react';
import { f7 } from 'framework7-react';
import { useTranslation } from 'react-i18next';
import ToolbarView from "../view/Toolbar";
import {storeAppOptions} from "../store/appOptions";
import {LocalStorage} from "../../../../common/mobile/utils/LocalStorage";
const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'storeFocusObjects', 'storeToolbarSettings','storeDocumentInfo')(observer(props => {
@ -33,12 +32,23 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
const docExt = docInfo.dataDoc ? docInfo.dataDoc.fileType : '';
const docTitle = docInfo.dataDoc ? docInfo.dataDoc.title : '';
const sensitivity = 20;
let touchStartY = 0;
let touchEndY = 0;
useEffect(() => {
const sdk = document.querySelector('#editor_sdk');
Common.Gateway.on('init', loadConfig);
Common.Notifications.on('toolbar:activatecontrols', activateControls);
Common.Notifications.on('toolbar:deactivateeditcontrols', deactivateEditControls);
Common.Notifications.on('goback', goBack);
if(isViewer) {
sdk.addEventListener('touchstart', handleTouchStart);
sdk.addEventListener('touchend', handleTouchEnd);
}
if (isDisconnected) {
f7.popover.close();
f7.sheet.close();
@ -49,9 +59,37 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
Common.Notifications.off('toolbar:activatecontrols', activateControls);
Common.Notifications.off('toolbar:deactivateeditcontrols', deactivateEditControls);
Common.Notifications.off('goback', goBack);
if(isViewer) {
sdk.removeEventListener('touchstart', handleTouchStart);
sdk.removeEventListener('touchend', handleTouchEnd);
}
}
});
// Touch handlers
const checkDirection = () => {
const diff = touchStartY - touchEndY;
if(Math.abs(diff) > sensitivity) {
if(diff > 0) {
// f7.navbar.show('.main-navbar');
} else {
// f7.navbar.hide('.main-navbar');
}
}
};
const handleTouchStart = e => {
touchStartY = e.changedTouches[0].screenY;
};
const handleTouchEnd = e => {
touchEndY = e.changedTouches[0].screenY;
checkDirection();
};
// Back button
const [isShowBack, setShowBack] = useState(appOptions.canBackToFolder);
const loadConfig = (data) => {