diff --git a/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx b/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx index 388ea1ab7..3a4ce7af5 100644 --- a/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx +++ b/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx @@ -1,11 +1,32 @@ import React, { Component } from "react"; import { ApplicationSettings } from "../../view/settings/ApplicationSettings"; import { LocalStorage } from '../../../../../common/mobile/utils/LocalStorage'; +import {observer, inject} from "mobx-react"; 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); } setUnitMeasurement(value) { @@ -34,6 +55,8 @@ class ApplicationSettingsController extends Component { switchDisplayComments(value) { const api = Common.EditorApi.get(); + this.props.storeAppOptions.changeCanViewComments(value); + if (!value) { api.asc_hideComments(); this.switchDisplayResolved(value); @@ -42,6 +65,7 @@ class ApplicationSettingsController extends Component { const resolved = LocalStorage.getBool("de-settings-resolvedcomment"); api.asc_showComments(resolved); } + LocalStorage.setBool("de-mobile-settings-livecomment", value); } @@ -73,4 +97,4 @@ class ApplicationSettingsController extends Component { } -export default ApplicationSettingsController; \ No newline at end of file +export default inject("storeAppOptions", "storeApplicationSettings")(observer(ApplicationSettingsController)); \ No newline at end of file diff --git a/apps/documenteditor/mobile/src/store/appOptions.js b/apps/documenteditor/mobile/src/store/appOptions.js index d22f062ce..98486a1df 100644 --- a/apps/documenteditor/mobile/src/store/appOptions.js +++ b/apps/documenteditor/mobile/src/store/appOptions.js @@ -27,7 +27,12 @@ export class storeAppOptions { } isEdit = false; + canViewComments = false; + changeCanViewComments(value) { + this.canViewComments = value; + } + canReview = false; canViewReview = false; diff --git a/apps/documenteditor/mobile/src/store/applicationSettings.js b/apps/documenteditor/mobile/src/store/applicationSettings.js index 9fea1a4f0..0cc34353f 100644 --- a/apps/documenteditor/mobile/src/store/applicationSettings.js +++ b/apps/documenteditor/mobile/src/store/applicationSettings.js @@ -1,4 +1,5 @@ import {makeObservable, action, observable} from 'mobx'; +import { LocalStorage } from '../../../../common/mobile/utils/LocalStorage'; export class storeApplicationSettings { constructor() { @@ -24,8 +25,8 @@ export class storeApplicationSettings { isSpellChecking = true; isNonprintingCharacters = false; isHiddenTableBorders = false; - isComments = true; - isResolvedComments = true; + isComments = false; + isResolvedComments = false; macrosMode = 0; changeUnitMeasurement(value) { diff --git a/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx b/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx index 1704fee0c..2ab0a9080 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx @@ -1,15 +1,33 @@ import React, { Component } from "react"; import { ApplicationSettings } from "../../view/settings/ApplicationSettings"; import {observer, inject} from "mobx-react"; +import { LocalStorage } from '../../../../../common/mobile/utils/LocalStorage'; class ApplicationSettingsController extends Component { constructor(props) { super(props); this.onFormulaLangChange = this.onFormulaLangChange.bind(this); + this.onChangeDisplayComments = this.onChangeDisplayComments.bind(this); this.onRegSettings = this.onRegSettings.bind(this); 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); } initRegSettings() { @@ -32,54 +50,54 @@ class ApplicationSettingsController extends Component { onChangeDisplayComments(displayComments) { const api = Common.EditorApi.get(); + this.props.storeAppOptions.changeCanViewComments(displayComments); if (!displayComments) { api.asc_hideComments(); - Common.localStorage.setBool("sse-settings-resolvedcomment", false); + LocalStorage.setBool("sse-settings-resolvedcomment", false); } else { - let resolved = Common.localStorage.getBool("sse-settings-resolvedcomment"); + let resolved = LocalStorage.getBool("sse-settings-resolvedcomment"); api.asc_showComments(resolved); } - Common.localStorage.setBool("sse-mobile-settings-livecomment", displayComments); + LocalStorage.setBool("sse-mobile-settings-livecomment", displayComments); } onChangeDisplayResolved(value) { const api = Common.EditorApi.get(); - let displayComments = Common.localStorage.getBool("sse-mobile-settings-livecomment"); + let displayComments = LocalStorage.getBool("sse-mobile-settings-livecomment"); if (displayComments) { api.asc_showComments(value); - Common.localStorage.setBool("sse-settings-resolvedcomment", value); + LocalStorage.setBool("sse-settings-resolvedcomment", value); } } clickR1C1Style(checked) { const api = Common.EditorApi.get(); - Common.localStorage.setBool('sse-settings-r1c1', checked); + LocalStorage.setBool('sse-settings-r1c1', checked); api.asc_setR1C1Mode(checked); } unitMeasurementChange(value) { value = value ? +value : Common.Utils.Metric.getDefaultMetric(); Common.Utils.Metric.setCurrentMetric(value); - Common.localStorage.setItem("se-mobile-settings-unit", value); + LocalStorage.setItem("sse-mobile-settings-unit", value); } onChangeMacrosSettings(value) { Common.Utils.InternalSettings.set("sse-mobile-macros-mode", +value); - Common.localStorage.setItem("sse-mobile-macros-mode", +value); + LocalStorage.setItem("sse-mobile-macros-mode", +value); } onFormulaLangChange(value) { - Common.localStorage.setItem("sse-settings-func-lang", value); + LocalStorage.setItem("sse-settings-func-lang", value); this.initRegSettings(); - // SSE.getController('AddFunction').onDocumentReady(); } onRegSettings(regCode) { const api = Common.EditorApi.get(); - Common.localStorage.setItem("sse-settings-regional", regCode); + LocalStorage.setItem("sse-settings-regional", regCode); this.initRegSettings(); if (regCode!==null) api.asc_setLocale(+regCode); } @@ -102,4 +120,4 @@ class ApplicationSettingsController extends Component { } -export default inject("storeApplicationSettings")(observer(ApplicationSettingsController)); \ No newline at end of file +export default inject("storeApplicationSettings", "storeAppOptions")(observer(ApplicationSettingsController)); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/src/store/appOptions.js b/apps/spreadsheeteditor/mobile/src/store/appOptions.js index 33d830d27..6f2043af7 100644 --- a/apps/spreadsheeteditor/mobile/src/store/appOptions.js +++ b/apps/spreadsheeteditor/mobile/src/store/appOptions.js @@ -19,7 +19,11 @@ export class storeAppOptions { isEdit = false; config = {}; + canViewComments = false; + changeCanViewComments(value) { + this.canViewComments = value; + } lostEditingRights = false; changeEditingRights (value) { diff --git a/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx b/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx index 4755b03b0..f3f4ea323 100644 --- a/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx @@ -26,6 +26,10 @@ const PageApplicationSettings = props => { props.unitMeasurementChange(value); }; + console.log(isComments); + console.log(props.storeAppOptions.canViewComments); + + // set mode // const appOptions = props.storeAppOptions; // const _isEdit = appOptions.isEdit; @@ -185,7 +189,7 @@ const PageMacrosSettings = props => { ); }; -const ApplicationSettings = inject("storeApplicationSettings")(observer(PageApplicationSettings)); +const ApplicationSettings = inject("storeApplicationSettings", "storeAppOptions")(observer(PageApplicationSettings)); const MacrosSettings = inject("storeApplicationSettings")(observer(PageMacrosSettings)); const RegionalSettings = inject("storeApplicationSettings")(observer(PageRegionalSettings)); const FormulaLanguage = inject("storeApplicationSettings")(observer(PageFormulaLanguage));