From 2a90efa7b0cb0d611c03de701e9b0518bcb0a2f1 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Mon, 1 Mar 2021 23:09:39 +0300 Subject: [PATCH] [mobile] Comments (applying comment display) --- .../lib/controller/collaboration/Comments.jsx | 12 ++++++++++++ .../controller/settings/ApplicationSettings.jsx | 14 +++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/apps/common/mobile/lib/controller/collaboration/Comments.jsx b/apps/common/mobile/lib/controller/collaboration/Comments.jsx index 286a8c3bc..a55dff87d 100644 --- a/apps/common/mobile/lib/controller/collaboration/Comments.jsx +++ b/apps/common/mobile/lib/controller/collaboration/Comments.jsx @@ -3,6 +3,7 @@ import { inject, observer } from "mobx-react"; import { f7 } from 'framework7-react'; import {Device} from '../../../../../common/mobile/utils/device'; import { withTranslation} from 'react-i18next'; +import { LocalStorage } from '../../../utils/LocalStorage'; import {AddComment, EditComment, ViewComments} from '../../view/collaboration/Comments'; @@ -64,6 +65,17 @@ class CommentsController extends Component { Common.Notifications.on('configOptionsFill', () => { this.curUserId = this.appOptions.user.id; }); + + Common.Notifications.on('document:ready', () => { + if (window.editorType === 'de' || window.editorType === 'sse') { + const api = Common.EditorApi.get(); + /** coauthoring begin **/ + const isLiveCommenting = LocalStorage.getBool(`${window.editorType}-mobile-settings-livecomment`, true); + const resolved = LocalStorage.getBool(`${window.editorType}-settings-resolvedcomment`, true); + isLiveCommenting ? api.asc_showComments(resolved) : api.asc_hideComments(); + /** coauthoring end **/ + } + }); } addComment (id, data) { const comment = this.readSDKComment(id, data); diff --git a/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx b/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx index b3914a9c6..39b4fd77e 100644 --- a/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx +++ b/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx @@ -42,21 +42,21 @@ class ApplicationSettingsController extends Component { if (!value) { api.asc_hideComments(); this.switchDisplayResolved(value); - // Common.localStorage.setBool("de-settings-resolvedcomment", false); + LocalStorage.setBool("de-settings-resolvedcomment", false); } else { - // let resolved = Common.localStorage.getBool("de-settings-resolvedcomment"); - api.asc_showComments(value); + const resolved = LocalStorage.getBool("de-settings-resolvedcomment"); + api.asc_showComments(resolved); } - // Common.localStorage.setBool("de-mobile-settings-livecomment", value); + LocalStorage.setBool("de-mobile-settings-livecomment", value); } switchDisplayResolved(value) { const api = Common.EditorApi.get(); - // let displayComments = Common.localStorage.getBool("de-mobile-settings-livecomment"); - if (value) { + const displayComments = LocalStorage.getBool("de-mobile-settings-livecomment"); + if (displayComments) { api.asc_showComments(value); + LocalStorage.setBool("de-settings-resolvedcomment", value); } - // Common.localStorage.setBool("de-settings-resolvedcomment", value); } setMacrosSettings(value) {