[mobile] Make long actions

This commit is contained in:
JuliaSvinareva 2021-05-17 15:36:00 +03:00
parent cd396f147f
commit e24fa28ff6
6 changed files with 35 additions and 21 deletions

View file

@ -39,7 +39,11 @@ const LongActionsController = () => {
api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd); api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd);
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument);
Common.Notifications.off('preloader:endAction', onLongActionEnd); Common.Notifications.off('preloader:endAction', (type, id) => {
if (stackLongActions.exist({id: id, type: type})) {
onLongActionEnd(type, id);
}
});
Common.Notifications.off('preloader:beginAction', onLongActionBegin); Common.Notifications.off('preloader:beginAction', onLongActionBegin);
Common.Notifications.off('preloader:close', closePreloader); Common.Notifications.off('preloader:close', closePreloader);
}) })

View file

@ -34,6 +34,7 @@ class MainController extends Component {
window.editorType = 'de'; window.editorType = 'de';
this.LoadingDocument = -256; this.LoadingDocument = -256;
this.ApplyEditRights = -255;
this._state = { this._state = {
licenseType: false, licenseType: false,
@ -342,12 +343,12 @@ class MainController extends Component {
this.api.asc_registerCallback('asc_onDocumentModifiedChanged', this.onDocumentModifiedChanged.bind(this)); this.api.asc_registerCallback('asc_onDocumentModifiedChanged', this.onDocumentModifiedChanged.bind(this));
this.api.asc_registerCallback('asc_onDocumentCanSaveChanged', this.onDocumentCanSaveChanged.bind(this)); this.api.asc_registerCallback('asc_onDocumentCanSaveChanged', this.onDocumentCanSaveChanged.bind(this));
//if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType['BlockInteraction']})) { Common.Notifications.trigger('preloader:close');
// me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], ApplyEditRights); Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.ApplyEditRights);
//} else if (!this._isDocReady) {
// me.hidePreloader(); if (!this._isDocReady) {
// me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
//} }
// Message on window close // Message on window close
window.onbeforeunload = this.onBeforeUnload.bind(this); window.onbeforeunload = this.onBeforeUnload.bind(this);

View file

@ -39,7 +39,11 @@ const LongActionsController = () => {
api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd); api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd);
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument);
Common.Notifications.off('preloader:endAction', onLongActionEnd); Common.Notifications.off('preloader:endAction', (type, id) => {
if (stackLongActions.exist({id: id, type: type})) {
onLongActionEnd(type, id);
}
});
Common.Notifications.off('preloader:beginAction', onLongActionBegin); Common.Notifications.off('preloader:beginAction', onLongActionBegin);
Common.Notifications.off('preloader:close', closePreloader); Common.Notifications.off('preloader:close', closePreloader);
}) })

View file

@ -33,6 +33,7 @@ class MainController extends Component {
window.editorType = 'pe'; window.editorType = 'pe';
this.LoadingDocument = -256; this.LoadingDocument = -256;
this.ApplyEditRights = -255;
this._state = { this._state = {
licenseType: false, licenseType: false,
@ -244,12 +245,12 @@ class MainController extends Component {
this.api.asc_registerCallback('asc_onDocumentModifiedChanged', this.onDocumentModifiedChanged.bind(this)); this.api.asc_registerCallback('asc_onDocumentModifiedChanged', this.onDocumentModifiedChanged.bind(this));
this.api.asc_registerCallback('asc_onDocumentCanSaveChanged', this.onDocumentCanSaveChanged.bind(this)); this.api.asc_registerCallback('asc_onDocumentCanSaveChanged', this.onDocumentCanSaveChanged.bind(this));
//if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType['BlockInteraction']})) { Common.Notifications.trigger('preloader:close');
// me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], ApplyEditRights); Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.ApplyEditRights);
//} else if (!this._isDocReady) {
// me.hidePreloader(); if (!this._isDocReady) {
// me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
//} }
// Message on window close // Message on window close
window.onbeforeunload = this.onBeforeUnload.bind(this); window.onbeforeunload = this.onBeforeUnload.bind(this);

View file

@ -41,7 +41,11 @@ const LongActionsController = () => {
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument);
api.asc_unregisterCallback('asc_onConfirmAction', onConfirmAction); api.asc_unregisterCallback('asc_onConfirmAction', onConfirmAction);
Common.Notifications.off('preloader:endAction', onLongActionEnd); Common.Notifications.off('preloader:endAction', (type, id) => {
if (stackLongActions.exist({id: id, type: type})) {
onLongActionEnd(type, id);
}
});
Common.Notifications.off('preloader:beginAction', onLongActionBegin); Common.Notifications.off('preloader:beginAction', onLongActionBegin);
Common.Notifications.off('preloader:close', closePreloader); Common.Notifications.off('preloader:close', closePreloader);
}) })

View file

@ -403,12 +403,12 @@ class MainController extends Component {
this.api.asc_registerCallback('asc_onDocumentModifiedChanged', this.onDocumentModifiedChanged.bind(this)); this.api.asc_registerCallback('asc_onDocumentModifiedChanged', this.onDocumentModifiedChanged.bind(this));
this.api.asc_registerCallback('asc_onDocumentCanSaveChanged', this.onDocumentCanSaveChanged.bind(this)); this.api.asc_registerCallback('asc_onDocumentCanSaveChanged', this.onDocumentCanSaveChanged.bind(this));
//if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType.BlockInteraction})) { Common.Notifications.trigger('preloader:close');
//me.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, ApplyEditRights); Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.ApplyEditRights);
//} else if (!this._isDocReady) {
//me.hidePreloader(); if (!this._isDocReady) {
//me.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument); Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
//} }
// Message on window close // Message on window close
window.onbeforeunload = this.onBeforeUnload.bind(this); window.onbeforeunload = this.onBeforeUnload.bind(this);