From 6fea7116b624bc5bfecd2395aa5d9e77606c089c Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sat, 29 Jun 2019 00:24:00 +0100 Subject: [PATCH] Mobile: Removed now unneeded Welcome screen --- .../lib/components/screens/notes.js | 3 +- .../lib/components/screens/welcome.js | 64 ------------------- ReactNativeClient/root.js | 21 +++--- 3 files changed, 10 insertions(+), 78 deletions(-) delete mode 100644 ReactNativeClient/lib/components/screens/welcome.js diff --git a/ReactNativeClient/lib/components/screens/notes.js b/ReactNativeClient/lib/components/screens/notes.js index 998687b41..58dc65748 100644 --- a/ReactNativeClient/lib/components/screens/notes.js +++ b/ReactNativeClient/lib/components/screens/notes.js @@ -134,7 +134,8 @@ class NotesScreenComponent extends BaseScreenComponent { Folder.delete(folderId).then(() => { this.props.dispatch({ type: 'NAV_GO', - routeName: 'Welcome', + routeName: 'Notes', + smartFilterId: 'c3176726992c11e9ac940492261af972', }); }).catch((error) => { alert(error.message); diff --git a/ReactNativeClient/lib/components/screens/welcome.js b/ReactNativeClient/lib/components/screens/welcome.js deleted file mode 100644 index 331143b29..000000000 --- a/ReactNativeClient/lib/components/screens/welcome.js +++ /dev/null @@ -1,64 +0,0 @@ -const React = require('react'); const Component = React.Component; -const { View, Text, StyleSheet } = require('react-native'); -const { connect } = require('react-redux'); -const { ScreenHeader } = require('lib/components/screen-header.js'); -const { ActionButton } = require('lib/components/action-button.js'); -const { BaseScreenComponent } = require('lib/components/base-screen.js'); -const { _ } = require('lib/locale.js'); -const { themeStyle } = require('lib/components/global-style.js'); - -class WelcomeScreenComponent extends BaseScreenComponent { - - static navigationOptions(options) { - return { header: null }; - } - - constructor() { - super(); - this.styles_ = {}; - } - - styles() { - const themeId = this.props.theme; - const theme = themeStyle(themeId); - - if (this.styles_[themeId]) return this.styles_[themeId]; - this.styles_ = {}; - - let styles = { - message: { - margin: theme.margin, - fontSize: theme.fontSize, - color: theme.color, - }, - }; - - this.styles_[themeId] = StyleSheet.create(styles); - return this.styles_[themeId]; - } - - render() { - let message = this.props.folders.length ? _('Click on the (+) button to create a new note or notebook. Click on the side menu to access your existing notebooks.') : _('You currently have no notebook. Create one by clicking on (+) button.'); - - return ( - - - {message} - - - ); - } - -} - -const WelcomeScreen = connect( - (state) => { - return { - folders: state.folders, - theme: state.settings.theme, - selectedFolderId: state.selectedFolderId, - }; - } -)(WelcomeScreenComponent) - -module.exports = { WelcomeScreen }; \ No newline at end of file diff --git a/ReactNativeClient/root.js b/ReactNativeClient/root.js index 1811e7834..089fd9be8 100644 --- a/ReactNativeClient/root.js +++ b/ReactNativeClient/root.js @@ -37,7 +37,6 @@ const { ConfigScreen } = require('lib/components/screens/config.js'); const { FolderScreen } = require('lib/components/screens/folder.js'); const { LogScreen } = require('lib/components/screens/log.js'); const { StatusScreen } = require('lib/components/screens/status.js'); -const { WelcomeScreen } = require('lib/components/screens/welcome.js'); const { SearchScreen } = require('lib/components/screens/search.js'); const { OneDriveLoginScreen } = require('lib/components/screens/onedrive-login.js'); const { EncryptionConfigScreen } = require('lib/components/screens/encryption-config.js'); @@ -167,13 +166,15 @@ function historyCanGoBackTo(route, nextRoute) { return true; } +const DEFAULT_ROUTE = { + type: 'NAV_GO', + routeName: 'Notes', + smartFilterId: 'c3176726992c11e9ac940492261af972', +}; + const appDefaultState = Object.assign({}, defaultState, { sideMenuOpenPercent: 0, - route: { - type: 'NAV_GO', - routeName: 'Welcome', - params: {}, - }, + route: DEFAULT_ROUTE, noteSelectionEnabled: false, }); @@ -229,8 +230,6 @@ const appReducer = (state = appDefaultState, action) => { } } - if (action.routeName == 'Welcome') navHistory = []; - //reg.logger().info('Route: ' + currentRouteName + ' => ' + action.routeName); newState = Object.assign({}, state); @@ -500,10 +499,7 @@ async function initialize(dispatch) { }); if (!folder) { - dispatch({ - type: 'NAV_GO', - routeName: 'Welcome', - }); + dispatch(DEFAULT_ROUTE); } else { dispatch({ type: 'NAV_GO', @@ -692,7 +688,6 @@ class AppComponent extends React.Component { const sideMenuContent = ; const appNavInit = { - Welcome: { screen: WelcomeScreen }, Notes: { screen: NotesScreen }, Note: { screen: NoteScreen }, Tags: { screen: TagsScreen },