diff --git a/app/account/index.js b/app/account/index.js new file mode 100644 index 00000000..ec9879a4 --- /dev/null +++ b/app/account/index.js @@ -0,0 +1,3 @@ +// @flow + +export { default as AccountSettings } from './src/appRegistry/AccountSettings'; diff --git a/app/account/package.json b/app/account/package.json new file mode 100644 index 00000000..c9a96b63 --- /dev/null +++ b/app/account/package.json @@ -0,0 +1,12 @@ +{ + "name": "@kiwicom/mobile-account", + "version": "0.0.1", + "private": true, + "main": "index.js", + "dependencies": { + "@kiwicom/mobile-shared": "*" + }, + "peerDependencies": { + "react": "*" + } +} \ No newline at end of file diff --git a/app/account/src/appRegistry/AccountSettings.js b/app/account/src/appRegistry/AccountSettings.js new file mode 100644 index 00000000..cb766184 --- /dev/null +++ b/app/account/src/appRegistry/AccountSettings.js @@ -0,0 +1,18 @@ +// @flow strict + +import * as React from 'react'; +import { WithNativeNavigation, Text, Translation } from '@kiwicom/mobile-shared'; + +type Props = {||}; + +class AccountSettings extends React.Component { + render() { + return ( + + + + ); + } +} + +export default WithNativeNavigation(AccountSettings, 'AccountSettings'); diff --git a/app/core/package.json b/app/core/package.json index 88cc084d..a250073c 100644 --- a/app/core/package.json +++ b/app/core/package.json @@ -12,7 +12,8 @@ "@kiwicom/mobile-shared": "^0", "@kiwicom/mobile-localization": "^0", "@kiwicom/mobile-orbit": "^0", - "@kiwicom/mobile-utils": "^0" + "@kiwicom/mobile-utils": "^0", + "@kiwicom/mobile-account": "^0" }, "peerDependencies": { "react": "^16", diff --git a/app/core/src/navigation/stacks/ProfileStack.js b/app/core/src/navigation/stacks/ProfileStack.js index e43824eb..f875a8bd 100644 --- a/app/core/src/navigation/stacks/ProfileStack.js +++ b/app/core/src/navigation/stacks/ProfileStack.js @@ -2,12 +2,16 @@ import { StackNavigator, StackNavigatorOptions } from '@kiwicom/mobile-navigation'; import ProfileScreen from '@kiwicom/mobile-profile'; +import { AccountSettings } from '@kiwicom/mobile-account'; export default StackNavigator( { Profile: { screen: ProfileScreen, }, + AccountSettings: { + screen: AccountSettings, + }, }, { ...StackNavigatorOptions, diff --git a/app/profile/index.js b/app/profile/index.js index 872a609d..292dd3d8 100644 --- a/app/profile/index.js +++ b/app/profile/index.js @@ -9,6 +9,7 @@ import { StyleSheet, } from '@kiwicom/mobile-shared'; import AsyncStorage from '@react-native-community/async-storage'; +import { withNavigation, type NavigationType } from '@kiwicom/mobile-navigation'; import Login from './components/authentication/Login'; import Logout from './components/authentication/Logout'; @@ -19,7 +20,11 @@ type State = {| isLoggedIn: boolean, |}; -export default class LoginScreen extends React.Component<{||}, State> { +type Props = {| + +navigation: NavigationType, +|}; + +class LoginScreen extends React.Component { state = { isLoggedIn: false, }; @@ -29,12 +34,18 @@ export default class LoginScreen extends React.Component<{||}, State> { const simpleTokenData = await AsyncStorage.getItem('mobile:MMB-Simple-Token'); if (token != null || simpleTokenData != null) { this.setState({ isLoggedIn: true }); + this.navigateToAccountSettings(); } }; onLogin = (token: string) => { AsyncStorage.setItem('mobile:MMB-Token', token); this.setState({ isLoggedIn: true }); + this.navigateToAccountSettings(); + }; + + navigateToAccountSettings = () => { + this.props.navigation.navigate('AccountSettings'); }; onSimpleLogin = (simpleToken: string, bookingId: string) => { @@ -46,6 +57,7 @@ export default class LoginScreen extends React.Component<{||}, State> { }), ); this.setState({ isLoggedIn: true }); + this.navigateToAccountSettings(); }; onLogout = () => { @@ -92,3 +104,5 @@ const styles = StyleSheet.create({ marginTop: 20, }, }); + +export default withNavigation(LoginScreen); diff --git a/app/profile/package.json b/app/profile/package.json index 39e44101..a06c00f9 100644 --- a/app/profile/package.json +++ b/app/profile/package.json @@ -7,7 +7,8 @@ "@kiwicom/mobile-localization": "^0", "@kiwicom/mobile-shared": "^0", "@kiwicom/mobile-orbit": "^0", - "@kiwicom/mobile-relay": "^0" + "@kiwicom/mobile-relay": "^0", + "@kiwicom/mobile-navigation": "^0" }, "peerDependencies": { "react": "^16", diff --git a/packages/navigation/types/Navigation.js b/packages/navigation/types/Navigation.js index ce541405..e561974f 100644 --- a/packages/navigation/types/Navigation.js +++ b/packages/navigation/types/Navigation.js @@ -8,7 +8,8 @@ type CoreStackNavigatorRouteNames = | 'HotelsPackage' | 'NewHotelsPackage' | 'SingleHotelPackage' - | 'MMBPackage'; + | 'MMBPackage' + | 'AccountSettings'; type HotelsStackNavigatorNames = | 'AllHotelsMap'