Merge pull request #76 from esteemapp/pin-code

Completed pin code feature, added root component
This commit is contained in:
Feruz M 2018-10-30 21:09:50 +05:30 committed by GitHub
commit ea2cb9f3be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 291 additions and 90 deletions

84
package-lock.json generated
View File

@ -1507,7 +1507,7 @@
"dependencies": {
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"requires": {
"ansi-styles": "^2.2.1",
@ -1700,7 +1700,7 @@
},
"babel-plugin-istanbul": {
"version": "4.1.6",
"resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz",
"resolved": "http://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz",
"integrity": "sha512-PWP9FQ1AhZhS01T/4qLSKoHGY/xvkZdVBGlKM/HuxxS3+sC66HhTNR7+MpbO/so/cz/wY94MeSWJuP1hXIPfwQ==",
"dev": true,
"requires": {
@ -1733,7 +1733,7 @@
},
"babel-plugin-syntax-object-rest-spread": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz",
"resolved": "http://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz",
"integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U="
},
"babel-plugin-syntax-trailing-function-commas": {
@ -2286,7 +2286,7 @@
},
"browserify-aes": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
"resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
"integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==",
"requires": {
"buffer-xor": "^1.0.3",
@ -2530,7 +2530,7 @@
"dependencies": {
"slice-ansi": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz",
"resolved": "http://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz",
"integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=",
"dev": true
},
@ -2595,7 +2595,7 @@
},
"color": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/color/-/color-1.0.3.tgz",
"resolved": "http://registry.npmjs.org/color/-/color-1.0.3.tgz",
"integrity": "sha1-5I6DLYXxTvaU+0aIEcLVz+cptV0=",
"requires": {
"color-convert": "^1.8.2",
@ -2743,7 +2743,7 @@
},
"core-js": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz",
"resolved": "http://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz",
"integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY="
},
"core-util-is": {
@ -2774,7 +2774,7 @@
},
"create-hash": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
"resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
"integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==",
"requires": {
"cipher-base": "^1.0.1",
@ -2786,7 +2786,7 @@
},
"create-hmac": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
"resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
"integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==",
"requires": {
"cipher-base": "^1.0.3",
@ -3188,7 +3188,7 @@
"dependencies": {
"domelementtype": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz",
"resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz",
"integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs="
}
}
@ -3200,7 +3200,7 @@
},
"domelementtype": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz",
"resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz",
"integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI="
},
"domexception": {
@ -3851,7 +3851,7 @@
},
"events": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz",
"resolved": "http://registry.npmjs.org/events/-/events-1.1.1.tgz",
"integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ="
},
"evp_bytestokey": {
@ -3953,7 +3953,7 @@
},
"external-editor": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz",
"resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz",
"integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==",
"requires": {
"chardet": "^0.4.0",
@ -3986,7 +3986,7 @@
},
"fast-deep-equal": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
"resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
},
"fast-json-stable-stringify": {
@ -4829,7 +4829,7 @@
},
"get-stream": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
"resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
"integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ="
},
"get-value": {
@ -5345,7 +5345,7 @@
},
"is-builtin-module": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
"resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
"integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=",
"requires": {
"builtin-modules": "^1.0.0"
@ -5490,7 +5490,7 @@
},
"is-obj": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
"resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
"integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=",
"dev": true
},
@ -6138,7 +6138,7 @@
},
"jest-get-type": {
"version": "22.4.3",
"resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz",
"resolved": "http://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz",
"integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==",
"dev": true
},
@ -6978,12 +6978,12 @@
},
"json5": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
"resolved": "http://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
"integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE="
},
"jsonfile": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
"resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
"requires": {
"graceful-fs": "^4.1.6"
@ -7533,7 +7533,7 @@
"dependencies": {
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
@ -7579,7 +7579,7 @@
"dependencies": {
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
@ -7629,7 +7629,7 @@
},
"load-json-file": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
"resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
"integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
"requires": {
"graceful-fs": "^4.1.2",
@ -8400,7 +8400,7 @@
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
},
"minipass": {
@ -8448,7 +8448,7 @@
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"requires": {
"minimist": "0.0.8"
@ -8456,7 +8456,7 @@
"dependencies": {
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
}
}
@ -8574,7 +8574,7 @@
},
"react-native-keyboard-aware-scroll-view": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/react-native-keyboard-aware-scroll-view/-/react-native-keyboard-aware-scroll-view-0.5.0.tgz",
"resolved": "http://registry.npmjs.org/react-native-keyboard-aware-scroll-view/-/react-native-keyboard-aware-scroll-view-0.5.0.tgz",
"integrity": "sha512-nGXsACZBCiWuwRrZy+UjiSJqb4tZ/6ePHUSY8M+09g4VfNm/ogvvWpwBa6B999NZ6DwhZTKBjVWeZxX9XG8bbQ==",
"requires": {
"prop-types": "^15.6.0",
@ -8978,7 +8978,7 @@
"dependencies": {
"minimist": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
"integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8="
},
"wordwrap": {
@ -9169,7 +9169,7 @@
},
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
},
"pinkie": {
@ -9393,7 +9393,7 @@
},
"espree": {
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz",
"resolved": "http://registry.npmjs.org/espree/-/espree-3.5.4.tgz",
"integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==",
"dev": true,
"requires": {
@ -9431,7 +9431,7 @@
},
"regexpp": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-1.1.0.tgz",
"resolved": "http://registry.npmjs.org/regexpp/-/regexpp-1.1.0.tgz",
"integrity": "sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw==",
"dev": true
},
@ -9978,7 +9978,7 @@
},
"react-native-vector-icons": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/react-native-vector-icons/-/react-native-vector-icons-4.6.0.tgz",
"resolved": "http://registry.npmjs.org/react-native-vector-icons/-/react-native-vector-icons-4.6.0.tgz",
"integrity": "sha512-rpfhfPiXCK2PX1nrNhdxSMrEGB/Gw/SvKoPM0G2wAkSoqynnes19K0VYI+Up7DqR1rFIpE4hP2erpT1tNx2tfg==",
"requires": {
"lodash": "^4.0.0",
@ -10152,7 +10152,7 @@
},
"readable-stream": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"requires": {
"core-util-is": "~1.0.0",
@ -10603,7 +10603,7 @@
},
"safe-regex": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
"resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
"integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
"requires": {
"ret": "~0.1.10"
@ -11043,7 +11043,7 @@
},
"sha.js": {
"version": "2.4.11",
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
"resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
"requires": {
"inherits": "^2.0.1",
@ -11558,7 +11558,7 @@
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"requires": {
"ansi-regex": "^2.0.0"
@ -11579,7 +11579,7 @@
},
"strip-eof": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
"resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
},
"strip-json-comments": {
@ -11758,7 +11758,7 @@
},
"load-json-file": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
"dev": true,
"requires": {
@ -11873,7 +11873,7 @@
},
"through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
},
"through2": {
@ -12157,7 +12157,7 @@
},
"underscore.string": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz",
"resolved": "http://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz",
"integrity": "sha1-jN2PusTi0uoefi6Al8QvRCKA+Fs="
},
"unicode-canonical-property-names-ecmascript": {
@ -12399,7 +12399,7 @@
},
"espree": {
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz",
"resolved": "http://registry.npmjs.org/espree/-/espree-3.5.4.tgz",
"integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==",
"dev": true,
"requires": {
@ -12506,7 +12506,7 @@
},
"wrap-ansi": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
"requires": {
"string-width": "^1.0.1",

View File

@ -64,8 +64,8 @@ class HeaderView extends Component {
</TouchableOpacity>
<View style={styles.titleWrapper}>
{name && <Text style={styles.title}>{name}</Text>}
{userName
&& reputation && (
{userName !== undefined
&& reputation !== undefined && (
<Text style={styles.subTitle}>
@
{userName}

View File

@ -8,6 +8,7 @@ import { CircularButton, TextButton, IconButton } from './buttons';
import { NumericKeyboard } from './numericKeyboard';
import { PinAnimatedInput } from './pinAnimatedInput';
import { SideMenu } from './sideMenu';
import Modal from './modal';
export {
Logo,
@ -22,4 +23,5 @@ export {
NumericKeyboard,
PinAnimatedInput,
SideMenu,
Modal,
};

View File

@ -0,0 +1,3 @@
import ModalView from './view/modalView';
export default ModalView;

View File

@ -0,0 +1,18 @@
import EStyleSheet from 'react-native-extended-stylesheet';
export default EStyleSheet.create({
centerModal: {
height: 175,
width: 275,
borderRadius: 20,
},
fullModal: {
height: '$deviceHeight',
width: '$deviceWidth',
flex: 1,
},
borderTopRadius: {
borderTopLeftRadius: 10,
borderTopRightRadius: 10,
},
});

View File

@ -0,0 +1,53 @@
import React, { Component } from 'react';
import { Modal as ModalBox } from 'react-native';
import styles from './modalStyles';
/*
* Props Name Description Value
*@props --> fullModal For modal size all screen or quick modal Boolean
*@props --> isOpen For modal is open or not Boolean
*
*/
export default class Modal extends Component {
constructor(props) {
super(props);
this.state = {};
}
_handleOnOpen = () => {
const { handleOnModalOpen } = this.props;
if (handleOnModalOpen) {
handleOnModalOpen();
}
};
_handleOnClose = () => {
const { handleOnModalClose } = this.props;
if (handleOnModalClose) {
handleOnModalClose();
}
};
render() {
const {
isFullScreen, isOpen, children, isRadius,
} = this.props;
return (
<ModalBox
style={[
isRadius && styles.borderTopRadius,
isFullScreen ? styles.fullModal : styles.centerModal,
]}
animationType="fade"
visible={isOpen}
onRequestClose={() => this._handleOnClose(this)}
onShow={() => this._handleOnOpen(this)}
{...this.props}
>
{children}
</ModalBox>
);
}
}

View File

@ -1,6 +1,6 @@
import React, { Component, Fragment } from 'react';
import {
FlatList, View, ActivityIndicator, AppState,
FlatList, View, ActivityIndicator,
} from 'react-native';
// import Placeholder from 'rn-placeholder';
@ -28,13 +28,11 @@ class PostsView extends Component {
startPermlink: '',
refreshing: false,
isLoading: false,
appState: AppState.currentState,
};
}
componentDidMount() {
this._loadPosts(this.state.user);
AppState.addEventListener('change', this._handleAppStateChange);
}
componentWillReceiveProps(nextProps) {
@ -47,16 +45,6 @@ class PostsView extends Component {
}
}
componentWillUnmount() {
AppState.removeEventListener('change', this._handleAppStateChange);
}
_handleAppStateChange = (nextAppState) => {
if (this.state.appState.match(/inactive|background/) && nextAppState === 'active') {
alert('App has come to the foreground!');
}
this.setState({ appState: nextAppState });
};
_loadPosts = (user, _tag = null) => {
const { getFor, tag } = this.props;

View File

@ -4,7 +4,7 @@ import { default as ROUTES } from '../constants/routeNames';
// Screens
import {
Splash, Login, PinCode, SteemConnect, Editor, Profile,
Splash, Login, PinCode, SteemConnect, Editor, Profile, RootComponent,
} from '../screens';
// Components
@ -51,9 +51,11 @@ const stackNavigatior = createStackNavigator(
);
export default SwitchNavigator({
stackNavigatior,
[ROUTES.SCREENS.LOGIN]: { screen: Login },
[ROUTES.SCREENS.PINCODE]: { screen: PinCode },
[ROUTES.SCREENS.SPLASH]: { screen: Splash },
[ROUTES.SCREENS.STEEM_CONNECT]: { screen: SteemConnect },
[ROUTES.DRAWER.MAIN]: mainNavigation,
[ROUTES.SCREENS.LOGIN]: { screen: RootComponent()(Login) },
[ROUTES.SCREENS.EDITOR]: { screen: RootComponent()(Editor) },
[ROUTES.SCREENS.PINCODE]: { screen: RootComponent()(PinCode) },
[ROUTES.SCREENS.PROFILE]: { screen: RootComponent()(Profile) },
[ROUTES.SCREENS.SPLASH]: { screen: RootComponent()(Splash) },
[ROUTES.SCREENS.STEEM_CONNECT]: { screen: RootComponent()(SteemConnect) },
});

View File

@ -1,20 +1,22 @@
import React from 'react';
import { createBottomTabNavigator } from 'react-navigation';
import Icon from 'react-native-vector-icons/FontAwesome';
import { Home, Notification, Profile } from '../screens';
import {
Home, Notification, Profile, RootComponent,
} from '../screens';
import { PostButton } from '../components/postButton';
const BaseNavigator = createBottomTabNavigator(
{
Home: {
screen: Home,
screen: RootComponent()(Home),
navigationOptions: () => ({
tabBarIcon: ({ tintColor }) => <Icon name="list" color={tintColor} size={18} />,
}),
},
Notification: {
screen: Notification,
screen: RootComponent()(Notification),
navigationOptions: () => ({
tabBarIcon: ({ tintColor }) => <Icon name="bell-o" color={tintColor} size={18} />,
}),
@ -26,13 +28,13 @@ const BaseNavigator = createBottomTabNavigator(
}),
},
AuthorProfile: {
screen: Profile,
screen: RootComponent()(Profile),
navigationOptions: () => ({
tabBarIcon: ({ tintColor }) => <Icon name="envelope-o" color={tintColor} size={18} />,
}),
},
Profile: {
screen: Profile,
screen: RootComponent()(Profile),
navigationOptions: () => ({
tabBarIcon: ({ tintColor }) => <Icon name="credit-card" color={tintColor} size={18} />,
}),

View File

@ -199,9 +199,16 @@ export const verifyPinCode = async (data) => {
const authData = {
isLoggedIn: true,
};
const response = {
accessToken: decryptKey(userData.accessToken, data.pinCode),
postingKey: decryptKey(userData.postingKey, data.pinCode),
masterKey: decryptKey(userData.masterKey, data.pinCode),
activeKey: decryptKey(userData.activeKey, data.pinCode),
memoKey: decryptKey(userData.memoKey, data.pinCode),
};
setAuthStatus(authData)
.then(() => {
resolve();
resolve(response);
})
.catch((error) => {
// TODO: create function for throw error

View File

@ -1,4 +1,6 @@
import { LOGIN, LOGOUT } from '../constants/constants';
import {
LOGIN, LOGOUT, OPEN_PIN_CODE_MODAL, CLOSE_PIN_CODE_MODAL,
} from '../constants/constants';
export const login = () => ({
type: LOGIN,
@ -7,3 +9,11 @@ export const login = () => ({
export const logout = () => ({
type: LOGOUT,
});
export const openPinCodeModal = () => ({
type: OPEN_PIN_CODE_MODAL,
});
export const closePinCodeModal = () => ({
type: CLOSE_PIN_CODE_MODAL,
});

View File

@ -15,3 +15,5 @@ export const FETCHING_ACCOUNT = 'FETCHING_ACCOUNT';
export const FETCH_ACCOUNT_FAIL = 'FETCH_ACCOUNT_FAIL';
export const IS_LOGGED_IN = 'IS_LOGGED_IN';
export const OPEN_PIN_CODE_MODAL = 'OPEN_PIN_CODE_MODAL';
export const CLOSE_PIN_CODE_MODAL = 'CLOSE_PIN_CODE_MODAL';

View File

@ -1,8 +1,11 @@
import { LOGIN, LOGOUT } from '../constants/constants';
import {
LOGIN, LOGOUT, OPEN_PIN_CODE_MODAL, CLOSE_PIN_CODE_MODAL,
} from '../constants/constants';
const initialState = {
isLoggedIn: false, // Has any logged in user.
loading: false, // It is lock to all screen and shows loading animation.
isPinCodeReqiure: false,
};
export default function (state = initialState, action) {
@ -17,7 +20,16 @@ export default function (state = initialState, action) {
...state,
isLoggedIn: false,
};
case OPEN_PIN_CODE_MODAL:
return {
...state,
isPinCodeReqiure: true,
};
case CLOSE_PIN_CODE_MODAL:
return {
...state,
isPinCodeReqiure: false,
};
default:
return state;
}

View File

@ -6,6 +6,7 @@ import { Login } from './login';
import { Notification } from './notification';
import SteemConnect from './steem-connect/steemConnect';
import { Profile } from './profile';
import RootComponent from './root';
// import Author from './authorProfile';
// import SideMenu from './sideMenuScreen';
@ -28,6 +29,7 @@ export {
Profile,
SteemConnect,
Splash,
RootComponent,
// Author,
// SideMenu,
// Hot,

View File

@ -4,11 +4,12 @@ import {
} from 'react-native';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view';
import { connect } from 'react-redux';
// Actions
import { addPassiveAccount, failedAccount } from '../../../redux/actions/accountAction';
import {
login as loginAction,
login as loginAction, openPinCodeModal,
} from '../../../redux/actions/applicationActions';
// Internal Components
@ -42,7 +43,7 @@ class LoginScreen extends Component {
}
_handleOnPressLogin = () => {
const { dispatch, navigation } = this.props;
const { dispatch, setPinCodeState } = this.props;
const { password, username } = this.state;
this.setState({ isLoading: true });
@ -52,7 +53,8 @@ class LoginScreen extends Component {
if (result) {
dispatch(addPassiveAccount(result));
dispatch(loginAction());
navigation.navigate(ROUTES.SCREENS.PINCODE);
dispatch(openPinCodeModal());
setPinCodeState({ navigateTo: ROUTES.DRAWER.MAIN });
}
})
.catch((err) => {
@ -180,4 +182,4 @@ class LoginScreen extends Component {
}
}
export default LoginScreen;
export default connect()(LoginScreen);

View File

@ -4,9 +4,11 @@ import { connect } from 'react-redux';
import { setUserDataWithPinCode, verifyPinCode } from '../../../providers/steem/auth';
// Actions
import { closePinCodeModal } from '../../../redux/actions/applicationActions';
// Constants
import { default as INITIAL } from '../../../constants/initial';
import { default as ROUTES } from '../../../constants/routeNames';
import { PinCodeScreen } from '..';
@ -49,7 +51,11 @@ class PinCodeContainer extends Component {
_setPinCode = pin => new Promise((resolve, reject) => {
const {
currentAccount: { password, name },
currentAccount,
dispatch,
accessToken,
setWrappedComponentState,
navigateTo,
navigation,
} = this.props;
const { isExistUser, pinCode } = this.state;
@ -57,14 +63,17 @@ class PinCodeContainer extends Component {
// If the user is exist, we are just checking to pin and navigating to home screen
const pinData = {
pinCode: pin,
password,
username: name,
accessToken: navigation.getParam('accessToken', ''),
password: currentAccount ? currentAccount.password : '',
username: currentAccount ? currentAccount.name : '',
accessToken,
};
verifyPinCode(pinData)
.then(() => {
// TODO: make global route
navigation.navigate(ROUTES.DRAWER.MAIN);
.then((res) => {
setWrappedComponentState(res);
dispatch(closePinCodeModal());
if (navigateTo) {
navigation.navigate(navigateTo);
}
})
.catch((err) => {
alert(err);
@ -80,12 +89,15 @@ class PinCodeContainer extends Component {
} else if (pinCode === pin) {
const pinData = {
pinCode: pin,
password,
username: name,
password: currentAccount.password,
username: currentAccount.name,
};
setUserDataWithPinCode(pinData).then(() => {
AsyncStorage.setItem(INITIAL.IS_EXIST_USER, JSON.stringify(true), () => {
navigation.navigate(ROUTES.DRAWER.MAIN);
dispatch(closePinCodeModal());
if (navigateTo) {
navigation.navigate(navigateTo);
}
resolve();
});
});

View File

@ -0,0 +1,82 @@
import React, { Component, Fragment } from 'react';
import { AppState } from 'react-native';
import { connect } from 'react-redux';
// Actions
import { openPinCodeModal } from '../../../redux/actions/applicationActions';
// Components
import { Modal } from '../../../components';
import { PinCode } from '../..';
const RootContainer = () => (WrappedComponent) => {
class RootComponent extends Component {
constructor(props) {
super(props);
this.state = {
pinCodeStates: null,
wrappedComponentStates: null,
appState: AppState.currentState,
};
}
componentDidMount() {
AppState.addEventListener('change', this._handleAppStateChange);
}
componentWillUnmount() {
AppState.removeEventListener('change', this._handleAppStateChange);
}
_handleAppStateChange = (nextAppState) => {
const { appState } = this.state;
const { dispatch } = this.props;
if (appState.match(/inactive|background/) && nextAppState === 'active') {
dispatch(openPinCodeModal());
}
this.setState({ appState: nextAppState });
};
_setPinCodeState = (data) => {
this.setState({ pinCodeStates: { ...data } });
};
_setWrappedComponentState = (data) => {
this.setState({ wrappedComponentStates: { ...data } });
};
render() {
const { isPinCodeReqiure, navigation } = this.props;
const { pinCodeStates, wrappedComponentStates } = this.state;
return (
<Fragment>
<Modal
isOpen={isPinCodeReqiure}
isFullScreen
swipeToClose={false}
backButtonClose={false}
>
<PinCode
{...pinCodeStates}
setWrappedComponentState={this._setWrappedComponentState}
navigation={navigation}
/>
</Modal>
<WrappedComponent
{...this.props}
{...wrappedComponentStates}
setPinCodeState={this._setPinCodeState}
/>
</Fragment>
);
}
}
const mapStateToProps = state => ({
isPinCodeReqiure: state.application.isPinCodeReqiure,
});
return connect(mapStateToProps)(RootComponent);
};
export default RootContainer;

View File

@ -0,0 +1,3 @@
import RootContainer from './container/rootContainer';
export default RootContainer;

View File

@ -7,7 +7,7 @@ import { steemConnectOptions } from './config';
// Actions
import { addPassiveAccount } from '../../redux/actions/accountAction';
import { login as loginAction } from '../../redux/actions/applicationActions';
import { login as loginAction, openPinCodeModal } from '../../redux/actions/applicationActions';
// Constants
import { default as ROUTES } from '../../constants/routeNames';
@ -22,7 +22,7 @@ class SteemConnect extends Component {
onNavigationStateChange(event) {
let accessToken;
const { navigation, dispatch } = this.props;
const { dispatch, setPinCodeState } = this.props;
const { isLoading } = this.state;
if (event.url.indexOf('?access_token=') > -1) {
@ -39,7 +39,8 @@ class SteemConnect extends Component {
if (result) {
dispatch(addPassiveAccount(result));
dispatch(loginAction());
navigation.navigate(ROUTES.SCREENS.PINCODE, { accessToken });
dispatch(openPinCodeModal());
setPinCodeState({ accessToken, navigateTo: ROUTES.DRAWER.MAIN });
} else {
// TODO: Error alert (Toast Message)
}