diff --git a/App/android/app/build.gradle b/App/android/app/build.gradle index b07108a7..a1922356 100755 --- a/App/android/app/build.gradle +++ b/App/android/app/build.gradle @@ -149,6 +149,8 @@ android { } dependencies { + compile project(':react-native-material-shadows') + compile project(':react-native-linear-gradient') compile project(':react-native-camera') compile project(':react-native-vector-icons') compile project(':react-native-gesture-handler') diff --git a/App/android/app/src/main/assets/fonts/AntDesign.ttf b/App/android/app/src/main/assets/fonts/AntDesign.ttf old mode 100755 new mode 100644 diff --git a/App/android/app/src/main/assets/fonts/Entypo.ttf b/App/android/app/src/main/assets/fonts/Entypo.ttf old mode 100755 new mode 100644 diff --git a/App/android/app/src/main/assets/fonts/EvilIcons.ttf b/App/android/app/src/main/assets/fonts/EvilIcons.ttf old mode 100755 new mode 100644 diff --git a/App/android/app/src/main/assets/fonts/FontAwesome.ttf b/App/android/app/src/main/assets/fonts/FontAwesome.ttf old mode 100755 new mode 100644 diff --git a/App/android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf b/App/android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf old mode 100755 new mode 100644 diff --git a/App/android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf b/App/android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf old mode 100755 new mode 100644 diff --git a/App/android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf b/App/android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf old mode 100755 new mode 100644 diff --git a/App/android/app/src/main/assets/fonts/Foundation.ttf b/App/android/app/src/main/assets/fonts/Foundation.ttf old mode 100755 new mode 100644 diff --git a/App/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf b/App/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf old mode 100755 new mode 100644 diff --git a/App/android/app/src/main/assets/fonts/MaterialIcons.ttf b/App/android/app/src/main/assets/fonts/MaterialIcons.ttf old mode 100755 new mode 100644 diff --git a/App/android/app/src/main/assets/fonts/Octicons.ttf b/App/android/app/src/main/assets/fonts/Octicons.ttf old mode 100755 new mode 100644 diff --git a/App/android/app/src/main/assets/fonts/SimpleLineIcons.ttf b/App/android/app/src/main/assets/fonts/SimpleLineIcons.ttf old mode 100755 new mode 100644 diff --git a/App/android/app/src/main/assets/fonts/Zocial.ttf b/App/android/app/src/main/assets/fonts/Zocial.ttf old mode 100755 new mode 100644 diff --git a/App/android/app/src/main/java/com/app/MainApplication.java b/App/android/app/src/main/java/com/app/MainApplication.java index b9754198..4333e258 100755 --- a/App/android/app/src/main/java/com/app/MainApplication.java +++ b/App/android/app/src/main/java/com/app/MainApplication.java @@ -3,6 +3,8 @@ package com.app; import android.app.Application; import com.facebook.react.ReactApplication; +import ui.materialshadows.RNMaterialShadowsPackage; +import com.BV.LinearGradient.LinearGradientPackage; import org.reactnative.camera.RNCameraPackage; import com.oblador.vectoricons.VectorIconsPackage; import com.swmansion.gesturehandler.react.RNGestureHandlerPackage; @@ -26,6 +28,8 @@ public class MainApplication extends Application implements ReactApplication { protected List getPackages() { return Arrays.asList( new MainReactPackage(), + new RNMaterialShadowsPackage(), + new LinearGradientPackage(), new RNCameraPackage(), new VectorIconsPackage(), new RNGestureHandlerPackage() diff --git a/App/android/build.gradle b/App/android/build.gradle index a1e80854..f2d56da7 100755 --- a/App/android/build.gradle +++ b/App/android/build.gradle @@ -3,7 +3,7 @@ buildscript { ext { buildToolsVersion = "27.0.3" - minSdkVersion = 16 + minSdkVersion = 21 compileSdkVersion = 27 targetSdkVersion = 26 supportLibVersion = "27.1.1" diff --git a/App/android/gradle.properties b/App/android/gradle.properties index 7e7af5c3..8429033d 100755 --- a/App/android/gradle.properties +++ b/App/android/gradle.properties @@ -22,4 +22,4 @@ android.enableAapt2=false MYAPP_RELEASE_STORE_FILE=my-release-key.keystore MYAPP_RELEASE_KEY_ALIAS=my-key-alias MYAPP_RELEASE_STORE_PASSWORD=aspire98H -MYAPP_RELEASE_KEY_PASSWORD=encontroINFORMATICA2019 \ No newline at end of file +MYAPP_RELEASE_KEY_PASSWORD=aspire98H \ No newline at end of file diff --git a/App/android/settings.gradle b/App/android/settings.gradle index 9383630d..1993962a 100755 --- a/App/android/settings.gradle +++ b/App/android/settings.gradle @@ -1,4 +1,8 @@ rootProject.name = 'app' +include ':react-native-material-shadows' +project(':react-native-material-shadows').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-material-shadows/android') +include ':react-native-linear-gradient' +project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android') include ':react-native-camera' project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android') include ':react-native-vector-icons' diff --git a/App/app/App.js b/App/app/App.js index 07faa171..44157fe4 100755 --- a/App/app/App.js +++ b/App/app/App.js @@ -10,7 +10,13 @@ import { ActivityIndicator, Button, TouchableHighlight, - Keyboard + Keyboard, + ImageBackground, + LinearGradient, + TouchableOpacity, + TextInput, + NetInfo, + Animated } from 'react-native'; @@ -20,7 +26,7 @@ import {connect} from 'react-redux'; import QRCodeScanner from 'react-native-qrcode-scanner'; import {UtilStyles} from './assets/styles' -import * as Actions from './store/actions'; //Import your actions +import * as Actions from './store/actions'; import {RkButton, RkTheme, RkText, RkTextInput} from 'react-native-ui-kitten'; @@ -33,7 +39,11 @@ 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'; +function handleConnectivityChange() { + console.log("asdasd"); + } class App extends Component { _activate=()=>{ @@ -42,12 +52,16 @@ class App extends Component { this.scanner.reactivate(); } + _scanQr=()=>{ + this.props.openScannerLogin() + console.log(this.props.UI_loginScannerActive) + } _tryLogin=()=>{ - console.log(this.state.text) - this.scanner.reactivate(); + //console.log(this.state.text) + //this.scanner.reactivate(); this.props.login(this.state.username, this.state.text); - + } @@ -67,9 +81,10 @@ class App extends Component { logged: false, isModalVisible: false, state : {text: ''}, - username:'', + username:'QR code', failedAttempt: false, - push:4 + push:4, + UI_loginScannerActive:false }; @@ -81,7 +96,15 @@ class App extends Component { checkValue=(e)=>{ console.log("check"+e) } + _handleConnectionChange = (isConnected) => { + this.props.connectionState(true); + }; + + componentDidMount() { + + NetInfo.isConnected.addEventListener('connectionChange', this.handleConnectivityChange); + this.setState({isModalVisible: false}) //verifica se o utilizador tem token guardado this.props.checkUser(); @@ -90,6 +113,10 @@ class App extends Component { } + componentWillUnmount() { + NetInfo.isConnected.removeEventListener('connectionChange', this.handleConnectivityChange); + } + _keyboardDidShow () { //alert('Keyboard Shown'); // this.setState({push:0}) @@ -103,141 +130,155 @@ class App extends Component { } onSuccess = (e) => { - this.setState({ isModalVisible: !this.state.isModalVisible }); + // this.setState({ isModalVisible: !this.state.isModalVisible }); // this.props.login(e.data, 'f8908cc0'); + this.props.closeLoginQRScan(); this.setState({username:e.data}) - console.log("tentativa de login"); + console.log("QR code lido"); + }; render() { - if (this.props.onHold && !this.props.logged) { + if (!this.props.logged) { return ( - CARREGANDO {this.props.onHold} - + + ) } + else { - //console.log('token... '+ this.props.logged) + // console.log('token... '+ this.props.logged) //se existir token - if (this.props.logged) { + if (this.props.logged ) { return ( ) } - else { + return ( + + + + + + + + + + + + + + + + + + + - //se não existir vai para o ecrã de scan QR - return ( - - { this.scanner = node }} - showMarker + + + {this.setState({searchString})}} + maxLength={15} + underlineColorAndroid="transparent" + /> + + + + + + Scan QR + + + + + - onRead={this.onSuccess.bind(this)} - cameraStyle={{height: SCREEN_HEIGHT}} + this.setState({text})} + clearButtonMode='always' + value={this.state.text} + clearTextOnFocus={true} + onSubmitEditing={Keyboard.dismiss} + placeholder='Password' /> + + Entrar - customMarker={ - - - - - - - - - Introduza a password - - this.setState({text})} - clearButtonMode='always' - value={this.state.text} - clearTextOnFocus={true} - onSubmitEditing={Keyboard.dismiss} - /> - -