From 03185bd415a942b3aff86ec2fc16bb4b40e2cd7f Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Tue, 24 Mar 2026 23:27:11 +0300 Subject: [PATCH] refactored collab controller --- .../lib/controller/collaboration/Collaboration.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/common/mobile/lib/controller/collaboration/Collaboration.jsx b/apps/common/mobile/lib/controller/collaboration/Collaboration.jsx index 0345ef04d8..99d86ac5bb 100644 --- a/apps/common/mobile/lib/controller/collaboration/Collaboration.jsx +++ b/apps/common/mobile/lib/controller/collaboration/Collaboration.jsx @@ -43,9 +43,10 @@ class CollaborationController extends Component { } } else if (!appOptions.isEdit && appOptions.isRestrictedEdit) { isFastCoauth = true; - api.asc_SetFastCollaborative(LocalStorage.itemExists(`${window.editorType}-mobile-autosave`) ? LocalStorage.getBool(`${window.editorType}-mobile-autosave`) : true); + const isAutosaveInLs = LocalStorage.itemExists(`${window.editorType}-mobile-autosave`); + api.asc_SetFastCollaborative(isAutosaveInLs ? LocalStorage.getBool(`${window.editorType}-mobile-autosave`) : true); window.editorType === 'de' && api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None); - api.asc_setAutoSaveGap(LocalStorage.itemExists(`${window.editorType}-mobile-autosave`) ? parseInt(LocalStorage.getItem(`${window.editorType}-mobile-autosave`)) : 1); + api.asc_setAutoSaveGap(isAutosaveInLs ? parseInt(LocalStorage.getItem(`${window.editorType}-mobile-autosave`)) : 1); } else if (appOptions.canLiveView) { // viewer isFastCoauth = !(appOptions.config.coEditing && appOptions.config.coEditing.mode==='strict'); api.asc_SetFastCollaborative(isFastCoauth); @@ -65,8 +66,9 @@ class CollaborationController extends Component { value = isFastCoauth; // Common.localStorage.getItem("de-settings-autosave"); value = (!isFastCoauth && value !== null) ? parseInt(value) : (appOptions.canCoAuthoring ? 1 : 0); } - api.asc_SetFastCollaborative(value ? (LocalStorage.itemExists(`${window.editorType}-mobile-autosave`) ? LocalStorage.getBool(`${window.editorType}-mobile-autosave`) : true) : false); - api.asc_setAutoSaveGap(value ? (LocalStorage.itemExists(`${window.editorType}-mobile-autosave`) ? parseInt(LocalStorage.getItem(`${window.editorType}-mobile-autosave`)) : 1) : 0); + const isAutosaveInLs = LocalStorage.itemExists(`${window.editorType}-mobile-autosave`); + api.asc_SetFastCollaborative(value ? (isAutosaveInLs ? LocalStorage.getBool(`${window.editorType}-mobile-autosave`) : true) : false); + api.asc_setAutoSaveGap(value ? (isAutosaveInLs ? parseInt(LocalStorage.getItem(`${window.editorType}-mobile-autosave`)) : 1) : 0); } /** coauthoring end **/ }