From bafa7f968863614a32122f7d31e105724a4498df Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Fri, 11 Jun 2021 15:12:28 +0300 Subject: [PATCH 1/2] [mobile] Fix bug 50823 --- .../mobile/src/controller/LongActions.jsx | 22 ++++++------------- .../src/controller/settings/Download.jsx | 10 ++++----- .../mobile/src/controller/LongActions.jsx | 20 +++++------------ .../mobile/src/controller/Main.jsx | 8 +++---- .../mobile/src/controller/LongActions.jsx | 20 +++++------------ .../mobile/src/controller/Main.jsx | 2 +- .../src/controller/settings/Download.jsx | 21 +++++++++--------- 7 files changed, 40 insertions(+), 63 deletions(-) diff --git a/apps/documenteditor/mobile/src/controller/LongActions.jsx b/apps/documenteditor/mobile/src/controller/LongActions.jsx index da831fd29..7d5a4f200 100644 --- a/apps/documenteditor/mobile/src/controller/LongActions.jsx +++ b/apps/documenteditor/mobile/src/controller/LongActions.jsx @@ -39,11 +39,7 @@ const LongActionsController = () => { api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd); api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); - Common.Notifications.off('preloader:endAction', (type, id) => { - if (stackLongActions.exist({id: id, type: type})) { - onLongActionEnd(type, id); - } - }); + Common.Notifications.off('preloader:endAction', onLongActionEnd); Common.Notifications.off('preloader:beginAction', onLongActionBegin); Common.Notifications.off('preloader:close', closePreloader); }) @@ -55,22 +51,18 @@ const LongActionsController = () => { setLongActionView(action); }; - const onLongActionEnd = (type, id) => { + const onLongActionEnd = (type, id, forceClose) => { + if (!stackLongActions.exist({id: id, type: type})) return; + let action = {id: id, type: type}; stackLongActions.pop(action); //this.updateWindowTitle(true); - action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information}); + action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information}) || stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction}); - if (action) { - setLongActionView(action) - } - - action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction}); - - if (action) { - setLongActionView(action) + if (action && !forceClose) { + setLongActionView(action); } else { loadMask && loadMask.el && loadMask.el.classList.contains('modal-in') && f7.dialog.close(loadMask.el); } diff --git a/apps/documenteditor/mobile/src/controller/settings/Download.jsx b/apps/documenteditor/mobile/src/controller/settings/Download.jsx index 858dbfa65..aa5982539 100644 --- a/apps/documenteditor/mobile/src/controller/settings/Download.jsx +++ b/apps/documenteditor/mobile/src/controller/settings/Download.jsx @@ -70,7 +70,7 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady pagesName.push(page.asc_getCodePageName()); } Common.Notifications.trigger('preloader:close'); - Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256); + Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256, true); const buttons = []; if (mode === 2) { buttons.push({ @@ -122,16 +122,16 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady }); } else if (type == Asc.c_oAscAdvancedOptionsID.DRM) { Common.Notifications.trigger('preloader:close'); - // Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256); + Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256, true); const buttons = [{ text: 'OK', bold: true, onClick: function () { const password = document.getElementById('modal-password').value; api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password)); - // if (!isDocReady) { - // Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256); - // } + if (!isDocReady) { + Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256); + } } }]; if (canRequestClose) diff --git a/apps/presentationeditor/mobile/src/controller/LongActions.jsx b/apps/presentationeditor/mobile/src/controller/LongActions.jsx index 18669369f..4ef67ab68 100644 --- a/apps/presentationeditor/mobile/src/controller/LongActions.jsx +++ b/apps/presentationeditor/mobile/src/controller/LongActions.jsx @@ -39,11 +39,7 @@ const LongActionsController = () => { api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd); api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); - Common.Notifications.off('preloader:endAction', (type, id) => { - if (stackLongActions.exist({id: id, type: type})) { - onLongActionEnd(type, id); - } - }); + Common.Notifications.off('preloader:endAction', onLongActionEnd); Common.Notifications.off('preloader:beginAction', onLongActionBegin); Common.Notifications.off('preloader:close', closePreloader); }) @@ -55,21 +51,17 @@ const LongActionsController = () => { setLongActionView(action); }; - const onLongActionEnd = (type, id) => { + const onLongActionEnd = (type, id, forceClose) => { + if (!stackLongActions.exist({id: id, type: type})) return; + let action = {id: id, type: type}; stackLongActions.pop(action); //this.updateWindowTitle(true); - action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information}); + action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information}) || stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction}); - if (action) { - setLongActionView(action) - } - - action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction}); - - if (action) { + if (action && !forceClose) { setLongActionView(action) } else { loadMask && loadMask.el && loadMask.el.classList.contains('modal-in') && f7.dialog.close(loadMask.el); diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index c2b883528..6210b4bf6 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -590,7 +590,7 @@ class MainController extends Component { if (type == Asc.c_oAscAdvancedOptionsID.DRM) { Common.Notifications.trigger('preloader:close'); - // Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument); + Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument, true); const buttons = [{ text: 'OK', @@ -599,9 +599,9 @@ class MainController extends Component { const password = document.getElementById('modal-password').value; this.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password)); - // if (!this._isDocReady) { - // Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument); - // } + if (!this._isDocReady) { + Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument); + } } }]; if (this.props.storeAppOptions.canRequestClose) diff --git a/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx b/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx index b4dda7b72..adba817b8 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx @@ -41,11 +41,7 @@ const LongActionsController = () => { api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_unregisterCallback('asc_onConfirmAction', onConfirmAction); - Common.Notifications.off('preloader:endAction', (type, id) => { - if (stackLongActions.exist({id: id, type: type})) { - onLongActionEnd(type, id); - } - }); + Common.Notifications.off('preloader:endAction', onLongActionEnd); Common.Notifications.off('preloader:beginAction', onLongActionBegin); Common.Notifications.off('preloader:close', closePreloader); }) @@ -57,21 +53,17 @@ const LongActionsController = () => { setLongActionView(action); }; - const onLongActionEnd = (type, id) => { + const onLongActionEnd = (type, id, forceClose) => { + if (!stackLongActions.exist({id: id, type: type})) return; + let action = {id: id, type: type}; stackLongActions.pop(action); //this.updateWindowTitle(true); - action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information}); + action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information}) || stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction}); - if (action) { - setLongActionView(action) - } - - action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction}); - - if (action) { + if (action && !forceClose) { setLongActionView(action) } else { loadMask && loadMask.el && loadMask.el.classList.contains('modal-in') && f7.dialog.close(loadMask.el); diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index f96ca6aef..f23dd952d 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -323,7 +323,7 @@ class MainController extends Component { this.api.asc_registerCallback('asc_onAdvancedOptions', (type, advOptions, mode, formatOptions) => { const {t} = this.props; const _t = t("View.Settings", { returnObjects: true }); - onAdvancedOptions(type, advOptions, mode, formatOptions, _t, this.props.storeAppOptions.canRequestClose); + onAdvancedOptions(type, advOptions, mode, formatOptions, _t, this._isDocReady, this.props.storeAppOptions.canRequestClose); }); } diff --git a/apps/spreadsheeteditor/mobile/src/controller/settings/Download.jsx b/apps/spreadsheeteditor/mobile/src/controller/settings/Download.jsx index ac3829d56..320a6e650 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/settings/Download.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/settings/Download.jsx @@ -21,7 +21,7 @@ class DownloadController extends Component { _t.warnDownloadAs, _t.notcriticalErrorTitle, function () { - onAdvancedOptions(Asc.c_oAscAdvancedOptionsID.CSV, api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format), _t) + onAdvancedOptions(Asc.c_oAscAdvancedOptionsID.CSV, api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format), _t, true); } ) } else { @@ -39,7 +39,7 @@ class DownloadController extends Component { const DownloadWithTranslation = withTranslation()(DownloadController); -const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequestClose) => { +const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady, canRequestClose) => { const api = Common.EditorApi.get(); if (type == Asc.c_oAscAdvancedOptionsID.CSV) { @@ -52,7 +52,8 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequest pagesName.push(page.asc_getCodePageName()); } - // me.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument); + Common.Notifications.trigger('preloader:close'); + Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256, true); const buttons = []; @@ -76,9 +77,9 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequest api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding, delimiter)); } - //if (!me._isDocReady) { - //me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); - //} + if (!isDocReady) { + Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256); + } } }); @@ -122,16 +123,16 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequest } else if (type == Asc.c_oAscAdvancedOptionsID.DRM) { Common.Notifications.trigger('preloader:close'); - //me.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument); + Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256, true); const buttons = [{ text: 'OK', bold: true, onClick: function () { const password = document.getElementById('modal-password').value; api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password)); - //if (!me._isDocReady) { - //me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); - //} + if (!isDocReady) { + Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256); + } } }]; From 0b2cb9f13dc454865a2fdac09b96a288324f24cd Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Fri, 11 Jun 2021 16:15:57 +0300 Subject: [PATCH 2/2] [SSE mobile] Fix bug 50824 --- .../controller/settings/SpreadsheetInfo.jsx | 36 ++++++++++--------- .../src/view/settings/SpreadsheetInfo.jsx | 8 ++--- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/settings/SpreadsheetInfo.jsx b/apps/spreadsheeteditor/mobile/src/controller/settings/SpreadsheetInfo.jsx index 238036bcd..a3325b307 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/settings/SpreadsheetInfo.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/settings/SpreadsheetInfo.jsx @@ -6,13 +6,17 @@ class SpreadsheetInfoController extends Component { constructor(props) { super(props); this.docProps = this.getDocProps(); - this.getModified = this.getModified(); - this.getModifiedBy = this.getModifiedBy(); - this.getCreators = this.getCreators(); - this.title = this.getTitle(); - this.subject = this.getSubject(); - this.description = this.getDescription(); - this.getCreated = this.getCreated(); + if (this.docProps) { + this.dataApp = this.getAppProps(); + this.modified = this.getModified(); + this.modifiedBy = this.getModifiedBy(); + this.creators = this.getCreators(); + this.title = this.getTitle(); + this.subject = this.getSubject(); + this.description = this.getDescription(); + this.created = this.getCreated(); + + } } getDocProps() { @@ -23,7 +27,6 @@ class SpreadsheetInfoController extends Component { getAppProps() { const api = Common.EditorApi.get(); const appProps = api.asc_getAppProps(); - if (appProps) { let appName = (appProps.asc_getApplication() || "") + @@ -31,12 +34,12 @@ class SpreadsheetInfoController extends Component { (appProps.asc_getAppVersion() || ""); return appName; } + return null; } getModified() { let valueModified = this.docProps.asc_getModified(); const _lang = this.props.storeAppOptions.lang; - if (valueModified) { return ( valueModified.toLocaleString(_lang, { @@ -48,14 +51,15 @@ class SpreadsheetInfoController extends Component { valueModified.toLocaleTimeString(_lang, { timeStyle: "short" }) ); } + return null; } getModifiedBy() { let valueModifiedBy = this.docProps.asc_getLastModifiedBy(); - if (valueModifiedBy) { return Common.Utils.UserInfoParser.getParsedName(valueModifiedBy); } + return null; } getCreators() { @@ -77,20 +81,20 @@ class SpreadsheetInfoController extends Component { getCreated() { let value = this.docProps.asc_getCreated(); const _lang = this.props.storeAppOptions.lang; - if(value) { return value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleTimeString(_lang, {timeStyle: 'short'}); } + return null; } render() { return ( { const { t } = useTranslation(); const _t = t("View.Settings", { returnObjects: true }); const storeSpreadsheetInfo = props.storeSpreadsheetInfo; - const dataApp = props.getAppProps(); - const dataModified = props.getModified; - const dataModifiedBy = props.getModifiedBy; - const creators = props.getCreators; const dataDoc = storeSpreadsheetInfo.dataDoc; + const dataApp = props.dataApp; + const dataModified = props.modified; + const dataModifiedBy = props.modifiedBy; + const creators = props.creators; return (