[DE PE SSE mobile] Fix Bug 59928

This commit is contained in:
SergeyEzhin 2022-12-01 17:39:06 +04:00
parent fce2e4fdc4
commit 3422e014d1
4 changed files with 87 additions and 15 deletions

View file

@ -0,0 +1,73 @@
import React, {useEffect} from 'react';
import ViewSharingSettings from "../view/SharingSettings";
import {observer, inject} from "mobx-react";
import { f7 } from 'framework7-react';
const SharingSettingsController = props => {
const appOptions = props.storeAppOptions;
const canRequestSharingSettings = appOptions.canRequestSharingSettings;
const sharingSettingsUrl = appOptions.sharingSettingsUrl;
const changeAccessRights = () => {
if (canRequestSharingSettings) {
Common.Gateway.requestSharingSettings();
}
};
const setSharingSettings = data => {
if (data) {
Common.Notifications.trigger('collaboration:sharingupdate', data.sharingSettings);
}
}
const onMessage = msg => {
if(msg) {
const msgData = JSON.parse(msg.data);
if (msgData && msgData?.Referer == "onlyoffice") {
if (msgData?.needUpdate) {
setSharingSettings(msgData.sharingSettings);
}
f7.views.current.router.back();
}
}
};
const bindWindowEvents = () => {
if (window.addEventListener) {
window.addEventListener("message", onMessage, false);
} else if (window.attachEvent) {
window.attachEvent("onmessage", onMessage);
}
};
const unbindWindowEvents = () => {
if (window.removeEventListener) {
window.removeEventListener("message", onMessage);
} else if (window.detachEvent) {
window.detachEvent("onmessage", onMessage);
}
};
useEffect(() => {
bindWindowEvents();
Common.Notifications.on('collaboration:sharing', changeAccessRights);
if (!!sharingSettingsUrl && sharingSettingsUrl.length || canRequestSharingSettings) {
Common.Gateway.on('showsharingsettings', changeAccessRights);
Common.Gateway.on('setsharingsettings', setSharingSettings);
}
return () => {
unbindWindowEvents();
}
}, []);
return (
<ViewSharingSettings
sharingSettingsUrl={sharingSettingsUrl}
/>
);
};
export default inject('storeAppOptions')(observer(SharingSettingsController));

View file

@ -1,18 +1,15 @@
import React, { Component, useEffect } from 'react'; import React from 'react';
import { observer, inject } from "mobx-react"; import { Navbar, Page } from 'framework7-react';
import { f7, Popover, List, ListItem, Navbar, NavRight, Sheet, BlockTitle, Page, View, Icon, Link } from 'framework7-react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Device } from "../../utils/device";
const SharingSettings = props => { const ViewSharingSettings = props => {
const { t } = useTranslation(); const { t } = useTranslation();
const storeAppOptions = props.storeAppOptions; const sharingSettingsUrl = props.sharingSettingsUrl;
const sharingSettingsUrl = storeAppOptions.sharingSettingsUrl;
const _t = t('Common.Collaboration', {returnObjects: true}); const _t = t('Common.Collaboration', {returnObjects: true});
function resizeHeightIframe(iFrame) { function resizeHeightIframe(iFrame) {
iFrame.height = iFrame.contentWindow.document.body.scrollHeight; iFrame.height = iFrame.contentWindow.document.body.scrollHeight;
} };
return ( return (
<Page> <Page>
@ -22,6 +19,6 @@ const SharingSettings = props => {
</div> </div>
</Page> </Page>
) )
} };
export default inject("storeAppOptions")(observer(SharingSettings)); export default ViewSharingSettings;

View file

@ -1,18 +1,19 @@
import React, { Component, useEffect } from 'react'; import React, { Component, useEffect } from 'react';
import { observer, inject } from "mobx-react"; import { observer, inject } from "mobx-react";
import { Popover, List, ListItem, Navbar, NavRight, Sheet, BlockTitle, Page, View, Icon, Link } from 'framework7-react'; import { Popover, List, ListItem, Navbar, NavRight, Sheet, BlockTitle, Page, View, Icon, Link, f7 } from 'framework7-react';
import { f7 } from 'framework7-react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import {Device} from "../../../utils/device"; import {Device} from "../../../utils/device";
import {ReviewController, ReviewChangeController} from "../../controller/collaboration/Review"; import {ReviewController, ReviewChangeController} from "../../controller/collaboration/Review";
import {PageDisplayMode} from "./Review"; import {PageDisplayMode} from "./Review";
import {ViewCommentsController, ViewCommentsSheetsController} from "../../controller/collaboration/Comments"; import {ViewCommentsController, ViewCommentsSheetsController} from "../../controller/collaboration/Comments";
import SharingSettings from "../SharingSettings"; // import SharingSettings from "../SharingSettings";
import SharingSettingsController from "../../controller/SharingSettings";
const PageUsers = inject("users")(observer(props => { const PageUsers = inject("users")(observer(props => {
const { t } = useTranslation(); const { t } = useTranslation();
const _t = t('Common.Collaboration', {returnObjects: true}); const _t = t('Common.Collaboration', {returnObjects: true});
const storeUsers = props.users; const storeUsers = props.users;
return ( return (
<Page name="collab__users" className='page-users'> <Page name="collab__users" className='page-users'>
<Navbar title={_t.textUsers} backLink={_t.textBack}> <Navbar title={_t.textUsers} backLink={_t.textBack}>
@ -83,7 +84,7 @@ const routes = [
}, },
{ {
path: '/sharing-settings/', path: '/sharing-settings/',
component: SharingSettings component: SharingSettingsController
} }
]; ];
@ -131,8 +132,8 @@ const PageCollaboration = inject('storeAppOptions', 'users')(observer(props => {
</Page> </Page>
</View> </View>
) )
})); }));
class CollaborationView extends Component { class CollaborationView extends Component {
constructor(props) { constructor(props) {
super(props); super(props);

View file

@ -95,6 +95,7 @@ export class storeAppOptions {
this.lang = config.lang; this.lang = config.lang;
this.location = (typeof (config.location) == 'string') ? config.location.toLowerCase() : ''; this.location = (typeof (config.location) == 'string') ? config.location.toLowerCase() : '';
this.sharingSettingsUrl = config.sharingSettingsUrl; this.sharingSettingsUrl = config.sharingSettingsUrl;
this.canRequestSharingSettings = config.canRequestSharingSettings;
this.fileChoiceUrl = config.fileChoiceUrl; this.fileChoiceUrl = config.fileChoiceUrl;
this.mergeFolderUrl = config.mergeFolderUrl; this.mergeFolderUrl = config.mergeFolderUrl;
this.canAnalytics = false; this.canAnalytics = false;