From 8d251746715a237e3f9176ea62a0eec5037c8c5d Mon Sep 17 00:00:00 2001 From: henrydays Date: Sun, 10 Mar 2019 00:00:54 +0000 Subject: [PATCH 01/20] up --- App/app/App.js | 933 ++++++++--------- App/app/screens/Eventos.js | 68 +- App/app/screens/choosePath.js | 876 ++++++++-------- App/app/store/actions/actionTypes.js | 5 +- App/app/store/actions/api.js | 1447 +++++++++++++------------- App/app/store/actions/index.js | 9 +- App/app/store/reducers/api.js | 352 ++++--- App/package-lock.json | 8 + App/package.json | 1 + 9 files changed, 1853 insertions(+), 1846 deletions(-) diff --git a/App/app/App.js b/App/app/App.js index b4f401ee..06f3ae59 100755 --- a/App/app/App.js +++ b/App/app/App.js @@ -1,555 +1,504 @@ -import React, {Component} from 'react'; +import React, { Component } from "react"; import { - Platform, - StyleSheet, - Text, - View, - StatusBar, - Dimensions, - Image, - ActivityIndicator, - Button, - TouchableHighlight, - Keyboard, - ImageBackground, - LinearGradient, - TouchableOpacity, - TextInput, - NetInfo, - Animated + Platform, + StyleSheet, + Text, + View, + StatusBar, + Dimensions, + Image, + ActivityIndicator, + Button, + TouchableHighlight, + Keyboard, + ImageBackground, + LinearGradient, + TouchableOpacity, + TextInput, + NetInfo, + Animated +} from "react-native"; -} from 'react-native'; +import { bindActionCreators } from "redux"; +import { connect } from "react-redux"; -import {bindActionCreators} from 'redux'; -import {connect} from 'react-redux'; +import QRCodeScanner from "react-native-qrcode-scanner"; +import { UtilStyles } from "./assets/styles"; -import QRCodeScanner from 'react-native-qrcode-scanner'; -import {UtilStyles} from './assets/styles' +import * as Actions from "./store/actions"; -import * as Actions from './store/actions'; - -import {RkButton, RkTheme, RkText, RkTextInput} from 'react-native-ui-kitten'; +import { RkButton, RkTheme, RkText, RkTextInput } from "react-native-ui-kitten"; import Modal from "react-native-modal"; -import Router from './Router' +import Router from "./Router"; -import Icon from "react-native-vector-icons/Ionicons" +import Icon from "react-native-vector-icons/Ionicons"; const SCREEN_HEIGHT = Dimensions.get("window").height; const SCREEN_WIDTH = Dimensions.get("window").width; -import Swiper from 'react-native-swiper'; -var TimerMixin = require('react-timer-mixin'); +import Swiper from "react-native-swiper"; +var TimerMixin = require("react-timer-mixin"); function handleConnectivityChange() { console.log("asdasd"); - } - +} + class App extends Component { handleConnectivityChange = isConnected => { this.setState({ isConnected }); - } - _activate=()=>{ - - this.setState({ isModalVisible: !this.state.isModalVisible}); - this.scanner.reactivate(); - - } - _scanQr=()=>{ - this.props.openScannerLogin() - console.log(this.props.UI_loginScannerActive) - } - _tryLogin=()=>{ - - //console.log(this.state.text) - //this.scanner.reactivate(); - this.props.login(this.state.username, this.state.text); - - - - } - - _toggleModal = () => - this.setState({ isModalVisible: !this.state.isModalVisible }); - - constructor(props) { - - super(props); - - this.state = { - - token: {valid: false}, - tokenData: '', - onHold: true, - logged: false, - isModalVisible: false, - state : {text: ''}, - username:'QR code', - failedAttempt: false, - push:4, - UI_loginScannerActive:false, - userDetails:{username:'', password:''}, - isConnected: true - }; - - } - _print=()=>{ - console.log("hello") - this.setState({push:0}) - } - checkValue=(e)=>{ - console.log("check"+e) - } - _handleConnectionChange = (isConnected) => { - this.props.connectionState(true); - }; - - - componentDidMount() { - this.props.hold(); - NetInfo.isConnected.addEventListener('connectionChange', this.handleConnectivityChange); - - this.setState({isModalVisible: false}) - //verifica se o utilizador tem token guardado - this.props.checkUser(this.props.userDetails); - this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow); - this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide); - - - } - componentWillUnmount() { - NetInfo.isConnected.removeEventListener('connectionChange', this.handleConnectivityChange); - } - - _keyboardDidShow () { - //alert('Keyboard Shown'); - // this.setState({push:0}) - - } - - _keyboardDidHide () { - - //this.setState({push:4}) - - } - onSuccess = (e) => { - - // this.setState({ isModalVisible: !this.state.isModalVisible }); - // this.props.login(e.data, 'f8908cc0'); - this.props.closeLoginQRScan(); - this.setState({username:e.data}) - - console.log("QR code lido"); + }; + _activate = () => { + this.setState({ isModalVisible: !this.state.isModalVisible }); + this.scanner.reactivate(); + }; + _scanQr = () => { + this.props.openScannerLogin(); + console.log(this.props.UI_loginScannerActive); + }; + _tryLogin = () => { + //console.log(this.state.text) + //this.scanner.reactivate(); + this.props.login(this.state.username, this.state.text); + }; + _toggleModal = () => + this.setState({ isModalVisible: !this.state.isModalVisible }); + constructor(props) { + super(props); + this.state = { + token: { valid: false }, + tokenData: "", + onHold: true, + logged: false, + isModalVisible: false, + state: { text: "" }, + username: "QR code", + failedAttempt: false, + push: 4, + UI_loginScannerActive: false, + userDetails: { username: "", password: "" }, + isConnected: true, + modalOpen: false }; + } + _print = () => { + console.log("hello"); + this.setState({ push: 0 }); + }; + checkValue = e => { + console.log("check" + e); + }; + _handleConnectionChange = isConnected => { + this.props.connectionState(true); + }; - render() { - if (!this.state.isConnected) { - return ( - - cenas da vida - - ); - } - if (!this.props.logged && this.props.onHold) { + componentDidMount() { + //this.props.hold(); + NetInfo.isConnected.addEventListener( + "connectionChange", + this.handleConnectivityChange + ); + this.setState({ isModalVisible: false }); + //verifica se o utilizador tem token guardado + this.props.checkUser(this.props.userDetails); + this.keyboardDidShowListener = Keyboard.addListener( + "keyboardDidShow", + this._keyboardDidShow + ); + this.keyboardDidHideListener = Keyboard.addListener( + "keyboardDidHide", + this._keyboardDidHide + ); + } + componentWillUnmount() { + NetInfo.isConnected.removeEventListener( + "connectionChange", + this.handleConnectivityChange + ); + } - return ( - - - - - ) + _keyboardDidShow() { + //alert('Keyboard Shown'); + // this.setState({push:0}) + } - } - else - { + _keyboardDidHide() { + //this.setState({push:4}) + } + onSuccess = e => { + // this.setState({ isModalVisible: !this.state.isModalVisible }); + // this.props.login(e.data, 'f8908cc0'); + this.props.closeLoginQRScan(); + this.setState({ username: e.data }); - // console.log('token... '+ this.props.logged) + console.log("QR code lido"); + }; - //se existir token - - if (this.props.logged ) { - - return ( - - - ) - } - return ( - - - - - - - - - - - - - - - - - - - - - - - - {this.setState({searchString})}} - maxLength={15} - underlineColorAndroid="transparent" - /> - - - - - - Scan QR - - - - - - - this.setState({text})} - clearButtonMode='always' - value={this.state.text} - clearTextOnFocus={true} - onSubmitEditing={Keyboard.dismiss} - placeholder='Password' /> - - Entrar - - - - - - - - - - - - - - - - - - - - - - - Não sabes a password? - - - - Recuperar Password - - - - - - - - - - ); - - } + render() { + if (!this.state.isConnected) { + return ( + + cenas da vida + + ); } + if (!this.props.logged && this.props.onHold) { + return ( + + + + ); + } else { + // console.log('token... '+ this.props.logged) + + //se existir token + + if (this.props.logged) { + return ; + } + return ( + + + + + + + + + + + + + + { + this.setState({ searchString }); + }} + maxLength={15} + underlineColorAndroid="transparent" + /> + + + + Scan QR + + + + + this.setState({ text })} + clearButtonMode="always" + value={this.state.text} + clearTextOnFocus={true} + onSubmitEditing={Keyboard.dismiss} + placeholder="Password" + /> + + + Entrar + + + + + + + + + + + + + + + + + Não sabes a password? + + + + Recuperar Password + + + + + + + ); + } + } } +RkTheme.setType("RkButton", "dark", { + container: { + paddingTop: 10, + backgroundColor: "gray", -RkTheme.setType('RkButton', 'dark', { - container: { - paddingTop: 10, - backgroundColor: 'gray', - - borderRadius: 90, - } + borderRadius: 90 + } }); - const rectDimensions = SCREEN_WIDTH * 0.85; // this is equivalent to 255 from a 393 device width -const overlayColor = 'rgba(0,0,0,0.30)'; +const overlayColor = "rgba(0,0,0,0.30)"; const styles = { - cameraContainer:{ - // height: Dimensions.get('window').height , - }, - passwordInput:{ - borderRadius: 90, - - borderColor:'#bfbdbd', - borderWidth: 1, - marginTop:20, - marginBottom:20, - width:SCREEN_WIDTH*0.8, - - backgroundColor: 'white', + cameraContainer: { + // height: Dimensions.get('window').height , + }, + passwordInput: { + borderRadius: 90, - borderRadius: 90, - height: SCREEN_HEIGHT*0.08, - borderColor:'#bfbdbd', - borderWidth: 1, - paddingLeft:SCREEN_WIDTH*0.05, - - }, - scanQRText:{ + borderColor: "#bfbdbd", + borderWidth: 1, + marginTop: 20, + marginBottom: 20, + width: SCREEN_WIDTH * 0.8, - paddingTop:50 - // paddingTop:20, - + backgroundColor: "white", - }, - scanQR:{ - - //flexDirection: 'row', - paddingTop:5, - backgroundColor:10, - - width:80, - paddingLeft:10, - backgroundColor:'#f24b4b', - borderBottomRightRadius:90, - borderTopRightRadius:90, - height:'100%', - - }, - inputSection: { - - flexDirection: 'row', - backgroundColor: '#fff', - - backgroundColor: 'white', + borderRadius: 90, + height: SCREEN_HEIGHT * 0.08, + borderColor: "#bfbdbd", + borderWidth: 1, + paddingLeft: SCREEN_WIDTH * 0.05 + }, + scanQRText: { + paddingTop: 50 + // paddingTop:20, + }, + scanQR: { + //flexDirection: 'row', + paddingTop: 5, + backgroundColor: 10, - borderRadius: 90, - height: SCREEN_HEIGHT*0.08, - borderColor:'#bfbdbd', - borderWidth: 1, - + width: 80, + paddingLeft: 10, + backgroundColor: "#f24b4b", + borderBottomRightRadius: 90, + borderTopRightRadius: 90, + height: "100%" + }, + inputSection: { + flexDirection: "row", + backgroundColor: "#fff", - }, - searchIcon: { - paddingLeft:10 - }, + backgroundColor: "white", - input: { - - - - flex: 1, - paddingRight: 10, - - - paddingLeft: 0, - paddingLeft:SCREEN_WIDTH*0.05, - color: '#424242', - - }, - textRow:{ - marginBottom:40 - }, - loginContainer:{ - width: '100%', - height: '30%', - justifyContent: 'center', - alignItems: 'center' - }, - loginBtn:{ - marginTop:10, - marginBottom:20, - marginLeft: '25%', - - }, - - button: { - borderWidth:1, - borderColor:'rgba(0,0,0,0.2)', - alignItems:'center', - justifyContent:'center', - width:60, - height:60, - backgroundColor:'#fff', - borderRadius:100, - marginRight: 10, - marginLeft:10 - }, - footer: {}, + borderRadius: 90, + height: SCREEN_HEIGHT * 0.08, + borderColor: "#bfbdbd", + borderWidth: 1 + }, + searchIcon: { + paddingLeft: 10 + }, - buttons: { - flexDirection: 'row', - marginBottom: 24, - marginHorizontal: 24, - marginTop:24, - justifyContent: 'space-around', - - - }, + input: { + flex: 1, + paddingRight: 10, - logoContainer:{ + paddingLeft: 0, + paddingLeft: SCREEN_WIDTH * 0.05, + color: "#424242" + }, + textRow: { + marginBottom: 40 + }, + loginContainer: { + width: "100%", + height: "30%", + justifyContent: "center", + alignItems: "center" + }, + loginBtn: { + marginTop: 10, + marginBottom: 20, + marginLeft: "25%" + }, - width:'100%', - - justifyContent: 'center', - alignItems: 'center', - marginTop:200 + button: { + borderWidth: 1, + borderColor: "rgba(0,0,0,0.2)", + alignItems: "center", + justifyContent: "center", + width: 60, + height: 60, + backgroundColor: "#fff", + borderRadius: 100, + marginRight: 10, + marginLeft: 10 + }, + footer: {}, - }, + buttons: { + flexDirection: "row", + marginBottom: 24, + marginHorizontal: 24, + marginTop: 24, + justifyContent: "space-around" + }, - logo2:{ - - // flex: 1, - // resizeMode: 'contain', - width: 200, height: 200, + logoContainer: { + width: "100%", - }, - wrapper: { - }, - slide1: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - backgroundColor: 'white', - }, - slide2: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - backgroundColor: 'white', - }, - slide3: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - color:'black', - backgroundColor: 'white', - }, - text: { - color: '#fff', - fontSize: 30, - fontWeight: 'bold', - }, - recover: { - paddingTop: 10, - color: "red", - paddingBottom: 10 - }, - manual: {}, + justifyContent: "center", + alignItems: "center", + marginTop: 200 + }, - logo: { + logo2: { + // flex: 1, + // resizeMode: 'contain', + width: 200, + height: 200 + }, + wrapper: {}, + slide1: { + flex: 1, + justifyContent: "center", + alignItems: "center", + backgroundColor: "white" + }, + slide2: { + flex: 1, + justifyContent: "center", + alignItems: "center", + backgroundColor: "white" + }, + slide3: { + flex: 1, + justifyContent: "center", + alignItems: "center", + color: "black", + backgroundColor: "white" + }, + text: { + color: "#fff", + fontSize: 30, + fontWeight: "bold" + }, + recover: { + paddingTop: 10, + color: "red", + paddingBottom: 10 + }, + manual: {}, - height: SCREEN_HEIGHT * 0.35, - width: SCREEN_WIDTH, - backgroundColor: overlayColor, - }, - rectangleContainer: { + logo: { + height: SCREEN_HEIGHT * 0.35, + width: SCREEN_WIDTH, + backgroundColor: overlayColor + }, + rectangleContainer: { + flex: 1, + alignItems: "center", + justifyContent: "center", + backgroundColor: "transparent" + }, - flex: 1, - alignItems: "center", - justifyContent: "center", - backgroundColor: "transparent", + rectangle: { + height: rectDimensions, + width: rectDimensions, + alignItems: "center", + justifyContent: "center", + backgroundColor: "transparent" + }, - }, + topOverlay: { + flex: 1, + backgroundColor: overlayColor, + justifyContent: "center", + alignItems: "center" + }, - rectangle: { + bottomOverlay: { + flex: 1, + height: SCREEN_HEIGHT, + width: SCREEN_WIDTH, + backgroundColor: overlayColor, + paddingBottom: SCREEN_WIDTH * 0.2 + }, - height: rectDimensions, - width: rectDimensions, - alignItems: "center", - justifyContent: "center", - backgroundColor: "transparent" - }, - - topOverlay: { - flex: 1, - backgroundColor: overlayColor, - justifyContent: "center", - alignItems: "center" - }, - - bottomOverlay: { - flex: 1, - height: SCREEN_HEIGHT, - width: SCREEN_WIDTH, - backgroundColor: overlayColor, - paddingBottom: SCREEN_WIDTH * 0.2 - }, - - leftAndRightOverlay: { - height: rectDimensions, - width: SCREEN_WIDTH, - backgroundColor: overlayColor - }, + leftAndRightOverlay: { + height: rectDimensions, + width: SCREEN_WIDTH, + backgroundColor: overlayColor + } }; -RkTheme.setType('RkTextInput', 'frame', { - input: { - backgroundColor: 'white', - marginLeft: 0, - marginHorizontal: 0, - borderRadius: 5 - }, - color: 'gray', - backgroundColor: 'gray', - borderRadius: 10, - container: { - paddingHorizontal: 20 - } - }); - +RkTheme.setType("RkTextInput", "frame", { + input: { + backgroundColor: "white", + marginLeft: 0, + marginHorizontal: 0, + borderRadius: 5 + }, + color: "gray", + backgroundColor: "gray", + borderRadius: 10, + container: { + paddingHorizontal: 20 + } +}); + mapStateToProps = (state, props) => { - - return { - token: state.apiReducer.token, - loggedIn: state.apiReducer.loggedIn, - onHold: state.apiReducer.onHold, - logged: state.apiReducer.logged, - failedAttempt:state.apiReducer.failedAttempt, - UI_loginScannerActive: state.uiReducer.UI_loginScannerActive, - userDetails: state.apiReducer.userDetails, - } + return { + token: state.apiReducer.token, + loggedIn: state.apiReducer.loggedIn, + onHold: state.apiReducer.onHold, + logged: state.apiReducer.logged, + failedAttempt: state.apiReducer.failedAttempt, + UI_loginScannerActive: state.uiReducer.UI_loginScannerActive, + userDetails: state.apiReducer.userDetails, + modalOpen: state.apiReducer.modalOpen, + modalInfo: state.apiReducer.modalInfo, + type: state.apiReducer.type + }; }; -mapDispatchToProps = (dispatch) => { - - return bindActionCreators(Actions, dispatch); +mapDispatchToProps = dispatch => { + return bindActionCreators(Actions, dispatch); }; - -export default connect(mapStateToProps, mapDispatchToProps)(App); \ No newline at end of file +export default connect( + mapStateToProps, + mapDispatchToProps +)(App); diff --git a/App/app/screens/Eventos.js b/App/app/screens/Eventos.js index 9c10e7a8..043d39c4 100644 --- a/App/app/screens/Eventos.js +++ b/App/app/screens/Eventos.js @@ -1,61 +1,47 @@ -import * as React from 'react'; -import { - View, - StyleSheet, - Dimensions, - Text, - Button -} from 'react-native'; -import { TabView, TabBar, SceneMap } from 'react-native-tab-view'; - +import * as React from "react"; +import { View, StyleSheet, Dimensions, Text, Button } from "react-native"; +import { TabView, TabBar, SceneMap } from "react-native-tab-view"; const FirstRoute = () => ( - + ); const SecondRoute = () => ( - + ); - const ThirdRoute = () => ( - + ); const FourthRoute = () => ( - + ); - - - - -export default class Eventos extends React.Component { - +export default class Eventos extends React.Component { state = { - index: 0, - routes: [ - { key: 'first', title: 'Festarola' }, - { key: 'second', title: 'Febrada' }, - { key: 'third', title: 'Rally' }, - { key: 'fourth', title: 'Peddy' }, + index: 0, + routes: [ + { key: "first", title: "Festarola" }, + { key: "second", title: "Febrada" }, + { key: "third", title: "Rally" }, + { key: "fourth", title: "Peddy" } + ] + }; - ], -}; - -render() { - return ( - - - - - - - - - - - - + + + + - - - - {this.setState({searchString})}} - maxLength={15} - underlineColorAndroid="transparent" - /> - - - - - - Scan QR - - - - - - - this.setState({text})} - clearButtonMode='always' - value={this.state.text} - clearTextOnFocus={true} - onSubmitEditing={Keyboard.dismiss} - placeholder='Password' /> - - Entrar + + + + + + - - - - - - - - - - - - - - - - - - - - - Não sabes a password? - - - - Recuperar Password - - - - - - - - - - ); - + + + + + + { + this.setState({searchString}) + }} + maxLength={15} + underlineColorAndroid="transparent" + /> + + + + + + Scan QR + + + + + + + this.setState({text})} + clearButtonMode='always' + value={this.state.text} + clearTextOnFocus={true} + onSubmitEditing={Keyboard.dismiss} + placeholder='Password'/> + + Entrar + + + + + + + + + + + + + + + + + + + + + + + Não sabes a password? + + + + Recuperar Password + + + + + + + + + + ); + } } } @@ -310,161 +308,159 @@ const rectDimensions = SCREEN_WIDTH * 0.85; // this is equivalent to 255 from a const overlayColor = 'rgba(0,0,0,0.30)'; const styles = { - cameraContainer:{ - // height: Dimensions.get('window').height , + cameraContainer: { + // height: Dimensions.get('window').height , }, - passwordInput:{ + passwordInput: { borderRadius: 90, - - borderColor:'#bfbdbd', + + borderColor: '#bfbdbd', borderWidth: 1, - marginTop:20, - marginBottom:20, - width:SCREEN_WIDTH*0.8, - + marginTop: 20, + marginBottom: 20, + width: SCREEN_WIDTH * 0.8, + backgroundColor: 'white', borderRadius: 90, - height: SCREEN_HEIGHT*0.08, - borderColor:'#bfbdbd', + height: SCREEN_HEIGHT * 0.08, + borderColor: '#bfbdbd', borderWidth: 1, - paddingLeft:SCREEN_WIDTH*0.05, - - }, - scanQRText:{ - - paddingTop:50 - // paddingTop:20, - + paddingLeft: SCREEN_WIDTH * 0.05, }, - scanQR:{ - + scanQRText: { + + paddingTop: 50 + // paddingTop:20, + + + }, + scanQR: { + //flexDirection: 'row', - paddingTop:5, - backgroundColor:10, - - width:80, - paddingLeft:10, - backgroundColor:'#f24b4b', - borderBottomRightRadius:90, - borderTopRightRadius:90, - height:'100%', - + paddingTop: 5, + backgroundColor: 10, + + width: 80, + paddingLeft: 10, + backgroundColor: '#f24b4b', + borderBottomRightRadius: 90, + borderTopRightRadius: 90, + height: '100%', + }, inputSection: { - + flexDirection: 'row', backgroundColor: '#fff', - + backgroundColor: 'white', borderRadius: 90, - height: SCREEN_HEIGHT*0.08, - borderColor:'#bfbdbd', + height: SCREEN_HEIGHT * 0.08, + borderColor: '#bfbdbd', borderWidth: 1, - + }, searchIcon: { - paddingLeft:10 + paddingLeft: 10 }, input: { - - - + + flex: 1, paddingRight: 10, - - + + paddingLeft: 0, - paddingLeft:SCREEN_WIDTH*0.05, + paddingLeft: SCREEN_WIDTH * 0.05, color: '#424242', - + }, - textRow:{ - marginBottom:40 + textRow: { + marginBottom: 40 }, - loginContainer:{ + loginContainer: { width: '100%', height: '30%', justifyContent: 'center', alignItems: 'center' }, - loginBtn:{ - marginTop:10, - marginBottom:20, - marginLeft: '25%', - + loginBtn: { + marginTop: 10, + marginBottom: 20, + marginLeft: '25%', + }, - + button: { - borderWidth:1, - borderColor:'rgba(0,0,0,0.2)', - alignItems:'center', - justifyContent:'center', - width:60, - height:60, - backgroundColor:'#fff', - borderRadius:100, - marginRight: 10, - marginLeft:10 - }, + borderWidth: 1, + borderColor: 'rgba(0,0,0,0.2)', + alignItems: 'center', + justifyContent: 'center', + width: 60, + height: 60, + backgroundColor: '#fff', + borderRadius: 100, + marginRight: 10, + marginLeft: 10 + }, footer: {}, buttons: { flexDirection: 'row', marginBottom: 24, marginHorizontal: 24, - marginTop:24, + marginTop: 24, justifyContent: 'space-around', - - - }, - logoContainer:{ - - width:'100%', - - justifyContent: 'center', - alignItems: 'center', - marginTop:200 }, - logo2:{ - - // flex: 1, - // resizeMode: 'contain', + logoContainer: { + + width: '100%', + + justifyContent: 'center', + alignItems: 'center', + marginTop: 200 + + }, + + logo2: { + + // flex: 1, + // resizeMode: 'contain', width: 200, height: 200, }, - wrapper: { - }, + wrapper: {}, slide1: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - backgroundColor: 'white', + flex: 1, + justifyContent: 'center', + alignItems: 'center', + backgroundColor: 'white', }, slide2: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - backgroundColor: 'white', + flex: 1, + justifyContent: 'center', + alignItems: 'center', + backgroundColor: 'white', }, slide3: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - color:'black', - backgroundColor: 'white', + flex: 1, + justifyContent: 'center', + alignItems: 'center', + color: 'black', + backgroundColor: 'white', }, text: { - color: '#fff', - fontSize: 30, - fontWeight: 'bold', + color: '#fff', + fontSize: 30, + fontWeight: 'bold', }, recover: { paddingTop: 10, @@ -520,19 +516,19 @@ const styles = { }; RkTheme.setType('RkTextInput', 'frame', { input: { - backgroundColor: 'white', - marginLeft: 0, - marginHorizontal: 0, - borderRadius: 5 + backgroundColor: 'white', + marginLeft: 0, + marginHorizontal: 0, + borderRadius: 5 }, color: 'gray', backgroundColor: 'gray', borderRadius: 10, container: { - paddingHorizontal: 20 + paddingHorizontal: 20 } - }); - +}); + mapStateToProps = (state, props) => { return { @@ -540,7 +536,7 @@ mapStateToProps = (state, props) => { loggedIn: state.apiReducer.loggedIn, onHold: state.apiReducer.onHold, logged: state.apiReducer.logged, - failedAttempt:state.apiReducer.failedAttempt, + failedAttempt: state.apiReducer.failedAttempt, UI_loginScannerActive: state.uiReducer.UI_loginScannerActive, userDetails: state.apiReducer.userDetails, } diff --git a/App/app/Router.js b/App/app/Router.js index 74783cfe..cdd6d7c8 100755 --- a/App/app/Router.js +++ b/App/app/Router.js @@ -3,16 +3,23 @@ import { TouchableOpacity, Text, View, - Image + Image, + } from 'react-native'; import { createStackNavigator, createAppContainer, createSwitchNavigator, - createBottomTabNavigator + createBottomTabNavigator, + HeaderBackButton } from 'react-navigation'; import * as Screens from './screens'; +/*Icons*/ +import Icon from "react-native-vector-icons/Ionicons" +import IconF from "react-native-vector-icons/Foundation" +import IconFA from "react-native-vector-icons/FontAwesome5" + import AuthLoadingScreen from './screens/AuthLoading' @@ -25,17 +32,18 @@ import Calendar from './screens/Calendar' import Home from './screens/Home' - -/*Icons*/ -import Icon from "react-native-vector-icons/Ionicons" -import IconF from "react-native-vector-icons/Foundation" -import IconFA from "react-native-vector-icons/FontAwesome5" import Profile from "./screens/Profile"; import editCalendar from './screens/editCalendar'; import choosePath from './screens/choosePath'; import calendarDetail from './screens/calendarDetail'; +const navigationOptions = ({navigation}) => ({ + headerLeft: navigation.goBack(null)}/>, + headerStyle: {backgroundColor: 'transparent', zIndex: 100 }, + +}); + const AppStack = createBottomTabNavigator( { Calendário: { @@ -48,15 +56,15 @@ const AppStack = createBottomTabNavigator( ) }, }, - + 'Jogo do...': { screen: Jogo, navigationOptions: { tabBarIcon: ({tintColor}) => ( - - + + ) }, }, @@ -71,8 +79,8 @@ const AppStack = createBottomTabNavigator( }, }, - - Eventos: { + + Eventos: { screen: Eventos, navigationOptions: { @@ -82,7 +90,7 @@ const AppStack = createBottomTabNavigator( ) }, }, - + Home: { screen: Home, navigationOptions: { @@ -94,7 +102,6 @@ const AppStack = createBottomTabNavigator( }, - }, { initialRouteName: 'Home', @@ -120,51 +127,56 @@ const Stack = createStackNavigator({ return { headerTitle: `${navigation.state.routes[index].routeName}`, headerRight: ( - navigation.navigate('Profile')}> - + navigation.navigate('Profile')}> + editar - + ) } } - else if(navigation.state.routes[index].routeName == 'Calendário'){ + else if (navigation.state.routes[index].routeName == 'Calendário') { return { headerTitle: 'Calendário', headerRight: ( - - navigation.navigate('Edit')}> - FAQ - - + + navigation.navigate('Edit')}> + FAQ + + + + navigation.navigate('choosePath')}> + Escolher + + - navigation.navigate('choosePath')}> - Escolher - - - ) } - } - else if(navigation.state.routes[index].routeName == 'choosePath'){ + } + else if (navigation.state.routes[index].routeName == 'choosePath') { return { headerTitle: 'Calendário', headerRight: ( - - navigation.navigate('Edit')}> - FAQ - - + + navigation.navigate('Edit')}> + FAQ + + + + navigation.navigate('choosePath')}> + Escolher + + - navigation.navigate('choosePath')}> - Escolher - - - ) } - } + } else { return { header: null @@ -175,17 +187,15 @@ const Stack = createStackNavigator({ Profile: { screen: Profile }, - Edit:{ + Edit: { screen: editCalendar }, - choosePath:{ + choosePath: { screen: choosePath }, - calendarDetail:{ - screen:calendarDetail - } - - + calendarDetail: { + screen: calendarDetail, + }, }); @@ -194,7 +204,7 @@ export default createAppContainer(createSwitchNavigator( { AuthLoading: AuthLoadingScreen, App: Stack, - + }, { diff --git a/App/app/components/Nav.js b/App/app/components/Nav.js new file mode 100644 index 00000000..eb06de50 --- /dev/null +++ b/App/app/components/Nav.js @@ -0,0 +1,99 @@ +import React, { Component } from 'react' +import { StyleSheet, Text, View } from 'react-native' +import { Icon } from 'react-native-elements' + +const styles = StyleSheet.create({ + centerRow: { + alignItems: 'flex-start', + backgroundColor: 'transparent', + flex: 3, + flexDirection: 'column', + justifyContent: 'center', + }, + + container: { + backgroundColor: 'transparent', + borderBottomWidth: 0, + elevation: 0, + flexDirection: 'row', + height: 55, + justifyContent: 'center', + left: 0, + marginLeft: 10, + marginRight: 10, + //marginTop: 22, + position: 'absolute', + right: 0, + zIndex: 100, + }, + icon: { + justifyContent: 'flex-start', + marginTop: 2.8, + }, + iconContainer: { + alignSelf: 'center', + }, + leftRow: { + backgroundColor: 'transparent', + flex: 1, + flexDirection: 'row', + justifyContent: 'flex-start', + }, + rightRow: { + alignItems: 'flex-end', + backgroundColor: 'transparent', + flex: 2, + flexDirection: 'row', + justifyContent: 'flex-end', + marginRight: 4, + }, + titleText: { + color: '#000', + fontSize: 24, + fontWeight: '600', + }, + subTitleText: { + color: '#000', + fontSize: 14, + fontWeight: '400', + }, +}); + +class Nav extends Component { + + + render() { + const { navigation, title} = this.props; + + return ( + + + + navigation.goBack(null)} + color= '#000' + iconStyle={styles.icon} + underlayColor="transparent" + underlineColorAndroid="transparent" + containerStyle={styles.iconContainer} + hitSlop={{ top: 15, bottom: 15, left: 15, right: 15 }} + /> + + + + {title} + + + + + + + + ) + } +} + +export default Nav \ No newline at end of file diff --git a/App/app/screens/Calendar.js b/App/app/screens/Calendar.js index bb216504..02c8a0fe 100644 --- a/App/app/screens/Calendar.js +++ b/App/app/screens/Calendar.js @@ -21,7 +21,7 @@ const formatObj = (obj) => { let a = {}; - a.push({}) + a.push({}); return a @@ -44,7 +44,7 @@ class Calendar extends React.Component { index: 0, routes: [ {key: 'first', weekDay: 'sex', day:12}, - {key: 'second', weekDay: 'sab',day:13}, + {key: 'second', weekDay: 'sab', day:13}, {key: 'third', weekDay: 'dom', day:14}, {key: 'fourth', weekDay: 'seg', day:15}, @@ -137,7 +137,7 @@ class Calendar extends React.Component { constructor() { - super() + super(); const archeryImgSource = require('../assets/img/archery.png'); const badmintonImgSource = require('../assets/img/badminton.png'); @@ -209,7 +209,7 @@ class Calendar extends React.Component { - ) + ); const SecondRoute = () => ( diff --git a/App/app/screens/Jogo.js b/App/app/screens/Jogo.js index 6f4666ac..3dc5702b 100644 --- a/App/app/screens/Jogo.js +++ b/App/app/screens/Jogo.js @@ -1,12 +1,12 @@ import React from 'react'; -import { - StyleSheet, - Text, - View, - ImageBackground, - Dimensions, - Button, - TouchableOpacity +import { + StyleSheet, + Text, + View, + ImageBackground, + Dimensions, + Button, + TouchableOpacity } from 'react-native'; import ProgressBarAnimated from 'react-native-progress-bar-animated'; import Modal from "react-native-modal"; @@ -14,7 +14,7 @@ import Modal from "react-native-modal"; import IconF from "react-native-vector-icons/Foundation" import IconFA from "react-native-vector-icons/FontAwesome5" -import { ScrollView } from 'react-native-gesture-handler'; +import {ScrollView} from 'react-native-gesture-handler'; const SCREEN_HEIGHT = Dimensions.get("window").height; @@ -22,646 +22,609 @@ const SCREEN_WIDTH = Dimensions.get("window").width; export default class Jogo extends React.Component { -state = { - progress: 20, - progressWithOnComplete: 0, - progressCustomized: 0, - isModalVisible: false, - } ; + state = { + progress: 20, + progressWithOnComplete: 0, + progressCustomized: 0, + isModalVisible: false, + }; increase = (key, value) => { - this.setState({ - [key]: this.state[key] + value, - }); - } + this.setState({ + [key]: this.state[key] + value, + }); + } - _toggleModal = () =>{ - this.setState({ isModalVisible: !this.state.isModalVisible }); - console.log("assd") - } + _toggleModal = () => { + this.setState({isModalVisible: !this.state.isModalVisible}); + console.log("assd") + } - render() { - - const { navigate } = this.props.navigation; + render() { + + const {navigate} = this.props.navigation; - const progressCustomStyles = { - backgroundColor: 'red', - borderRadius: 0, - borderColor: 'orange', - }; + const progressCustomStyles = { + backgroundColor: 'red', + borderRadius: 0, + borderColor: 'orange', + }; - const barWidth = Dimensions.get('screen').width - 30; + const barWidth = Dimensions.get('screen').width - 30; - + return ( - return ( + + + + + Hello! + + Hide me! + + + + + + + Jogo do ENEI'19 + + + - - - - - - Hello! - - Hide me! - - + + + + + 45 + pontos + + + + Caso tenhas problemas com este processo deves contactar a comissão atravês do email geral. + + + + Não sabes a password? - }> + {this.setState({modalResetPassword:true})}}> Recuperar Password @@ -292,6 +330,26 @@ const styles = { cameraContainer: { height: Dimensions.get('window').height , }, + resetPassword:{ + + borderRadius: 90, + + borderColor: "#bfbdbd", + borderWidth: 1, + margin:20, + marginTop: 60, + marginBottom: 60, + + width: SCREEN_WIDTH * 0.8, + + backgroundColor: "white", + + borderRadius: 90, + height: SCREEN_HEIGHT * 0.08, + borderColor: "#bfbdbd", + borderWidth: 1, + paddingLeft: SCREEN_WIDTH * 0.05 + }, passwordInput: { borderRadius: 90, diff --git a/App/app/screens/choosePath.js b/App/app/screens/choosePath.js index d1e1ef09..9df0550c 100644 --- a/App/app/screens/choosePath.js +++ b/App/app/screens/choosePath.js @@ -325,7 +325,7 @@ class choosePath extends React.Component { {this._verifySession(item[index].Id) && ( { - + this.props.waitChangeGuest() this.props.removeSession( this.props.user, this.props.userDetails.token, @@ -347,7 +347,7 @@ class choosePath extends React.Component { { this.props.getUserInfo(this.props.userDetails.token) - //this.props.waitChangeGuest() + this.props.waitChangeGuest() this.props.signSession( this.props.user, this.props.userDetails.token, diff --git a/App/app/store/actions/api.js b/App/app/store/actions/api.js index c68caaa0..dd1dec31 100644 --- a/App/app/store/actions/api.js +++ b/App/app/store/actions/api.js @@ -294,6 +294,9 @@ export function signSession(user, token, idSession) { //se não existir erro na chamada... .then(a => { if (a.data.Success) { + axios.defaults.headers.common = { + Authorization: `bearer ${token.access_token}` + }; axios .get("/Attendee/AvailableSessions") @@ -315,7 +318,7 @@ export function signSession(user, token, idSession) { "Sucesso", "Inscrição na sessão efectuada com sucesso" ); - + console.log("aqui1") //obter informações pessoais: axios .get("/Attendee/Detail") @@ -324,6 +327,7 @@ export function signSession(user, token, idSession) { alert(error); }) .then(sucess => { + console.log("aqui2") var result = getE(user); dispatch({ type: SIGN_SESSION, @@ -453,7 +457,7 @@ export function changeGuestList(token, guestID) { axios .get(full) .then(function(response) { - console.log(response); + axios.defaults.baseURL = "http://enei2019.uingress.com/internal/api"; axios.defaults.headers.common = { @@ -464,7 +468,9 @@ export function changeGuestList(token, guestID) { .get("/Attendee/AvailableSessions") .then(function(response) { + // handle success + //console.log(response); var cenas = []; @@ -476,11 +482,14 @@ export function changeGuestList(token, guestID) { )(response.data); for (let key in result) { + result[key].option = 0; cenas.push(result[key]); - console.log(); + } + console.log("-.-.-..-.-.-.-.-.-.") console.log(cenas); + console.log("-.-.-..-.-.-.-.-.-.") dispatch({ type: CHANGE_GUEST, sessions: response.data, From c20718bfbadeba7806c44e66bee5c84e0af140cd Mon Sep 17 00:00:00 2001 From: henrydays Date: Tue, 12 Mar 2019 23:27:58 +0000 Subject: [PATCH 14/20] reset --- App/app/App.js | 63 +++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/App/app/App.js b/App/app/App.js index 070e30ab..f55f2fe2 100755 --- a/App/app/App.js +++ b/App/app/App.js @@ -132,6 +132,12 @@ class App extends Component { _toggle=()=>{ this.setState({modalResetPassword:false}) } + //faz call + _reset=()=>{ + //fecha modal + this.setState({modalResetPassword:false}) + //faz call + } _keyboardDidShow() { //alert('Keyboard Shown'); @@ -191,6 +197,8 @@ class App extends Component { isVisible={this.state.modalResetPassword} onBackdropPress={this._toggle} onBackButtonPress={this._toggle} + animationInTiming={1500} + animationOutTiming={1500} > @@ -211,11 +219,11 @@ class App extends Component { /> - Caso tenhas problemas com este processo deves contactar a comissão atravês do email geral. + Caso tenhas problemas com este processo deves contactar a comissão organizadora atravês do email geral. @@ -249,10 +257,10 @@ class App extends Component { - Scan QR + @@ -271,13 +279,11 @@ class App extends Component { placeholder="Password" /> { !this.props.loadingLogin && - - Entrar - + + + Login + + } {this.props.alignItems && @@ -300,8 +306,8 @@ class App extends Component { Não sabes a password? {this.setState({modalResetPassword:true})}}> - - Recuperar Password + + Reset Password @@ -332,7 +338,7 @@ const styles = { }, resetPassword:{ - borderRadius: 90, + borderColor: "#bfbdbd", borderWidth: 1, @@ -344,14 +350,14 @@ const styles = { backgroundColor: "white", - borderRadius: 90, + borderRadius: 3, height: SCREEN_HEIGHT * 0.08, borderColor: "#bfbdbd", borderWidth: 1, paddingLeft: SCREEN_WIDTH * 0.05 }, passwordInput: { - borderRadius: 90, + borderColor: "#bfbdbd", borderWidth: 1, @@ -361,7 +367,7 @@ const styles = { backgroundColor: "white", - borderRadius: 90, + borderRadius: 3, height: SCREEN_HEIGHT * 0.08, borderColor: "#bfbdbd", borderWidth: 1, @@ -373,15 +379,19 @@ const styles = { }, scanQR: { //flexDirection: 'row', - paddingTop: 5, + flex:1, +//paddingTop: 5, backgroundColor: 10, + alignItems:'center', + padding:5, + paddingRight:15, - width: 80, - paddingLeft: 10, - backgroundColor: "#f24b4b", - borderBottomRightRadius: 90, - borderTopRightRadius: 90, - height: "100%" + //width: 80, + // paddingLeft: 10, + backgroundColor: "#CC1A17", + borderBottomRightRadius: 3, + borderTopRightRadius: 3, + // height: "100%" }, inputSection: { flexDirection: "row", @@ -389,7 +399,7 @@ const styles = { backgroundColor: "white", - borderRadius: 90, + borderRadius: 3, height: SCREEN_HEIGHT * 0.08, borderColor: "#bfbdbd", borderWidth: 1 @@ -448,7 +458,8 @@ const styles = { justifyContent: "center", alignItems: "center", - marginTop: 200 + marginTop: 200, + }, logo2: { From adef17b12e3a8e4be8d26cc29adbe61d7df6bfdd Mon Sep 17 00:00:00 2001 From: henrydays Date: Wed, 13 Mar 2019 00:36:42 +0000 Subject: [PATCH 15/20] =?UTF-8?q?reset=20em=20condi=C3=A7=C3=B5es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/app/App.js | 18 +++++++------- App/app/store/actions/actionTypes.js | 2 +- App/app/store/actions/api.js | 36 +++++++++++++++++++++++++++- App/app/store/actions/index.js | 3 ++- App/package-lock.json | 5 ++++ App/package.json | 1 + 6 files changed, 54 insertions(+), 11 deletions(-) diff --git a/App/app/App.js b/App/app/App.js index f55f2fe2..33efa9f0 100755 --- a/App/app/App.js +++ b/App/app/App.js @@ -135,6 +135,7 @@ class App extends Component { //faz call _reset=()=>{ //fecha modal + this.props.resetPassword(this.props.userDetails.token,this.state.resetText), this.setState({modalResetPassword:false}) //faz call } @@ -193,12 +194,12 @@ class App extends Component { /> - @@ -207,15 +208,15 @@ class App extends Component { this.setState({ resetText })} + + onChangeText={r => this.setState({ resetText:r })} clearButtonMode="always" value={this.state.resetText} clearTextOnFocus={true} onSubmitEditing={Keyboard.dismiss} - placeholder="geral@enei.pt" + placeholder="Email ou Qr code" />