[mobile] Fix bug 50823

This commit is contained in:
JuliaSvinareva 2021-06-11 15:12:28 +03:00
parent b49af817e2
commit bafa7f9688
7 changed files with 40 additions and 63 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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);
}
}
}];