[DE mobile] Fix long actions for downloading
This commit is contained in:
parent
149f748f59
commit
4c16858a3b
|
@ -198,6 +198,7 @@ class MainController extends Component {
|
||||||
f7.emit('resize');
|
f7.emit('resize');
|
||||||
|
|
||||||
this._isDocReady = true;
|
this._isDocReady = true;
|
||||||
|
appOptions.changeDocReady(true);
|
||||||
|
|
||||||
this.api.SetDrawingFreeze(false);
|
this.api.SetDrawingFreeze(false);
|
||||||
|
|
||||||
|
@ -602,7 +603,7 @@ class MainController extends Component {
|
||||||
this.api.asc_registerCallback('asc_onAdvancedOptions', (type, advOptions, mode, formatOptions) => {
|
this.api.asc_registerCallback('asc_onAdvancedOptions', (type, advOptions, mode, formatOptions) => {
|
||||||
const {t} = this.props;
|
const {t} = this.props;
|
||||||
const _t = t("Settings", { returnObjects: true });
|
const _t = t("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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@ import React, { Component } from "react";
|
||||||
import Download from "../../view/settings/Download";
|
import Download from "../../view/settings/Download";
|
||||||
import { Device } from '../../../../../common/mobile/utils/device';
|
import { Device } from '../../../../../common/mobile/utils/device';
|
||||||
import { f7 } from 'framework7-react';
|
import { f7 } from 'framework7-react';
|
||||||
import { withTranslation, useTranslation } from 'react-i18next';
|
import { withTranslation } from 'react-i18next';
|
||||||
|
import { observer, inject } from "mobx-react";
|
||||||
|
|
||||||
class DownloadController extends Component {
|
class DownloadController extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -28,9 +29,10 @@ class DownloadController extends Component {
|
||||||
f7.dialog.confirm(
|
f7.dialog.confirm(
|
||||||
(format === Asc.c_oAscFileType.TXT) ? _t.textDownloadTxt : _t.textDownloadRtf,
|
(format === Asc.c_oAscFileType.TXT) ? _t.textDownloadTxt : _t.textDownloadRtf,
|
||||||
_t.notcriticalErrorTitle,
|
_t.notcriticalErrorTitle,
|
||||||
function () {
|
() => {
|
||||||
if (format == Asc.c_oAscFileType.TXT) {
|
if (format == Asc.c_oAscFileType.TXT) {
|
||||||
onAdvancedOptions(Asc.c_oAscAdvancedOptionsID.TXT, api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format), _t);
|
const isDocReady = this.props.storeAppOptions.isDocReady;
|
||||||
|
onAdvancedOptions(Asc.c_oAscAdvancedOptionsID.TXT, api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format), _t, isDocReady);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
||||||
|
@ -52,9 +54,10 @@ class DownloadController extends Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const DownloadWithTranslation = withTranslation()(DownloadController);
|
|
||||||
|
|
||||||
const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequestClose) => {
|
const DownloadWithTranslation = inject("storeAppOptions")(observer(withTranslation()(DownloadController)));
|
||||||
|
|
||||||
|
const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady, canRequestClose) => {
|
||||||
if ($$('.dlg-adv-options.modal-in').length > 0) return;
|
if ($$('.dlg-adv-options.modal-in').length > 0) return;
|
||||||
|
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
|
@ -66,7 +69,8 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequest
|
||||||
pages.push(page.asc_getCodePage());
|
pages.push(page.asc_getCodePage());
|
||||||
pagesName.push(page.asc_getCodePageName());
|
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);
|
||||||
const buttons = [];
|
const buttons = [];
|
||||||
if (mode === 2) {
|
if (mode === 2) {
|
||||||
buttons.push({
|
buttons.push({
|
||||||
|
@ -84,9 +88,9 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequest
|
||||||
} else {
|
} else {
|
||||||
api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding));
|
api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding));
|
||||||
}
|
}
|
||||||
//if (!me._isDocReady) {
|
if (!isDocReady) {
|
||||||
//me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const dialog = f7.dialog.create({
|
const dialog = f7.dialog.create({
|
||||||
|
@ -117,16 +121,17 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequest
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
|
} else if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
|
||||||
//me.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
|
Common.Notifications.trigger('preloader:close');
|
||||||
|
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256);
|
||||||
const buttons = [{
|
const buttons = [{
|
||||||
text: 'OK',
|
text: 'OK',
|
||||||
bold: true,
|
bold: true,
|
||||||
onClick: function () {
|
onClick: function () {
|
||||||
const password = document.getElementById('modal-password').value;
|
const password = document.getElementById('modal-password').value;
|
||||||
api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password));
|
api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password));
|
||||||
//if (!me._isDocReady) {
|
if (!isDocReady) {
|
||||||
//Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
|
Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
if (canRequestClose)
|
if (canRequestClose)
|
||||||
|
|
|
@ -18,7 +18,9 @@ export class storeAppOptions {
|
||||||
readerMode: observable,
|
readerMode: observable,
|
||||||
changeReaderMode: action,
|
changeReaderMode: action,
|
||||||
|
|
||||||
canBrandingExt: observable
|
canBrandingExt: observable,
|
||||||
|
|
||||||
|
isDocReady: observable
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +41,11 @@ export class storeAppOptions {
|
||||||
|
|
||||||
canBrandingExt = false;
|
canBrandingExt = false;
|
||||||
|
|
||||||
|
isDocReady = false;
|
||||||
|
changeDocReady (value) {
|
||||||
|
this.isDocReady = value;
|
||||||
|
}
|
||||||
|
|
||||||
config = {};
|
config = {};
|
||||||
setConfigOptions (config) {
|
setConfigOptions (config) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
Loading…
Reference in a new issue