[mobile] Comments (applying comment display)

This commit is contained in:
JuliaSvinareva 2021-03-01 23:09:39 +03:00
parent dd78ba9395
commit 2a90efa7b0
2 changed files with 19 additions and 7 deletions

View file

@ -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);

View file

@ -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) {