[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_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:close', closePreloader);
})

View file

@ -34,6 +34,7 @@ class MainController extends Component {
window.editorType = 'de';
this.LoadingDocument = -256;
this.ApplyEditRights = -255;
this._state = {
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_onDocumentCanSaveChanged', this.onDocumentCanSaveChanged.bind(this));
//if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType['BlockInteraction']})) {
// me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], ApplyEditRights);
//} else if (!this._isDocReady) {
// me.hidePreloader();
// me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
//}
Common.Notifications.trigger('preloader:close');
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.ApplyEditRights);
if (!this._isDocReady) {
Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
}
// Message on window close
window.onbeforeunload = this.onBeforeUnload.bind(this);

View file

@ -39,7 +39,11 @@ const LongActionsController = () => {
api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd);
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:close', closePreloader);
})

View file

@ -33,6 +33,7 @@ class MainController extends Component {
window.editorType = 'pe';
this.LoadingDocument = -256;
this.ApplyEditRights = -255;
this._state = {
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_onDocumentCanSaveChanged', this.onDocumentCanSaveChanged.bind(this));
//if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType['BlockInteraction']})) {
// me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], ApplyEditRights);
//} else if (!this._isDocReady) {
// me.hidePreloader();
// me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
//}
Common.Notifications.trigger('preloader:close');
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.ApplyEditRights);
if (!this._isDocReady) {
Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
}
// Message on window close
window.onbeforeunload = this.onBeforeUnload.bind(this);

View file

@ -41,7 +41,11 @@ const LongActionsController = () => {
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument);
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: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_onDocumentCanSaveChanged', this.onDocumentCanSaveChanged.bind(this));
//if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType.BlockInteraction})) {
//me.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, ApplyEditRights);
//} else if (!this._isDocReady) {
//me.hidePreloader();
//me.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
//}
Common.Notifications.trigger('preloader:close');
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.ApplyEditRights);
if (!this._isDocReady) {
Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
}
// Message on window close
window.onbeforeunload = this.onBeforeUnload.bind(this);