From b81ea56e499a6ab52c576d450c1e4e1a7836e03b Mon Sep 17 00:00:00 2001 From: maxkadushkin Date: Wed, 16 Oct 2024 22:39:06 +0300 Subject: [PATCH] [mobile] fix for isForceView option --- .../mobile/src/controller/Main.jsx | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index 6b195e0039..790aef1f8c 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -305,12 +305,16 @@ class MainController extends Component { this.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); const storeAppOptions = this.props.storeAppOptions; - const isForm = storeAppOptions.isForm; const editorConfig = window.native?.editorConfig; const config = storeAppOptions.config; const customization = config.customization; - const isMobileForceView = customization?.mobileForceView !== undefined ? customization.mobileForceView : editorConfig?.mobileForceView !== undefined ? editorConfig.mobileForceView : true; - const isForceView = customization?.mobile?.forceView ?? true; + let isMobileForceView = undefined; + if ( customization && customization.mobileForceView !== undefined ) + isMobileForceView = customization.mobileForceView; + else if ( editorConfig && editorConfig.mobileForceView !== undefined ) + isMobileForceView = editorConfig.mobileForceView; + + const isForceView = isMobileForceView ?? customization?.mobile?.forceView ?? true; if(customization?.mobileForceView !== undefined && customization?.mobileForceView !== null) { console.warn("Obsolete: The mobileForceView parameter is deprecated. Please use the forceView parameter from customization.mobile block"); @@ -320,12 +324,14 @@ class MainController extends Component { this.applyMode(storeAppOptions); - if(!isForm && (isMobileForceView || isForceView)) { - this.api.asc_addRestriction(Asc.c_oAscRestrictionType.View); - } else if(!isForm && !isMobileForceView) { - storeAppOptions.changeViewerMode(false); + if ( storeAppOptions.isForm ) { + this.api.asc_addRestriction(Asc.c_oAscRestrictionType.OnlyForms); } else { - this.api.asc_addRestriction(Asc.c_oAscRestrictionType.OnlyForms) + if( isForceView ) { + this.api.asc_addRestriction(Asc.c_oAscRestrictionType.View); + } else { + storeAppOptions.changeViewerMode(false); + } } this.api.asc_LoadDocument();