From fc1267c4ddb7fcca6de92d77c9e877d221062716 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Thu, 27 Jan 2022 17:43:02 +0400 Subject: [PATCH] [PE SSE mobile] Fix Bug 55043 --- .../mobile/src/view/settings/Settings.jsx | 6 +-- .../mobile/src/view/settings/Settings.jsx | 52 ++++++++++++++---- .../mobile/src/store/appOptions.js | 6 ++- .../mobile/src/view/settings/Settings.jsx | 54 +++++++++++++++---- 4 files changed, 94 insertions(+), 24 deletions(-) diff --git a/apps/documenteditor/mobile/src/view/settings/Settings.jsx b/apps/documenteditor/mobile/src/view/settings/Settings.jsx index 5802f473e..ea0bafd9e 100644 --- a/apps/documenteditor/mobile/src/view/settings/Settings.jsx +++ b/apps/documenteditor/mobile/src/view/settings/Settings.jsx @@ -152,9 +152,9 @@ const SettingsList = inject("storeAppOptions", "storeReview")(observer(props => } {_canDownloadOrigin && - - - + + + } {_canPrint && diff --git a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx index c82a192ec..afc2f4402 100644 --- a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx +++ b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx @@ -112,11 +112,36 @@ const SettingsList = inject("storeAppOptions", "storeToolbarSettings")(observer( }; const appOptions = props.storeAppOptions; - let _isEdit = false; + let _isEdit = false, + _canDownload = false, + _canDownloadOrigin = false, + _canAbout = true, + _canHelp = true, + _canPrint = false; - if (!appOptions.isDisconnected) { + if (appOptions.isDisconnected) { + _isEdit = false; + if (!appOptions.enableDownload) + _canPrint = _canDownload = _canDownloadOrigin = false; + } else { _isEdit = appOptions.isEdit; - } + _canDownload = appOptions.canDownload; + _canDownloadOrigin = appOptions.canDownloadOrigin; + _canPrint = appOptions.canPrint; + if (appOptions.customization && appOptions.canBrandingExt) { + _canAbout = (appOptions.customization.about!==false); + } + if (appOptions.customization) { + _canHelp = (appOptions.customization.help!==false); + } + } + + const onDownloadOrigin = () => { + closeModal(); + setTimeout(() => { + Common.EditorApi.get().asc_DownloadOrigin(); + }, 0); + }; return ( @@ -141,12 +166,21 @@ const SettingsList = inject("storeAppOptions", "storeToolbarSettings")(observer( - - - - - - + {_canDownload && + + + + } + {_canDownloadOrigin && + + + + } + {_canPrint && + + + + } diff --git a/apps/spreadsheeteditor/mobile/src/store/appOptions.js b/apps/spreadsheeteditor/mobile/src/store/appOptions.js index d21a85617..16434e8da 100644 --- a/apps/spreadsheeteditor/mobile/src/store/appOptions.js +++ b/apps/spreadsheeteditor/mobile/src/store/appOptions.js @@ -100,8 +100,10 @@ export class storeAppOptions { this.canPrint = (permissions.print !== false); this.isRestrictedEdit = !this.isEdit && this.canComments; this.trialMode = params.asc_getLicenseMode(); - this.canDownloadOrigin = permissions.download !== false; - this.canDownload = permissions.download !== false; + + const type = /^(?:(pdf|djvu|xps|oxps))$/.exec(document.fileType); + this.canDownloadOrigin = permissions.download !== false && (type && typeof type[1] === 'string'); + this.canDownload = permissions.download !== false && (!type || typeof type[1] !== 'string'); this.canUseReviewPermissions = this.canLicense && (!!permissions.reviewGroups || this.customization && this.customization.reviewPermissions && (typeof (this.customization.reviewPermissions) == 'object')); this.canUseCommentPermissions = this.canLicense && !!permissions.commentGroups; diff --git a/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx b/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx index c3098cedb..eb8f1929d 100644 --- a/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx @@ -117,11 +117,36 @@ const SettingsList = inject("storeAppOptions")(observer(props => { }; const appOptions = props.storeAppOptions; - let _isEdit = false; - - if (!appOptions.isDisconnected) { + let _isEdit = false, + _canDownload = false, + _canDownloadOrigin = false, + _canAbout = true, + _canHelp = true, + _canPrint = false; + + if (appOptions.isDisconnected) { + _isEdit = false; + if (!appOptions.enableDownload) + _canPrint = _canDownload = _canDownloadOrigin = false; + } else { _isEdit = appOptions.isEdit; - } + _canDownload = appOptions.canDownload; + _canDownloadOrigin = appOptions.canDownloadOrigin; + _canPrint = appOptions.canPrint; + if (appOptions.customization && appOptions.canBrandingExt) { + _canAbout = (appOptions.customization.about!==false); + } + if (appOptions.customization) { + _canHelp = (appOptions.customization.help!==false); + } + } + + const onDownloadOrigin = () => { + closeModal(); + setTimeout(() => { + Common.EditorApi.get().asc_DownloadOrigin(); + }, 0); + }; return ( @@ -146,12 +171,21 @@ const SettingsList = inject("storeAppOptions")(observer(props => { - - - - - - + {_canDownload && + + + + } + {_canDownloadOrigin && + + + + } + {_canPrint && + + + + }