diff --git a/components/job-list-item/job-list-item.component.jsx b/components/job-list-item/job-list-item.component.jsx index f33ba6b..0e0c780 100644 --- a/components/job-list-item/job-list-item.component.jsx +++ b/components/job-list-item/job-list-item.component.jsx @@ -6,25 +6,40 @@ import { useTranslation } from "react-i18next"; import { StyleSheet, Text, View } from "react-native"; import { TouchableOpacity } from "react-native-gesture-handler"; import Swipeable from "react-native-gesture-handler/Swipeable"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { setCameraJob, setCameraJobId } from "../../redux/app/app.actions"; import styles from "../styles"; -const RenderRightAction = (props) => { - const navigation = useNavigation(); - const { t } = useTranslation(); - return ( - navigation.push("JobCamera")} - > - - {t("joblist.actions.swipecamera")} - - ); -}; +const mapStateToProps = createStructuredSelector({ + //currentUser: selectCurrentUser +}); +const mapDispatchToProps = (dispatch) => ({ + setCameraJobId: (id) => dispatch(setCameraJobId(id)), + setCameraJob: (job) => dispatch(setCameraJob(job)), +}); -export default function JobListItem({ item }) { +export function JobListItem({ setCameraJob, setCameraJobId, item }) { const navigation = useNavigation(); - + const RenderRightAction = (props) => { + const navigation = useNavigation(); + const { t } = useTranslation(); + return ( + { + setCameraJobId(item.id); + setCameraJob(item); + navigation.navigate("TabCamera"); + }} + > + + + {t("joblist.actions.swipecamera")} + + + ); + }; const onPress = () => { navigation.push("JobDetail", { jobId: item.id, @@ -73,3 +88,4 @@ const localStyles = StyleSheet.create({ marginLeft: 15, }, }); +export default connect(mapStateToProps, mapDispatchToProps)(JobListItem); diff --git a/components/screen-camera-job-search/screen-camera-job-search.component.jsx b/components/screen-camera-job-search/screen-camera-job-search.component.jsx new file mode 100644 index 0000000..2c3b6dc --- /dev/null +++ b/components/screen-camera-job-search/screen-camera-job-search.component.jsx @@ -0,0 +1,10 @@ +import React from "react"; +import { Text, View } from "react-native"; + +export default function ScreenCameraJobSearch() { + return ( + + This is the media cache screen. + + ); +} diff --git a/components/screen-camera-roll/screen-camera-roll.component.jsx b/components/screen-camera-roll/screen-camera-roll.component.jsx new file mode 100644 index 0000000..bcf5b97 --- /dev/null +++ b/components/screen-camera-roll/screen-camera-roll.component.jsx @@ -0,0 +1,213 @@ +import React, { Component } from "react"; +import { + ActivityIndicator, + Button, + Clipboard, + Image, + Share, + StatusBar, + StyleSheet, + Text, + TouchableOpacity, + View, +} from "react-native"; +import { Constants } from "expo"; +import * as Permissions from "expo-permissions"; +import * as ImagePicker from "expo-image-picker"; +export default class ScreenCameraRoll extends Component { + state = { + image: null, + uploading: false, + }; + + render() { + let { image } = this.state; + + return ( + + + + + Example: Upload ImagePicker result + + + + + ); } - -const styles = StyleSheet.create({ - container: { - alignItems: "center", - flex: 1, - justifyContent: "center", - }, - exampleText: { - fontSize: 20, - marginBottom: 20, - marginHorizontal: 15, - textAlign: "center", - }, - maybeRenderUploading: { - alignItems: "center", - backgroundColor: "rgba(0,0,0,0.4)", - justifyContent: "center", - }, - maybeRenderContainer: { - borderRadius: 3, - elevation: 2, - marginTop: 30, - shadowColor: "rgba(0,0,0,1)", - shadowOpacity: 0.2, - shadowOffset: { - height: 4, - width: 4, - }, - shadowRadius: 5, - width: 250, - }, - maybeRenderImageContainer: { - borderTopLeftRadius: 3, - borderTopRightRadius: 3, - overflow: "hidden", - }, - maybeRenderImage: { - height: 250, - width: 250, - }, - maybeRenderImageText: { - paddingHorizontal: 10, - paddingVertical: 10, - }, -}); diff --git a/package-lock.json b/package-lock.json index 0bcb5a6..f820008 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4024,6 +4024,22 @@ "fontfaceobserver": "^2.1.0" } }, + "expo-image-picker": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/expo-image-picker/-/expo-image-picker-9.1.1.tgz", + "integrity": "sha512-Etz2OQhRflfx+xFbSdma8QLZsnV/yq0M/yqYlsi3/RLiWAQYM/D/VmRfDDPiG10gm+KX3Xb5iKplNjPrWeTuQg==", + "requires": { + "expo-permissions": "~9.3.0", + "uuid": "7.0.2" + }, + "dependencies": { + "uuid": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.2.tgz", + "integrity": "sha512-vy9V/+pKG+5ZTYKf+VcphF5Oc6EFiu3W8Nv3P3zIh0EqVI80ZxOzuPfe9EHjkFNvf8+xuTHVeei4Drydlx4zjw==" + } + } + }, "expo-keep-awake": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/expo-keep-awake/-/expo-keep-awake-8.3.0.tgz", @@ -4057,6 +4073,11 @@ "resolved": "https://registry.npmjs.org/expo-location/-/expo-location-9.0.1.tgz", "integrity": "sha512-yl4V2IelxrjG1h3nshkyILwghysNJvvEuR4Of0U7oYAsBrT0cq8NxFuaDemRvqt9Yb19wVFNMoVtYFNpthcqpQ==" }, + "expo-media-library": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/expo-media-library/-/expo-media-library-9.2.1.tgz", + "integrity": "sha512-A9AAGI1200P0oULoXA7U7wQ91zgPWl9GWo5H9EQvVDHp1ABX8tf2qTOad6Y0KotHYWVMIyfsVXzVYAbjJ9LxPQ==" + }, "expo-permissions": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/expo-permissions/-/expo-permissions-9.3.0.tgz", diff --git a/redux/app/app.actions.js b/redux/app/app.actions.js index 9e536c4..7c906be 100644 --- a/redux/app/app.actions.js +++ b/redux/app/app.actions.js @@ -5,6 +5,11 @@ export const setCameraJobId = (jobId) => ({ payload: jobId, }); +export const setCameraJob = (job) => ({ + type: AppActionTypes.SET_CAMERA_JOB, + payload: job, +}); + export const documentUploadStart = (jobId) => ({ type: AppActionTypes.DOCUMENT_UPLOAD_START, payload: jobId, diff --git a/redux/app/app.reducer.js b/redux/app/app.reducer.js index 8799af8..0ed3ae3 100644 --- a/redux/app/app.reducer.js +++ b/redux/app/app.reducer.js @@ -2,6 +2,7 @@ import AppActionTypes from "./app.types"; const INITIAL_STATE = { cameraJobId: null, + cameraJob: null, documentUploadInProgress: null, documentUploadError: null, }; @@ -13,6 +14,11 @@ const appReducer = (state = INITIAL_STATE, action) => { ...state, cameraJobId: action.payload, }; + case AppActionTypes.SET_CAMERA_JOB: + return { + ...state, + cameraJob: action.payload, + }; case AppActionTypes.DOCUMENT_UPLOAD_START: return { ...state, diff --git a/redux/app/app.selectors.js b/redux/app/app.selectors.js index 537c353..1ea895a 100644 --- a/redux/app/app.selectors.js +++ b/redux/app/app.selectors.js @@ -4,13 +4,17 @@ const selectApp = (state) => state.app; export const selectCurrentCameraJobId = createSelector( [selectApp], - (user) => app.cameraJobId + (app) => app.cameraJobId +); +export const selectCurrentCameraJob = createSelector( + [selectApp], + (app) => app.cameraJob ); export const selectDocumentUploadInProgress = createSelector( [selectApp], - (user) => app.documentUploadInProgress + (app) => app.documentUploadInProgress ); export const selectDocumentUploadError = createSelector( [selectApp], - (user) => app.documentUploadError + (app) => app.documentUploadError ); diff --git a/redux/app/app.types.js b/redux/app/app.types.js index b370bf7..2cf7f79 100644 --- a/redux/app/app.types.js +++ b/redux/app/app.types.js @@ -1,5 +1,6 @@ const AppActionTypes = { SET_CAMERA_JOB_ID: "SET_CAMERA_JOB_ID", + SET_CAMERA_JOB: "SET_CAMERA_JOB", DOCUMENT_UPLOAD_START: "DOCUMENT_UPLOAD_START", DOCUMNET_UPLOAD_SUCCESS: "DOCUMNET_UPLOAD_SUCCESS", DOCUMENT_UPLOAD_FAILURE: "DOCUMENT_UPLOAD_FAILURE",