From be69a26e48c1eff366e93501ac33f370a2b9e688 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Mon, 10 Jul 2023 09:54:15 +0300 Subject: [PATCH] [DE mobile] Fix Bug 63278 --- apps/documenteditor/mobile/src/controller/Main.jsx | 9 ++++++--- apps/documenteditor/mobile/src/controller/Toolbar.jsx | 2 +- .../src/controller/settings/DocumentProtection.jsx | 7 ++++--- apps/documenteditor/mobile/src/page/main.jsx | 2 +- apps/documenteditor/mobile/src/store/appOptions.js | 5 ++--- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index 7fc640fbeb..d033cd1a69 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -795,7 +795,7 @@ class MainController extends Component { const { t } = this.props; const storeAppOptions = this.props.storeAppOptions; const props = this.getDocProps(true); - const isProtected = props && (props.isReadOnly || props.isCommentsOnly || props.isFormsOnly || props.isReviewOnly); + const isProtected = props && (props.isReadOnly || props.isCommentsOnly || props.isFormsOnly || props.isReviewOnly || props.isTrackedChanges); let textWarningDialog; if(!storeAppOptions.isReviewOnly) { @@ -822,6 +822,7 @@ class MainController extends Component { } storeAppOptions.setProtection(isProtected); + storeAppOptions.setTypeProtection(props.type); props && this.applyRestrictions(props.type); Common.Notifications.trigger('protect:doclock', props); @@ -852,7 +853,8 @@ class MainController extends Component { storeAppOptions.canComments && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments); storeAppOptions.canFillForms && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms); } else { - this.api.asc_setRestriction(Asc.c_oAscRestrictionType.None); + // this.api.asc_setRestriction(Asc.c_oAscRestrictionType.None); + this.api.asc_setRestriction(Asc.c_oAscRestrictionType.View); } } }; @@ -871,7 +873,8 @@ class MainController extends Component { isReadOnly: type === Asc.c_oAscEDocProtect.ReadOnly, isCommentsOnly: type === Asc.c_oAscEDocProtect.Comments, isReviewOnly: type === Asc.c_oAscEDocProtect.TrackedChanges, - isFormsOnly: type === Asc.c_oAscEDocProtect.Forms + isFormsOnly: type === Asc.c_oAscEDocProtect.Forms, + isTrackedChanges: type === Asc.c_oAscEDocProtect.TrackedChanges }; } diff --git a/apps/documenteditor/mobile/src/controller/Toolbar.jsx b/apps/documenteditor/mobile/src/controller/Toolbar.jsx index 9e8ca96577..a0c29b5086 100644 --- a/apps/documenteditor/mobile/src/controller/Toolbar.jsx +++ b/apps/documenteditor/mobile/src/controller/Toolbar.jsx @@ -191,7 +191,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto f7.popover.close('.document-menu.modal-in', false); - appOptions.changeViewerMode(); + appOptions.changeViewerMode(true); api.asc_addRestriction(Asc.c_oAscRestrictionType.View); } diff --git a/apps/documenteditor/mobile/src/controller/settings/DocumentProtection.jsx b/apps/documenteditor/mobile/src/controller/settings/DocumentProtection.jsx index 2fd08ed41d..56c0cb6ee9 100644 --- a/apps/documenteditor/mobile/src/controller/settings/DocumentProtection.jsx +++ b/apps/documenteditor/mobile/src/controller/settings/DocumentProtection.jsx @@ -27,9 +27,10 @@ class ProtectionDocumentController extends React.Component { appOptions.setProtection(true); appOptions.setTypeProtection(typeProtection); - if(typeProtection !== Asc.c_oAscEDocProtect.TrackedChanges && !isViewer) { - appOptions.changeViewerMode(); - } + // if(typeProtection !== Asc.c_oAscEDocProtect.TrackedChanges && !isViewer) { + appOptions.changeViewerMode(true); + api.asc_addRestriction(Asc.c_oAscRestrictionType.View); + // } protection.asc_setEditType(typeProtection); protection.asc_setPassword(password); diff --git a/apps/documenteditor/mobile/src/page/main.jsx b/apps/documenteditor/mobile/src/page/main.jsx index d78a72f2e8..ea6a28c1e9 100644 --- a/apps/documenteditor/mobile/src/page/main.jsx +++ b/apps/documenteditor/mobile/src/page/main.jsx @@ -116,7 +116,7 @@ class MainPage extends Component { f7.popover.close('.document-menu.modal-in', false); f7.navbar.show('.main-navbar', false); - appOptions.changeViewerMode(); + appOptions.changeViewerMode(false); api.asc_removeRestriction(Asc.c_oAscRestrictionType.View) api.asc_addRestriction(Asc.c_oAscRestrictionType.None); }; diff --git a/apps/documenteditor/mobile/src/store/appOptions.js b/apps/documenteditor/mobile/src/store/appOptions.js index 2ca554857d..d876450b0e 100644 --- a/apps/documenteditor/mobile/src/store/appOptions.js +++ b/apps/documenteditor/mobile/src/store/appOptions.js @@ -64,10 +64,9 @@ export class storeAppOptions { this.isMobileView = !this.isMobileView; } - isViewer = true; - changeViewerMode() { - this.isViewer = !this.isViewer; + changeViewerMode(value) { + this.isViewer = value; } canViewComments = false;