diff --git a/mobile/src/Activity/Activity.js b/mobile/src/Activity/Activity.js index 13bb98d..7549b05 100644 --- a/mobile/src/Activity/Activity.js +++ b/mobile/src/Activity/Activity.js @@ -90,6 +90,7 @@ export class Activity extends React.Component { waitModal: null, messageModal: null, progressModal: null, + uploadPercent: 0, } const { search } = this.props.location @@ -261,10 +262,12 @@ export class Activity extends React.Component { const { binder, messageModal, + progressModal, waitModal, region, dateTime, location, + uploadPercent, } = this.state return ( diff --git a/mobile/src/App.js b/mobile/src/App.js index ff9a8b8..c6f2414 100644 --- a/mobile/src/App.js +++ b/mobile/src/App.js @@ -65,7 +65,7 @@ export default class App extends React.Component { path="/workItemList" component={WorkItemList} /> - + diff --git a/mobile/src/WorkItem/WorkItem.js b/mobile/src/WorkItem/WorkItem.js index 3c3d41f..4e4a8b2 100644 --- a/mobile/src/WorkItem/WorkItem.js +++ b/mobile/src/WorkItem/WorkItem.js @@ -80,6 +80,10 @@ export class WorkItem extends React.Component { isValid: (r, v) => v !== "", alwaysGet: true, }, + addActivity: { + noValue: true, + isDisabled: (r, v) => r.anyModified, + }, } constructor(props) { @@ -277,8 +281,8 @@ export class WorkItem extends React.Component { @autobind handleAddActivity() { - if (this.history) { - this.history.push(`/activity?workItemId=${this.binder._id}`) + if (this.props.history) { + this.props.history.push(`/activity?workItemId=${this.state.binder._id}`) } } @@ -375,21 +379,12 @@ export class WorkItem extends React.Component { {api.loggedInUser.administrator && binder._id && ( - - - Add Activity - - + /> )} {isIphoneX ? : null} diff --git a/mobile/src/config.js b/mobile/src/config.js index e7ce42a..6c22756 100644 --- a/mobile/src/config.js +++ b/mobile/src/config.js @@ -2,31 +2,31 @@ import React from "react" import { Platform } from "react-native" export const config = { - localIPAddr: "192.168.1.175", - //localIPAddr: "192.168.1.14", + //localIPAddr: "192.168.1.175", + localIPAddr: "192.168.1.14", viroAPIKey: "06F37B6A-74DA-4A83-965A-7DE2209A5C46", googleGeocodeAPIKey: "AIzaSyCs4JVT6gysnY5dAJ7KjVJYeykLv_xz1GI", googleGeocodeURL: "https://maps.googleapis.com/maps/api/geocode/json", refererURL: "https://dar.kss.us.com", - defaultUser: "john@lyon-smith.org", - //defaultUser: "", - minGPSAccuracy: 50, - //minGPSAccuracy: 20, + //defaultUser: "john@lyon-smith.org", + defaultUser: "", + //minGPSAccuracy: 50, + minGPSAccuracy: 20, minDistanceToItem: 10, geocodeDelayMilliseconds: 500, // This region is downtown Toronto - // initialRegion: { - // latitude: 43.653908, - // longitude: -79.384293, - // latitudeDelta: 0.0922, - // longitudeDelta: 0.0421, - // }, - // This region is Bainbridge Island initialRegion: { - latitude: 47.629536, - longitude: -122.524162, + latitude: 43.653908, + longitude: -79.384293, latitudeDelta: 0.0922, longitudeDelta: 0.0421, }, - alwaysShowWorkItemInAR: true, + // This region is Bainbridge Island + // initialRegion: { + // latitude: 47.629536, + // longitude: -122.524162, + // latitudeDelta: 0.0922, + // longitudeDelta: 0.0421, + // }, + // alwaysShowWorkItemInAR: true, } diff --git a/mobile/src/ui/BoundInput.js b/mobile/src/ui/BoundInput.js index e528ad4..97a2788 100644 --- a/mobile/src/ui/BoundInput.js +++ b/mobile/src/ui/BoundInput.js @@ -34,7 +34,7 @@ export class BoundInput extends React.Component { @autobind handleChangeText(newText) { - if (this.props.binder) { + if (this && this.props && this.props.binder) { this.setState( this.props.binder.updateFieldValue(this.props.name, newText) ) diff --git a/mobile/src/ui/BoundPhotoPanel.js b/mobile/src/ui/BoundPhotoPanel.js index 95c3516..c779792 100644 --- a/mobile/src/ui/BoundPhotoPanel.js +++ b/mobile/src/ui/BoundPhotoPanel.js @@ -11,6 +11,7 @@ import { } from "react-native" import { Icon } from "." import ImagePicker from "react-native-image-picker" +import ImageResizer from "react-native-image-resizer" import autobind from "autobind-decorator" import { api } from "../API" @@ -48,7 +49,7 @@ export class BoundPhotoPanel extends Component { @autobind handlePhotoPress(index) { - const { onUploadStarted, onUploadEnded } = this.props + const { onUploadStarted, onUploadEnded, onUploadProgress } = this.props ImagePicker.showImagePicker( { @@ -67,11 +68,10 @@ export class BoundPhotoPanel extends Component { const uri = response.path || response.uri - createResizedImage(uri, 800, 600, "JPEG", 80) - .then((newUri) => { - return - api.upload(newUri, this.props.onUploadProgress) - }) + ImageResizer.createResizedImage(uri, 1024, 1024, "JPEG", 80) + .then((result) => + api.upload(result.path || result.uri, onUploadProgress) + ) .then((uploadData) => { if (onUploadEnded) { onUploadEnded(true, uploadData)