diff --git a/.idea/workspace.xml b/.idea/workspace.xml index fa665e4..e4ce0db 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,20 +2,8 @@ - - - - - - - - - - - - - - + + @@ -162,7 +150,6 @@ - diff --git a/mobile/src/API.js b/mobile/src/API.js index 4696879..f37c49b 100644 --- a/mobile/src/API.js +++ b/mobile/src/API.js @@ -61,7 +61,6 @@ class API extends EventEmitter { this.emit("login") }) .catch((err) => { - console.error(err) AsyncStorage.removeItem(authTokenName) this.token = null this.user = {} diff --git a/mobile/src/Auth/Login.js b/mobile/src/Auth/Login.js index aa349ea..a254e17 100644 --- a/mobile/src/Auth/Login.js +++ b/mobile/src/Auth/Login.js @@ -7,7 +7,7 @@ import { Switch, TextInput, View, - Button + Button, } from "react-native" import { MessageModal } from "../Modal" import logoImage from "./images/deighton.png" @@ -15,27 +15,29 @@ import { FormBinder } from "react-form-binder" import { api } from "../API" import { BoundSwitch, BoundInput, BoundButton } from "../ui" import KeyboardSpacer from "react-native-keyboard-spacer" +import { versionInfo } from "../version" import autobind from "autobind-decorator" +import { isIphoneX } from "react-native-iphone-x-helper" export class Login extends React.Component { static bindings = { email: { alwaysGet: true, - isValid: (r, v) => v !== "" + isValid: (r, v) => v !== "", }, password: { alwaysGet: true, - isValid: (r, v) => v !== "" + isValid: (r, v) => v !== "", }, rememberMe: { alwaysGet: true, initValue: true, - isValid: true + isValid: true, }, login: { noValue: true, - isDisabled: r => !(r.anyModified && r.allValid) - } + isDisabled: (r) => !(r.anyModified && r.allValid), + }, } static styles = StyleSheet.create({ @@ -44,39 +46,39 @@ export class Login extends React.Component { flex: 1, backgroundColor: "#fff", alignItems: "center", - justifyContent: "center" + justifyContent: "center", }, logo: { - width: "50%" + width: "50%", }, inputRow: { paddingTop: 10, width: "60%", flexDirection: "column", justifyContent: "flex-end", - alignItems: "flex-start" + alignItems: "flex-start", }, switchRow: { paddingTop: 10, width: "60%", flexDirection: "row", justifyContent: "flex-end", - alignItems: "center" + alignItems: "center", }, buttonRow: { paddingTop: 10, width: "60%", flexDirection: "row", justifyContent: "flex-end", - alignItems: "center" - } + alignItems: "center", + }, }) constructor(props) { super(props) this.state = { binder: new FormBinder({ email: "john@lyon-smith.org" }, Login.bindings), - messageModal: null + messageModal: null, } } @@ -88,16 +90,16 @@ export class Login extends React.Component { if (obj) { api .login(obj.email, obj.password, obj.rememberMe) - .then(user => { + .then((user) => { history.replace("/home") }) - .catch(error => { + .catch((error) => { this.setState({ messageModal: { icon: "hand", message: "Unable to login", - detail: error.message - } + detail: error.message, + }, }) }) } @@ -152,6 +154,17 @@ export class Login extends React.Component { binder={this.state.binder} /> + + + {versionInfo.version} + + - + {Platform.OS === "ios" && } ) } diff --git a/mobile/src/Home/Home.js b/mobile/src/Home/Home.js index 6a82680..c1f3f83 100644 --- a/mobile/src/Home/Home.js +++ b/mobile/src/Home/Home.js @@ -186,7 +186,8 @@ export class Home extends React.Component { style={{ marginLeft: 10, marginRight: 5, tintColor: "gray" }} /> v !== "", @@ -210,29 +210,37 @@ export class WorkItem extends React.Component { /> - + + - + (this.latLngInput = ref)} binder={binder} @@ -258,7 +266,7 @@ export class WorkItem extends React.Component { detail={messageModal ? messageModal.detail : ""} onDismiss={messageModal && this.handleMessageDismiss} /> - + {Platform.OS === "ios" && } ) } diff --git a/mobile/src/ui/BoundInput.js b/mobile/src/ui/BoundInput.js index 6abccd4..9f4252b 100644 --- a/mobile/src/ui/BoundInput.js +++ b/mobile/src/ui/BoundInput.js @@ -1,6 +1,6 @@ import React from "react" import PropTypes from "prop-types" -import { TextInput, Text, View } from "react-native" +import { TextInput, Text, View, Platform } from "react-native" import autobind from "autobind-decorator" export class BoundInput extends React.Component { @@ -42,7 +42,7 @@ export class BoundInput extends React.Component { render() { const { label, password, name, placeholder, message, lines } = this.props - const { visible, disabled, value, valid } = this.state + const { visible, disabled, readOnly, value, valid } = this.state if (!visible) { return null @@ -62,11 +62,12 @@ export class BoundInput extends React.Component { borderWidth: 1, fontSize: 16, paddingTop: 7, - paddingBottom: 7, + paddingBottom: Platform.OS === "ios" ? 7 : 0, + textAlignVertical: "top", }} multiline={lines > 1} numberOfLines={lines} - editable={!disabled} + editable={!disabled && !readOnly} autoCapitalize="none" underlineColorAndroid="white" value={value} diff --git a/mobile/src/ui/Header.js b/mobile/src/ui/Header.js index b5fcd5b..de99458 100644 --- a/mobile/src/ui/Header.js +++ b/mobile/src/ui/Header.js @@ -1,10 +1,13 @@ -import React, { Component } from 'react' -import { View, TouchableOpacity, Text } from 'react-native' -import { Icon } from './Icon' -import PropTypes from 'prop-types' -import { ifIphoneX } from 'react-native-iphone-x-helper' +import React, { Component } from "react" +import { View, Platform, TouchableOpacity, Text } from "react-native" +import { Icon } from "./Icon" +import PropTypes from "prop-types" +import { ifIphoneX } from "react-native-iphone-x-helper" -const headerButtonShape = { icon: PropTypes.string.isRequired, onPress: PropTypes.func } +const headerButtonShape = { + icon: PropTypes.string.isRequired, + onPress: PropTypes.func, +} export class Header extends Component { static propTypes = { @@ -15,8 +18,8 @@ export class Header extends Component { } static defaultProps = { - rightButton: { icon: 'none' }, - leftButton: { icon: 'none' }, + rightButton: { icon: "none" }, + leftButton: { icon: "none" }, visible: true, } @@ -25,35 +28,49 @@ export class Header extends Component { let right = null if (!rightButton) { - right = ( - - ) + right = } else if (disabled) { right = ( - + ) } else { right = ( - + ) } return ( - + - + - {title} + {title} {right} ) diff --git a/mobile/src/version.js b/mobile/src/version.js new file mode 100644 index 0000000..99c5cc3 --- /dev/null +++ b/mobile/src/version.js @@ -0,0 +1,7 @@ +export const versionInfo = { + version: '1.0.0', + fullVersion: '1.0.0-20180407.3', + title: 'Deighton AR System', + copyright: '© 2018, Kingston Software Solutions.', + supportEmail: 'support@kss.us.com', +} diff --git a/version.json5 b/version.json5 index 8c062ed..cd7953a 100644 --- a/version.json5 +++ b/version.json5 @@ -3,6 +3,7 @@ "package.json", "website/.env", "website/src/version.js", + "mobile/src/version.js", "mobile/ios/DeightonAR/info.plist", "mobile/android/app/build.gradle", "mobile/android/app/src/main/AndroidManifest.xml",