[DE PE SSE mobile] Correct application settings and comments

This commit is contained in:
SergeyEzhin 2021-06-07 19:54:19 +03:00
parent 04569201b9
commit 47a4436d06
4 changed files with 7 additions and 45 deletions

View file

@ -51,6 +51,7 @@ class CommentsController extends Component {
this.usersStore = this.props.users;
this.appOptions = this.props.storeAppOptions;
this.storeComments = this.props.storeComments;
this.storeApplicationSettings = this.props.storeApplicationSettings;
Common.Notifications.on('engineCreated', api => {
api.asc_registerCallback('asc_onAddComment', this.addComment.bind(this));
@ -74,6 +75,8 @@ class CommentsController extends Component {
/** coauthoring begin **/
const isLiveCommenting = LocalStorage.getBool(`${window.editorType}-mobile-settings-livecomment`, true);
const resolved = LocalStorage.getBool(`${window.editorType}-settings-resolvedcomment`, true);
this.storeApplicationSettings.changeDisplayComments(isLiveCommenting);
this.storeApplicationSettings.changeDisplayResolved(resolved);
isLiveCommenting ? api.asc_showComments(resolved) : api.asc_hideComments();
/** coauthoring end **/
}
@ -583,7 +586,7 @@ class ViewCommentsController extends Component {
}
}
const _CommentsController = inject('storeAppOptions', 'storeComments', 'users')(observer(CommentsController));
const _CommentsController = inject('storeAppOptions', 'storeComments', 'users', "storeApplicationSettings")(observer(CommentsController));
const _AddCommentController = inject('storeAppOptions', 'storeComments', 'users')(observer(AddCommentController));
const _EditCommentController = inject('storeComments', 'users')(observer(EditCommentController));
const _ViewCommentsController = inject('storeComments', 'users')(observer(withTranslation()(ViewCommentsController)));

View file

@ -7,26 +7,7 @@ class ApplicationSettingsController extends Component {
constructor(props) {
super(props);
this.switchDisplayComments = this.switchDisplayComments.bind(this);
const valueViewComments = LocalStorage.getBool("de-mobile-settings-livecomment");
const valueResolvedComments = LocalStorage.getBool("de-settings-resolvedcomment");
const valueUnitMeasurement = LocalStorage.getItem("de-mobile-settings-unit");
const valueSpellCheck = LocalStorage.getBool("de-mobile-spellcheck");
const valueNoCharacters = LocalStorage.getBool("de-mobile-no-characters");
const valueHiddenBorders = LocalStorage.getBool("de-mobile-hidden-borders");
const valueMacrosMode = LocalStorage.getItem("de-mobile-macros-mode");
if(typeof valueViewComments !== 'undefined') {
this.props.storeApplicationSettings.changeDisplayComments(valueViewComments);
this.props.storeAppOptions.changeCanViewComments(valueViewComments);
}
typeof valueResolvedComments !== 'undefined' && this.props.storeApplicationSettings.changeDisplayResolved(valueResolvedComments);
typeof valueUnitMeasurement !== 'undefined' && this.props.storeApplicationSettings.changeUnitMeasurement(valueUnitMeasurement);
typeof valueSpellCheck !== 'undefined' && this.props.storeApplicationSettings.changeSpellCheck(valueSpellCheck);
typeof valueNoCharacters !== 'undefined' && this.props.storeApplicationSettings.changeNoCharacters(valueNoCharacters);
typeof valueHiddenBorders !== 'undefined' && this.props.storeApplicationSettings.changeShowTableEmptyLine(valueHiddenBorders);
typeof valueMacrosMode !== 'undefined' && this.props.storeApplicationSettings.changeMacrosSettings(valueMacrosMode);
this.props.storeApplicationSettings.changeUnitMeasurement(Common.Utils.Metric.getCurrentMetric());
}
setUnitMeasurement(value) {

View file

@ -6,14 +6,7 @@ import {observer, inject} from "mobx-react";
class ApplicationSettingsController extends Component {
constructor(props) {
super(props);
const valueUnitMeasurement = LocalStorage.getItem("pe-mobile-settings-unit");
const valueSpellCheck = LocalStorage.getBool("pe-mobile-spellcheck");
const valueMacrosMode = LocalStorage.getItem("pe-mobile-macros-mode");
typeof valueUnitMeasurement !== 'undefined' && this.props.storeApplicationSettings.changeUnitMeasurement(valueUnitMeasurement);
typeof valueSpellCheck !== 'undefined' && this.props.storeApplicationSettings.changeSpellCheck(valueSpellCheck);
typeof valueMacrosMode !== 'undefined' && this.props.storeApplicationSettings.changeMacrosSettings(valueMacrosMode);
this.props.storeApplicationSettings.changeUnitMeasurement(Common.Utils.Metric.getCurrentMetric());
}
setUnitMeasurement(value) {

View file

@ -12,22 +12,7 @@ class ApplicationSettingsController extends Component {
this.initRegSettings = this.initRegSettings.bind(this);
this.props.storeApplicationSettings.initRegData();
this.initRegSettings();
const valueViewComments = LocalStorage.getBool("sse-mobile-settings-livecomment");
const valueResolvedComments = LocalStorage.getBool("sse-settings-resolvedcomment");
const valueUnitMeasurement = LocalStorage.getItem("sse-mobile-settings-unit");
const valueRefStyle = LocalStorage.getBool('sse-settings-r1c1');
const valueMacrosMode = LocalStorage.getItem("sse-mobile-macros-mode");
if(typeof valueViewComments !== 'undefined') {
this.props.storeApplicationSettings.changeDisplayComments(valueViewComments);
this.props.storeAppOptions.changeCanViewComments(valueViewComments);
}
typeof valueResolvedComments !== 'undefined' && this.props.storeApplicationSettings.changeDisplayResolved(valueResolvedComments);
typeof valueUnitMeasurement !== 'undefined' && this.props.storeApplicationSettings.changeUnitMeasurement(valueUnitMeasurement);
typeof valueRefStyle !== 'undefined' && this.props.storeApplicationSettings.changeRefStyle(valueRefStyle);
typeof valueMacrosMode !== 'undefined' && this.props.storeApplicationSettings.changeMacrosSettings(valueMacrosMode);
this.props.storeApplicationSettings.changeUnitMeasurement(Common.Utils.Metric.getCurrentMetric());
}
initRegSettings() {