Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3b20d8ac1 | ||
|
|
519bc1c50b | ||
|
|
71e1816173 | ||
|
|
9e55320a21 | ||
|
|
62876c94c9 | ||
|
|
5e00b0dd23 | ||
|
|
fb8545110c | ||
|
|
323d047903 | ||
|
|
9ec1e689eb | ||
|
|
bbd259f989 |
@@ -8,7 +8,7 @@
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||
|
||||
154
mobile/android/app/app.iml
Normal file
154
mobile/android/app/app.iml
Normal file
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":app" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-fragment-25.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.facebook.fresco:fbcore-1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.exoplayer:exoplayer-r2.2.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-media-compat-25.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.facebook.fresco:drawee-1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.facebook.fresco:imagepipeline-okhttp3-1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: artifacts:arcore_client" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.parse.bolts:bolts-tasks:1.4.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.okio:okio:1.13.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:appcompat-v7-25.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.amazonaws:aws-android-sdk-ddb:2.2.22@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.code.gson:gson:2.2.4@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable-25.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.facebook.fresco:fresco-1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-compat-25.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.code.findbugs:jsr305:3.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.webkit:android-jsc-r174650" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.amazonaws:aws-android-sdk-s3:2.2.22@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-utils-25.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: javax.inject:javax.inject:1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.amazonaws:aws-android-sdk-core:2.2.22@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.facebook.soloader:soloader-0.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-ui-25.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable-25.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.facebook.fbui.textlayoutbuilder:textlayoutbuilder-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.facebook.fresco:imagepipeline-base-1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.okhttp3:okhttp:3.6.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-v4-25.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.facebook.fbui.textlayoutbuilder:staticlayout-proxy:1.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: artifacts:react_viro" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.facebook.react:react-native-0.55.4" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-annotations:25.0.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.amazonaws:aws-android-sdk-cognito:2.2.22@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.2.22@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.okhttp3:okhttp-urlconnection:3.6.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: artifacts:viro_renderer" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.amazonaws:aws-android-sdk-ddb-mapper:2.2.22@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: artifacts:gvr_common" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.facebook.fresco:imagepipeline-1.3.0" level="project" />
|
||||
<orderEntry type="module" module-name="react-native-fs" />
|
||||
<orderEntry type="module" module-name="react-native-maps" />
|
||||
<orderEntry type="module" module-name="react-native-image-resizer" />
|
||||
<orderEntry type="module" module-name="react-native-image-picker" />
|
||||
<orderEntry type="library" name="Gradle: android-android-27" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -101,8 +101,8 @@ android {
|
||||
applicationId "com.deightonar"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 27
|
||||
versionCode 6
|
||||
versionName "1.1.0"
|
||||
versionCode 10
|
||||
versionName "1.2.0"
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "x86"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.deightonar"
|
||||
android:versionCode="6"
|
||||
android:versionName="1.1.0">
|
||||
android:versionCode="10"
|
||||
android:versionName="1.2.0">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
|
||||
@@ -140,6 +140,11 @@
|
||||
TargetAttributes = {
|
||||
13B07F861A680F5B00A75B9A = {
|
||||
DevelopmentTeam = 523GZPCZ3X;
|
||||
SystemCapabilities = {
|
||||
com.apple.BackgroundModes = {
|
||||
enabled = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>$(PRODUCT_NAME) camera use</string>
|
||||
<key>NSLocationAlwaysUsageDescription</key>
|
||||
<string>$(PRODUCT_NAME) background location use</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
@@ -19,11 +19,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.1.0</string>
|
||||
<string>1.2.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>20180525.0</string>
|
||||
<string>20180531.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
@@ -33,8 +33,16 @@
|
||||
</dict>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>$(PRODUCT_NAME) camera use</string>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>$(PRODUCT_NAME) location use</string>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>$(PRODUCT_NAME) camera use</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>$(PRODUCT_NAME) photo use</string>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>location</string>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
@@ -46,8 +54,6 @@
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
</array>
|
||||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
||||
<string>$(PRODUCT_NAME) location use</string>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
</dict>
|
||||
|
||||
@@ -105,8 +105,6 @@ class WorkItemSceneAR extends React.Component {
|
||||
position: hitResultPosition || defaultPosition,
|
||||
})
|
||||
|
||||
console.log(hitResultPosition || defaultPosition)
|
||||
|
||||
setTimeout(() => {
|
||||
this.updateInitialRotation()
|
||||
}, 200)
|
||||
|
||||
@@ -97,16 +97,19 @@ export class Activity extends React.Component {
|
||||
this.region = null
|
||||
this.isMapReady = false
|
||||
this.goToRegionWhenReady = false
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { search } = this.props.location
|
||||
const params = search ? new URLSearchParams(search) : { get: () => null }
|
||||
const id = params.get("id")
|
||||
const workItemId = params.get("workItemId")
|
||||
|
||||
const getWorkItem = (id) => {
|
||||
this.setState({ waitModal: { message: "Loading Work Item Details..." } })
|
||||
api
|
||||
.getWorkItem(id)
|
||||
.then((workItem) => {
|
||||
this.setState({ waitModal: null })
|
||||
if (workItem) {
|
||||
const [lng, lat] = workItem.location.coordinates
|
||||
|
||||
@@ -139,6 +142,7 @@ export class Activity extends React.Component {
|
||||
})
|
||||
.catch((err) => {
|
||||
this.setState({
|
||||
waitModal: null,
|
||||
messageModal: {
|
||||
icon: "hand",
|
||||
message: "Unable to get work item details",
|
||||
@@ -150,9 +154,12 @@ export class Activity extends React.Component {
|
||||
}
|
||||
|
||||
if (id) {
|
||||
this.setState({ waitModal: { message: "Loading Activity..." } })
|
||||
api
|
||||
.getActivity(id)
|
||||
.then((activity) => {
|
||||
this.setState({ waitModal: null })
|
||||
|
||||
if (activity) {
|
||||
this.setState({
|
||||
binder: new FormBinder(activity, Activity.bindings),
|
||||
@@ -163,6 +170,7 @@ export class Activity extends React.Component {
|
||||
})
|
||||
.catch((err) => {
|
||||
this.setState({
|
||||
waitModal: null,
|
||||
messageModal: {
|
||||
icon: "hand",
|
||||
message: "Unable to get activity details",
|
||||
@@ -294,7 +302,12 @@ export class Activity extends React.Component {
|
||||
/>
|
||||
<ScrollView style={styles.container}>
|
||||
<View style={styles.panel}>
|
||||
<BoundInput binder={binder} name="resolution" label="Resolution:" />
|
||||
<BoundInput
|
||||
binder={binder}
|
||||
name="resolution"
|
||||
label="Resolution:"
|
||||
message="You must supply a resolution for the activity"
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.panel}>
|
||||
<BoundOptionStrip
|
||||
@@ -307,10 +320,16 @@ export class Activity extends React.Component {
|
||||
]}
|
||||
label="Status:"
|
||||
name="status"
|
||||
message="You must supply a status for the activity"
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.panel}>
|
||||
<BoundInput binder={binder} name="notes" label="Notes:" />
|
||||
<BoundInput
|
||||
binder={binder}
|
||||
name="notes"
|
||||
label="Notes:"
|
||||
message="You must supply notes for the activity"
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.panel}>
|
||||
<FormStaticInput label="Date & Time:" value={dateTime} />
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
} from "react-native"
|
||||
import MapView, { Marker, Callout } from "react-native-maps"
|
||||
import { Icon, Header, Geolocation } from "../ui"
|
||||
import { MessageModal } from "../Modal"
|
||||
import { MessageModal, WaitModal } from "../Modal"
|
||||
import { api } from "../API"
|
||||
import { reactAutoBind } from "auto-bind2"
|
||||
import { ifIphoneX } from "react-native-iphone-x-helper"
|
||||
@@ -41,6 +41,8 @@ export class Home extends React.Component {
|
||||
super(props)
|
||||
reactAutoBind(this)
|
||||
this.state = {
|
||||
waitModal: null,
|
||||
messageModal: null,
|
||||
sections: [],
|
||||
showWorkItems: true,
|
||||
haveCameraPermission: false,
|
||||
@@ -97,7 +99,14 @@ export class Home extends React.Component {
|
||||
this.state.haveLocationPermission = true
|
||||
this.state.haveCameraPermission = true
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.loadWorkItems()
|
||||
}
|
||||
|
||||
loadWorkItems() {
|
||||
this.setState({ waitModal: { message: "Loading Work Items..." } })
|
||||
api
|
||||
.listTeams()
|
||||
.then((list) => {
|
||||
@@ -105,6 +114,8 @@ export class Home extends React.Component {
|
||||
return api.listWorkItemActivities()
|
||||
})
|
||||
.then((list) => {
|
||||
this.setState({ waitModal: null })
|
||||
|
||||
list.items.forEach((item) => {
|
||||
item.data.forEach((datum) => {
|
||||
const team = this.teams.find((team) => team._id === datum.team)
|
||||
@@ -130,6 +141,7 @@ export class Home extends React.Component {
|
||||
})
|
||||
.catch((err) => {
|
||||
this.setState({
|
||||
waitModal: null,
|
||||
messageModal: {
|
||||
icon: "hand",
|
||||
message: "Unable to get a list of work items, activities and teams",
|
||||
@@ -246,7 +258,13 @@ export class Home extends React.Component {
|
||||
}
|
||||
|
||||
handleToggleWorkItemsList() {
|
||||
this.setState({ showWorkItems: !this.state.showWorkItems })
|
||||
const newShowWorkItems = !this.state.showWorkItems
|
||||
|
||||
this.setState({ showWorkItems: newShowWorkItems })
|
||||
|
||||
if (newShowWorkItems) {
|
||||
this.loadWorkItems()
|
||||
}
|
||||
}
|
||||
|
||||
handleCalloutPress(workItem) {
|
||||
@@ -287,6 +305,7 @@ export class Home extends React.Component {
|
||||
sections,
|
||||
showWorkItems,
|
||||
messageModal,
|
||||
waitModal,
|
||||
haveCameraPermission,
|
||||
haveLocationPermission,
|
||||
} = this.state
|
||||
@@ -491,6 +510,10 @@ export class Home extends React.Component {
|
||||
{haveLocationPermission && (
|
||||
<Geolocation onUpdate={this.handlePositionUpdate} />
|
||||
)}
|
||||
<WaitModal
|
||||
open={!!waitModal}
|
||||
message={waitModal ? waitModal.message : ""}
|
||||
/>
|
||||
<MessageModal
|
||||
open={!!messageModal}
|
||||
icon={messageModal ? messageModal.icon : ""}
|
||||
|
||||
@@ -104,15 +104,21 @@ export class WorkItem extends React.Component {
|
||||
this.region = null
|
||||
this.isMapReady = false
|
||||
this.goToRegionWhenReady = false
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { search } = this.props.location
|
||||
const params = search ? new URLSearchParams(search) : { get: () => null }
|
||||
const id = params.get("id")
|
||||
|
||||
if (id) {
|
||||
this.setState({ waitModal: { message: "Loading Work Item..." } })
|
||||
|
||||
api
|
||||
.getWorkItem(id)
|
||||
.then((workItem) => {
|
||||
this.setState({ waitModal: null })
|
||||
|
||||
if (workItem) {
|
||||
const [longitude, latitude] = workItem.location.coordinates
|
||||
|
||||
@@ -136,6 +142,7 @@ export class WorkItem extends React.Component {
|
||||
})
|
||||
.catch((err) => {
|
||||
this.setState({
|
||||
waitModal: null,
|
||||
messageModal: {
|
||||
icon: "hand",
|
||||
message: "Unable to get work item details",
|
||||
@@ -167,14 +174,18 @@ export class WorkItem extends React.Component {
|
||||
const { binder } = this.state
|
||||
let obj = binder.getModifiedBindingValues()
|
||||
|
||||
this.setState({ waitModal: { message: "Creating Work Item..." } })
|
||||
|
||||
if (!obj._id) {
|
||||
api
|
||||
.createWorkItem(obj)
|
||||
.then((workItem) => {
|
||||
this.setState({ waitModal: null })
|
||||
this.handleBackPress()
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setState({
|
||||
waitModal: null,
|
||||
messageModal: {
|
||||
icon: "hand",
|
||||
message: "Unable to create work item",
|
||||
@@ -190,6 +201,7 @@ export class WorkItem extends React.Component {
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setState({
|
||||
waitModal: null,
|
||||
messageModal: {
|
||||
icon: "hand",
|
||||
message: "Unable to update work item",
|
||||
@@ -209,6 +221,11 @@ export class WorkItem extends React.Component {
|
||||
}
|
||||
|
||||
handleRegionChange(region) {
|
||||
if (!this.isMapReady) {
|
||||
// On iOS we get this after setting the initial region, before the map declared as ready!
|
||||
return
|
||||
}
|
||||
|
||||
const { latitude, longitude } = region
|
||||
|
||||
this.region = region
|
||||
|
||||
@@ -2,33 +2,37 @@ 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",
|
||||
minDistanceToItem: 20,
|
||||
geocodeDelayMilliseconds: 500,
|
||||
defaultUser: "john@lyon-smith.org",
|
||||
//defaultUser: "",
|
||||
// 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,
|
||||
latitudeDelta: 0.0922,
|
||||
longitudeDelta: 0.0421,
|
||||
},
|
||||
workItemRegionDelta: 0.005,
|
||||
activityRegionDelta: 0.005,
|
||||
homeRegionInset: 0.02,
|
||||
homeRegionDelta: 0.005,
|
||||
alwaysShowWorkItemInAR: true,
|
||||
geocodeDelayMilliseconds: 500,
|
||||
|
||||
//defaultUser: "john@lyon-smith.org",
|
||||
defaultUser: "",
|
||||
|
||||
// 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,
|
||||
// latitudeDelta: 0.0922,
|
||||
// longitudeDelta: 0.0421,
|
||||
// },
|
||||
|
||||
// alwaysShowWorkItemInAR: true,
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const versionInfo = {
|
||||
version: '1.1.0',
|
||||
fullVersion: '1.1.0-20180525.0',
|
||||
version: '1.2.0',
|
||||
fullVersion: '1.2.0-20180531.0',
|
||||
title: 'Deighton AR System',
|
||||
copyright: '© 2018, Kingston Software Solutions.',
|
||||
supportEmail: 'support@kss.us.com',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "deighton-ar",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.0",
|
||||
"description": "Deighton AR Training System",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
|
||||
@@ -12,7 +12,7 @@ server {
|
||||
|
||||
# Any route that starts with /api/ is for the backend
|
||||
location /api/ {
|
||||
error_page 502 503 $scheme://$server_name/500.json;
|
||||
error_page 502 503 504 $scheme://$server_name/500.json;
|
||||
|
||||
proxy_pass http://127.0.0.1:3006/;
|
||||
proxy_buffering off;
|
||||
|
||||
@@ -6,7 +6,11 @@ import { catchAll, TeamRoutes, BaseRoutes } from "."
|
||||
@autobind
|
||||
export class ActivityRoutes extends BaseRoutes {
|
||||
constructor(container) {
|
||||
super(container, container.db.Activity)
|
||||
super({
|
||||
container,
|
||||
model: container.db.Activity,
|
||||
nonAdmin: { listItems: true, createItem: true, getItem: true },
|
||||
})
|
||||
|
||||
const app = container.app
|
||||
|
||||
@@ -19,6 +23,12 @@ export class ActivityRoutes extends BaseRoutes {
|
||||
}
|
||||
|
||||
async deleteAllActivities(req, res, next) {
|
||||
const isAdmin = !!req.user.administrator
|
||||
|
||||
if (!isAdmin) {
|
||||
throw createError.Forbidden()
|
||||
}
|
||||
|
||||
const Activity = this.db.Activity
|
||||
const Team = this.db.Team
|
||||
|
||||
|
||||
@@ -3,14 +3,23 @@ import createError from "http-errors"
|
||||
import autobind from "autobind-decorator"
|
||||
import { catchAll } from "."
|
||||
|
||||
// The list of functions you can list in options.nonAdmin is:
|
||||
//
|
||||
// listItems
|
||||
// createItem
|
||||
// updateItem
|
||||
// getItem
|
||||
// deleteItem
|
||||
|
||||
@autobind
|
||||
export class BaseRoutes {
|
||||
constructor(container, model) {
|
||||
this.model = model
|
||||
constructor(options) {
|
||||
const { container } = options
|
||||
this.options = options
|
||||
this.log = container.log
|
||||
this.db = container.db
|
||||
|
||||
const basePath = "/" + model.collection.collectionName
|
||||
const basePath = "/" + options.model.collection.collectionName
|
||||
const app = container.app
|
||||
|
||||
app
|
||||
@@ -41,7 +50,13 @@ export class BaseRoutes {
|
||||
}
|
||||
|
||||
async listItems(req, res, next) {
|
||||
const ItemModel = this.model
|
||||
const isAdmin = !!req.user.administrator
|
||||
|
||||
if (!this.options.nonAdmin.listItems && !isAdmin) {
|
||||
throw createError.Forbidden()
|
||||
}
|
||||
|
||||
const ItemModel = this.options.model
|
||||
const limit = req.query.limit || 20
|
||||
const skip = req.query.skip || 0
|
||||
const partial = !!req.query.partial
|
||||
@@ -74,14 +89,14 @@ export class BaseRoutes {
|
||||
})
|
||||
}
|
||||
|
||||
async createItem(req, res, next) {
|
||||
const isAdmin = req.user.administrator
|
||||
async createItem(req, res) {
|
||||
const isAdmin = !!req.user.administrator
|
||||
|
||||
if (!isAdmin) {
|
||||
return new createError.Forbidden()
|
||||
if (!this.options.nonAdmin.createItem && !isAdmin) {
|
||||
throw createError.Forbidden()
|
||||
}
|
||||
|
||||
const ItemModel = this.model
|
||||
const ItemModel = this.options.model
|
||||
let item = new ItemModel(req.body)
|
||||
|
||||
const newItem = await item.save()
|
||||
@@ -89,11 +104,11 @@ export class BaseRoutes {
|
||||
res.json(newItem.toClient())
|
||||
}
|
||||
|
||||
async updateItem(req, res, next) {
|
||||
const isAdmin = req.user.administrator
|
||||
async updateItem(req, res) {
|
||||
const isAdmin = !!req.user.administrator
|
||||
|
||||
if (!isAdmin) {
|
||||
return new createError.Forbidden()
|
||||
if (!this.options.nonAdmin.updateItem && !isAdmin) {
|
||||
throw createError.Forbidden()
|
||||
}
|
||||
|
||||
// Do this here because Mongoose will add it automatically otherwise
|
||||
@@ -101,11 +116,11 @@ export class BaseRoutes {
|
||||
throw createError.BadRequest("No _id given in body")
|
||||
}
|
||||
|
||||
let ItemModel = this.model
|
||||
let ItemModel = this.options.model
|
||||
let item = await ItemModel.findById(req.body._id)
|
||||
|
||||
if (!item) {
|
||||
return next(createError.NotFound(`Item with _id ${_id} was not found`))
|
||||
throw createError.NotFound(`Item with _id ${_id} was not found`)
|
||||
}
|
||||
|
||||
item.merge(new ItemModel(req.body))
|
||||
@@ -115,8 +130,14 @@ export class BaseRoutes {
|
||||
res.json(savedItem.toClient())
|
||||
}
|
||||
|
||||
async getItem(req, res, next) {
|
||||
const ItemModel = this.model
|
||||
async getItem(req, res) {
|
||||
const isAdmin = !!req.user.administrator
|
||||
|
||||
if (!this.options.nonAdmin.getItem && !isAdmin) {
|
||||
throw createError.Forbidden()
|
||||
}
|
||||
|
||||
const ItemModel = this.options.model
|
||||
const _id = req.params._id
|
||||
const item = await ItemModel.findById(_id)
|
||||
|
||||
@@ -127,14 +148,14 @@ export class BaseRoutes {
|
||||
res.json(item.toClient())
|
||||
}
|
||||
|
||||
async deleteItem(req, res, next) {
|
||||
const isAdmin = req.user.administrator
|
||||
async deleteItem(req, res) {
|
||||
const isAdmin = !!req.user.administrator
|
||||
|
||||
if (!isAdmin) {
|
||||
return new createError.Forbidden()
|
||||
if (!this.options.nonAdmin.deleteItem && !isAdmin) {
|
||||
throw createError.Forbidden()
|
||||
}
|
||||
|
||||
const ItemModel = this.model
|
||||
const ItemModel = this.options.model
|
||||
const _id = req.params._id
|
||||
const item = await ItemModel.remove({ _id })
|
||||
|
||||
|
||||
@@ -8,7 +8,11 @@ import { catchAll, BaseRoutes } from "."
|
||||
@autobind
|
||||
export class TeamRoutes extends BaseRoutes {
|
||||
constructor(container) {
|
||||
super(container, container.db.Team)
|
||||
super({
|
||||
container,
|
||||
model: container.db.Team,
|
||||
nonAdmin: { listItems: true, getItem: true },
|
||||
})
|
||||
|
||||
container.app
|
||||
.route("/teams/status")
|
||||
@@ -19,6 +23,12 @@ export class TeamRoutes extends BaseRoutes {
|
||||
}
|
||||
|
||||
async getTeamStatus(req, res, next) {
|
||||
const isAdmin = !!req.user.administrator
|
||||
|
||||
if (!isAdmin) {
|
||||
throw createError.Forbidden()
|
||||
}
|
||||
|
||||
const Team = this.db.Team
|
||||
const Activity = this.db.Activity
|
||||
let teams = await Team.find({}).exec()
|
||||
|
||||
@@ -7,7 +7,11 @@ import { catchAll, BaseRoutes } from "."
|
||||
@autobind
|
||||
export class WorkItemRoutes extends BaseRoutes {
|
||||
constructor(container) {
|
||||
super(container, container.db.WorkItem)
|
||||
super({
|
||||
container,
|
||||
model: container.db.WorkItem,
|
||||
nonAdmin: { listItems: true, getItem: true },
|
||||
})
|
||||
const app = container.app
|
||||
|
||||
app
|
||||
@@ -63,6 +67,12 @@ export class WorkItemRoutes extends BaseRoutes {
|
||||
}
|
||||
|
||||
async deleteAllWorkItems(req, res, next) {
|
||||
const isAdmin = !!req.user.administrator
|
||||
|
||||
if (!isAdmin) {
|
||||
throw createError.Forbidden()
|
||||
}
|
||||
|
||||
const Activity = this.db.Activity
|
||||
const WorkItem = this.db.WorkItem
|
||||
const Team = this.db.Team
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const versionInfo = {
|
||||
version: '1.1.0',
|
||||
fullVersion: '1.1.0-20180525.0',
|
||||
version: '1.2.0',
|
||||
fullVersion: '1.2.0-20180531.0',
|
||||
title: 'Deighton AR System',
|
||||
copyright: '© 2018, Kingston Software Solutions.',
|
||||
supportEmail: 'support@kss.us.com',
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
buildFormat: "full",
|
||||
tags: {
|
||||
major: 1,
|
||||
minor: 1,
|
||||
minor: 2,
|
||||
patch: 0,
|
||||
build: 20180525,
|
||||
build: 20180531,
|
||||
revision: 0,
|
||||
sequence: 6,
|
||||
sequence: 10,
|
||||
tz: "America/Los_Angeles",
|
||||
title: "Deighton AR System",
|
||||
copyright: "© 2018, Kingston Software Solutions.",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const versionInfo = {
|
||||
version: '1.1.0',
|
||||
fullVersion: '1.1.0-20180525.0',
|
||||
version: '1.2.0',
|
||||
fullVersion: '1.2.0-20180531.0',
|
||||
title: 'Deighton AR System',
|
||||
copyright: '© 2018, Kingston Software Solutions.',
|
||||
supportEmail: 'support@kss.us.com',
|
||||
|
||||
Reference in New Issue
Block a user