Skip to content

Commit

Permalink
Merge pull request '[mobile] fix for isForceView option' (#85) from f…
Browse files Browse the repository at this point in the history
…eature/hotfix-8-2-1 into hotfix/v8.2.1
  • Loading branch information
maxkadushkin committed Oct 18, 2024
2 parents 8b6e1db + b81ea56 commit 3c752ab
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions apps/documenteditor/mobile/src/controller/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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();
Expand Down

0 comments on commit 3c752ab

Please sign in to comment.