From 5a30ae5cc92fe838ef23ccf3f59f1ccfdc246020 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Tue, 20 Jul 2021 18:09:39 +0300 Subject: [PATCH] [SSE mobile] Correct Encoding --- apps/common/mobile/lib/store/encoding.js | 2 +- .../mobile/src/controller/settings/Download.jsx | 6 ++++-- .../mobile/src/controller/settings/Encoding.jsx | 11 ++++++----- apps/spreadsheeteditor/mobile/src/page/main.jsx | 5 +++-- .../mobile/src/view/settings/Encoding.jsx | 2 +- .../mobile/src/view/settings/Settings.jsx | 4 ++-- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/apps/common/mobile/lib/store/encoding.js b/apps/common/mobile/lib/store/encoding.js index bf69126b6..41ad838d6 100644 --- a/apps/common/mobile/lib/store/encoding.js +++ b/apps/common/mobile/lib/store/encoding.js @@ -25,7 +25,7 @@ export class storeEncoding { } type; - mode; + mode = 1; pages = []; pagesName = []; advOptions; diff --git a/apps/spreadsheeteditor/mobile/src/controller/settings/Download.jsx b/apps/spreadsheeteditor/mobile/src/controller/settings/Download.jsx index b7b8b5ceb..d48a09f94 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/settings/Download.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/settings/Download.jsx @@ -55,12 +55,14 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady storeEncoding.initOptions({type, advOptions, formatOptions}); storeEncoding.initPages(); - storeEncoding.initNamesDelimeter([_t.txtComma, _t.txtSemicolon, _t.txtColon, _t.txtTab, _t.txtSpace]); storeEncoding.setMode(mode); + storeEncoding.initNamesDelimeter([_t.txtComma, _t.txtSemicolon, _t.txtColon, _t.txtTab, _t.txtSpace]); storeEncoding.changeEncoding(recommendedSettings.asc_getCodePage()); storeEncoding.changeDelimeter(recommendedSettings && recommendedSettings.asc_getDelimiter() ? recommendedSettings.asc_getDelimiter() : 4); - f7.views.current.router.navigate('/encoding/'); + if(mode === 2) { + f7.views.current.router.navigate('/encoding/'); + } } // let picker; // const pages = []; diff --git a/apps/spreadsheeteditor/mobile/src/controller/settings/Encoding.jsx b/apps/spreadsheeteditor/mobile/src/controller/settings/Encoding.jsx index 91db33941..17ed1cf0a 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/settings/Encoding.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/settings/Encoding.jsx @@ -12,7 +12,7 @@ class EncodingController extends Component { closeModal() { if (Device.phone) { - f7.sheet.close('.settings-popup', true); + f7.sheet.close('.settings-popup', false); } else { f7.popover.close('#settings-popover'); } @@ -20,15 +20,16 @@ class EncodingController extends Component { onSaveFormat(mode, valueEncoding, valueDelimeter) { const api = Common.EditorApi.get(); - - this.closeModal(); + const storeEncoding = this.props.storeEncoding; if(mode === 2) { - const formatOptions = this.props.storeEncoding.formatOptions; + this.closeModal(); + const formatOptions = storeEncoding.formatOptions; formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CTextOptions(valueEncoding, valueDelimeter)); api.asc_DownloadAs(formatOptions); } else { - const type = this.props.storeEncoding.type; + storeEncoding.setMode(1); + const type = storeEncoding.type; api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(valueEncoding, valueDelimeter)); } } diff --git a/apps/spreadsheeteditor/mobile/src/page/main.jsx b/apps/spreadsheeteditor/mobile/src/page/main.jsx index c8221d3d3..33b61eaf4 100644 --- a/apps/spreadsheeteditor/mobile/src/page/main.jsx +++ b/apps/spreadsheeteditor/mobile/src/page/main.jsx @@ -74,6 +74,7 @@ class MainPage extends Component { const config = appOptions.config; const showLogo = !(appOptions.canBrandingExt && (config.customization && (config.customization.loaderName || config.customization.loaderLogo))); const showPlaceholder = !appOptions.isDocReady && (!config.customization || !(config.customization.loaderName || config.customization.loaderLogo)); + return ( {/* Top Navbar */} @@ -105,7 +106,7 @@ class MainPage extends Component { } { - !this.state.settingsVisible ? null : + !this.state.settingsVisible && this.props.storeEncoding.mode ? null : } { @@ -124,4 +125,4 @@ class MainPage extends Component { } } -export default inject("storeAppOptions")(observer(MainPage)); \ No newline at end of file +export default inject("storeAppOptions", "storeEncoding")(observer(MainPage)); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/src/view/settings/Encoding.jsx b/apps/spreadsheeteditor/mobile/src/view/settings/Encoding.jsx index 2150e6f1e..f7d9b1084 100644 --- a/apps/spreadsheeteditor/mobile/src/view/settings/Encoding.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/settings/Encoding.jsx @@ -15,7 +15,7 @@ const PageEncoding = props => { return ( - + {_t.textDelimeter} diff --git a/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx b/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx index df224fbf1..f5d0fab05 100644 --- a/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx @@ -79,7 +79,7 @@ const routes = [ ]; -const SettingsList = inject("storeAppOptions")(observer(props => { +const SettingsList = inject("storeAppOptions", "storeEncoding")(observer(props => { const { t } = useTranslation(); const _t = t('View.Settings', {returnObjects: true}); const navbar = @@ -138,7 +138,7 @@ const SettingsList = inject("storeAppOptions")(observer(props => { } return ( - + {navbar}