Few more bug fixes
This commit is contained in:
@@ -97,16 +97,14 @@ export class Activity extends React.Component {
|
|||||||
.getActivity(id)
|
.getActivity(id)
|
||||||
.then((activity) => {
|
.then((activity) => {
|
||||||
if (activity) {
|
if (activity) {
|
||||||
const [lng, lat] = activity.location.coordinates
|
|
||||||
activity.location = formatLatLng(lat, lng)
|
|
||||||
this.setState({
|
this.setState({
|
||||||
binder: new FormBinder(activity, Activity.bindings),
|
binder: new FormBinder(activity, Activity.bindings),
|
||||||
region: {
|
// region: {
|
||||||
latitude: lat,
|
// latitude: lat,
|
||||||
longitude: lng,
|
// longitude: lng,
|
||||||
latitudeDelta: 0.01,
|
// latitudeDelta: 0.01,
|
||||||
longitudeDelta: 0.01,
|
// longitudeDelta: 0.01,
|
||||||
},
|
// },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ import { Route, Redirect } from "react-router-native"
|
|||||||
|
|
||||||
export const DefaultRoute = () => {
|
export const DefaultRoute = () => {
|
||||||
// NOTE: When working on the app, change this to the page you are working on
|
// NOTE: When working on the app, change this to the page you are working on
|
||||||
return <Route render={() => <Redirect to={"/workItem"} />} />
|
return <Route render={() => <Redirect to={"/home"} />} />
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ export class Login extends React.Component {
|
|||||||
let { history } = this.props
|
let { history } = this.props
|
||||||
|
|
||||||
if (obj) {
|
if (obj) {
|
||||||
this.setState({ waitModal: { message: "Loggin In..." } })
|
this.setState({ waitModal: { message: "Logging In..." } })
|
||||||
api
|
api
|
||||||
.login(obj.email.trim(), obj.password, obj.rememberMe)
|
.login(obj.email.trim(), obj.password, obj.rememberMe)
|
||||||
.then((user) => {
|
.then((user) => {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
workItemTypeText,
|
workItemTypeText,
|
||||||
pad,
|
pad,
|
||||||
regionContainingPoints,
|
regionContainingPoints,
|
||||||
|
dotify,
|
||||||
} from "../util"
|
} from "../util"
|
||||||
import { ensurePermissions } from "../App"
|
import { ensurePermissions } from "../App"
|
||||||
import { versionInfo } from "../version"
|
import { versionInfo } from "../version"
|
||||||
@@ -79,7 +80,7 @@ export class Home extends React.Component {
|
|||||||
results[PermissionsAndroid.PERMISSIONS.CAMERA] ===
|
results[PermissionsAndroid.PERMISSIONS.CAMERA] ===
|
||||||
PermissionsAndroid.RESULTS.GRANTED
|
PermissionsAndroid.RESULTS.GRANTED
|
||||||
) {
|
) {
|
||||||
this.setState({ haveCameraPerm: true })
|
this.setState({ haveCameraPermission: true })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
@@ -141,15 +142,15 @@ export class Home extends React.Component {
|
|||||||
|
|
||||||
if (this.state.positionInfo) {
|
if (this.state.positionInfo) {
|
||||||
const coords = this.state.positionInfo.coords
|
const coords = this.state.positionInfo.coords
|
||||||
const workItem = this.sections[sectionIndex]
|
const workItem = this.state.sections[sectionIndex]
|
||||||
const [lng, lat] = workItem.location.coordinates
|
const { latitude, longitude } = workItem.coordinate
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
workItemDistance: geoDistance(
|
workItemDistance: geoDistance(
|
||||||
coords.latitude,
|
coords.latitude,
|
||||||
coords.longitude,
|
coords.longitude,
|
||||||
lat,
|
latitude,
|
||||||
lng,
|
longitude,
|
||||||
"K"
|
"K"
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
})
|
})
|
||||||
@@ -183,13 +184,17 @@ export class Home extends React.Component {
|
|||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
handleGlassesPress() {
|
handleGlassesPress() {
|
||||||
const { lat: lat1, lng: lng1 } = this.state.positionInfo.coords
|
const {
|
||||||
|
latitude: latitude1,
|
||||||
|
longitude: longitude1,
|
||||||
|
} = this.state.positionInfo.coords
|
||||||
let closestWorkItem = null
|
let closestWorkItem = null
|
||||||
let shortestDistance = config.minDistanceToItem
|
let shortestDistance = config.minDistanceToItem
|
||||||
|
|
||||||
this.state.sections.forEach((workItem) => {
|
this.state.sections.forEach((workItem) => {
|
||||||
const [lng2, lat2] = workItem.location.coordinates
|
const { latitude: latitude2, longitude: longitude2 } = workItem.coordinate
|
||||||
const distance = geoDistance(lat1, lng1, lat2, lng2, "K") * 1000
|
const distance =
|
||||||
|
geoDistance(latitude1, longitude1, latitude2, longitude2, "K") * 1000
|
||||||
|
|
||||||
if (distance <= shortestDistance) {
|
if (distance <= shortestDistance) {
|
||||||
closestWorkItem = workItem
|
closestWorkItem = workItem
|
||||||
@@ -290,14 +295,14 @@ export class Home extends React.Component {
|
|||||||
<Text>
|
<Text>
|
||||||
{pad(workItem.ticketNumber, 4) +
|
{pad(workItem.ticketNumber, 4) +
|
||||||
": " +
|
": " +
|
||||||
workItemTypeText[workItem.workItemType]}
|
workItemTypeText[workItem.workItemType] +
|
||||||
</Text>
|
" (" +
|
||||||
<Text>
|
(workItemDistance > 0
|
||||||
{workItem.address} ({this.workItemDistance > 0
|
? workItemDistance.toString()
|
||||||
? this.workItemDistance.toString()
|
: "?") +
|
||||||
: "?"}{" "}
|
" km)"}
|
||||||
km)
|
|
||||||
</Text>
|
</Text>
|
||||||
|
<Text>{dotify(workItem.address)}</Text>
|
||||||
</View>
|
</View>
|
||||||
</Callout>
|
</Callout>
|
||||||
</Marker>
|
</Marker>
|
||||||
@@ -311,6 +316,8 @@ export class Home extends React.Component {
|
|||||||
flexBasis: 0,
|
flexBasis: 0,
|
||||||
width: "100%",
|
width: "100%",
|
||||||
}}>
|
}}>
|
||||||
|
{/*
|
||||||
|
// TODO: Search feature
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
@@ -334,7 +341,7 @@ export class Home extends React.Component {
|
|||||||
name="cancel"
|
name="cancel"
|
||||||
size={16}
|
size={16}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View> */}
|
||||||
<SectionList
|
<SectionList
|
||||||
ref={(ref) => (this.sectionList = ref)}
|
ref={(ref) => (this.sectionList = ref)}
|
||||||
style={{ width: "100%", flexGrow: 1 }}
|
style={{ width: "100%", flexGrow: 1 }}
|
||||||
@@ -374,7 +381,7 @@ export class Home extends React.Component {
|
|||||||
<TouchableHighlight
|
<TouchableHighlight
|
||||||
style={{
|
style={{
|
||||||
height: 50,
|
height: 50,
|
||||||
paddingLeft: 20,
|
paddingLeft: 10,
|
||||||
paddingRight: 20,
|
paddingRight: 20,
|
||||||
backgroundColor: "white",
|
backgroundColor: "white",
|
||||||
}}
|
}}
|
||||||
@@ -388,7 +395,7 @@ export class Home extends React.Component {
|
|||||||
}}>
|
}}>
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
fontSize: 8,
|
fontSize: 9,
|
||||||
width: 45,
|
width: 45,
|
||||||
alignSelf: "center",
|
alignSelf: "center",
|
||||||
}}>
|
}}>
|
||||||
@@ -399,6 +406,7 @@ export class Home extends React.Component {
|
|||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
flexBasis: 0,
|
flexBasis: 0,
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
|
marginLeft: 10,
|
||||||
}}>
|
}}>
|
||||||
<Text style={{ fontSize: 20, fontWeight: "bold" }}>
|
<Text style={{ fontSize: 20, fontWeight: "bold" }}>
|
||||||
{activity.resolution}
|
{activity.resolution}
|
||||||
|
|||||||
Reference in New Issue
Block a user