Merge pull request '[mobile] fix for isForceView option' (#85) from feature/hotfix-8-2-1 into hotfix/v8.2.1

This commit is contained in:
Maxim Kadushkin
2024-10-18 14:14:33 +00:00

View File

@ -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();