Merge branch 'release/1.6.0' into rome/1.6.0

This commit is contained in:
Patrick Fic
2024-08-15 15:19:34 -07:00
25 changed files with 18188 additions and 10473 deletions

1
.npmrc Normal file
View File

@@ -0,0 +1 @@
legacy-peer-deps=true

22
App.js
View File

@@ -1,9 +1,9 @@
import { ApolloProvider } from "@apollo/client"; import { ApolloProvider } from "@apollo/client";
import React from "react"; import React from "react";
import { DefaultTheme, Provider as PaperProvider } from "react-native-paper"; import { MD2LightTheme as DefaultTheme, Provider as PaperProvider } from "react-native-paper";
import { Provider } from "react-redux"; import { Provider } from "react-redux";
import { PersistGate } from "redux-persist/integration/react"; import { PersistGate } from "redux-persist/integration/react";
import * as Sentry from "sentry-expo"; import * as Sentry from '@sentry/react-native';
import ScreenMainComponent from "./components/screen-main/screen-main.component"; import ScreenMainComponent from "./components/screen-main/screen-main.component";
import { logImEXEvent } from "./firebase/firebase.analytics"; import { logImEXEvent } from "./firebase/firebase.analytics";
import { client } from "./graphql/client"; import { client } from "./graphql/client";
@@ -17,17 +17,16 @@ import { SafeAreaProvider } from "react-native-safe-area-context";
Sentry.init({ Sentry.init({
dsn: "https://4866820768550ca396e849fa325e84d6@o492140.ingest.sentry.io/4505637419614208", dsn: "https://4866820768550ca396e849fa325e84d6@o492140.ingest.sentry.io/4505637419614208",
enableInExpoDevelopment: true, enableInExpoDevelopment: true,
tracesSampleRate: 0.2, // tracesSampleRate: 0.2,
integrations: [ // integrations: [
new Sentry.Native.ReactNativeTracing({ // new Sentry.Native.ReactNativeTracing({
tracingOrigins: ["localhost", "romeonline.io", "cloudinary.com", /^\//], // tracingOrigins: ["localhost", "imex.online", "cloudinary.com", /^\//],
// ... other options // // ... other options
}), // }),
], // ],
debug: true, // Sentry will try to print out useful debugging information if something goes wrong with sending an event. Set this to `false` in production. debug: true, // Sentry will try to print out useful debugging information if something goes wrong with sending an event. Set this to `false` in production.
}); });
Sentry.Native.nativeCrash();
const theme = { const theme = {
...DefaultTheme, ...DefaultTheme,
@@ -38,7 +37,7 @@ const theme = {
}, },
}; };
export default class App extends React.Component { class App extends React.Component {
async componentDidMount() { async componentDidMount() {
logImEXEvent("imexmobile_app_start"); logImEXEvent("imexmobile_app_start");
} }
@@ -60,3 +59,4 @@ export default class App extends React.Component {
); );
} }
} }
export default Sentry.wrap(App);

View File

@@ -11,6 +11,7 @@
}, },
"orientation": "default", "orientation": "default",
"icon": "./assets/RomeIcon.png", "icon": "./assets/RomeIcon.png",
"platforms": ["ios", "android"],
"ios": { "ios": {
"supportsTablet": true, "supportsTablet": true,
"bundleIdentifier": "com.rome.mobile", "bundleIdentifier": "com.rome.mobile",
@@ -43,6 +44,7 @@
"url": "https://u.expo.dev/df105e21-a07f-4425-af10-2200a7704a48" "url": "https://u.expo.dev/df105e21-a07f-4425-af10-2200a7704a48"
}, },
"assetBundlePatterns": ["**/*"], "assetBundlePatterns": ["**/*"],
"assetBundlePatterns": ["**/*"],
"web": { "web": {
"favicon": "./assets/RomeIcon.png", "favicon": "./assets/RomeIcon.png",
"config": { "config": {
@@ -58,11 +60,15 @@
} }
}, },
"description": "", "description": "",
"hooks": {
"postPublish": []
},
"plugins": [ "plugins": [
"sentry-expo", [
"@sentry/react-native/expo",
{
"url": "https://sentry.io/",
"organization": "imex",
"project": "imexmobile"
}
],
[ [
"expo-media-library", "expo-media-library",
{ {

View File

@@ -109,7 +109,7 @@ export function CameraSelectJob({
}} }}
> >
<Button onPress={() => hideModal()}> <Button onPress={() => hideModal()}>
<Ionicons name="ios-arrow-back" size={32} color="dodgerblue" /> <Ionicons name="arrow-back" size={32} color="dodgerblue" />
</Button> </Button>
<Searchbar <Searchbar
style={{ flex: 1 }} style={{ flex: 1 }}
@@ -135,7 +135,7 @@ export function CameraSelectJob({
if (object.item.id !== cameraJobId) return null; if (object.item.id !== cameraJobId) return null;
return ( return (
<Ionicons <Ionicons
name="ios-checkmark-circle" name="checkmark-circle"
size={24} size={24}
color="dodgerblue" color="dodgerblue"
style={{ alignSelf: "center" }} style={{ alignSelf: "center" }}

View File

@@ -8,7 +8,7 @@ import {
View, View,
} from "react-native"; } from "react-native";
import MediaCacheOverlay from "../media-cache-overlay/media-cache-overlay.component"; import MediaCacheOverlay from "../media-cache-overlay/media-cache-overlay.component";
import * as Sentry from "sentry-expo"; import * as Sentry from '@sentry/react-native';
import Toast from "react-native-toast-message"; import Toast from "react-native-toast-message";
import cleanAxios from "../../util/CleanAxios"; import cleanAxios from "../../util/CleanAxios";

View File

@@ -79,7 +79,7 @@ export function JobListItem({ setCameraJob, setCameraJobId, item }) {
> >
<Ionicons <Ionicons
style={[style, { alignSelf: "center" }]} style={[style, { alignSelf: "center" }]}
name="ios-add" name="add"
size={32} size={32}
color="dodgerblue" color="dodgerblue"
/> />

View File

@@ -1,5 +1,5 @@
import * as MediaLibrary from "expo-media-library"; import * as MediaLibrary from 'expo-media-library';
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react';
import { import {
ActivityIndicator, ActivityIndicator,
@@ -8,20 +8,20 @@ import {
StyleSheet, StyleSheet,
Text, Text,
View, View,
} from "react-native"; } from 'react-native';
import { ProgressBar } from "react-native-paper"; import { ProgressBar } from 'react-native-paper';
import Toast from "react-native-toast-message"; import Toast from 'react-native-toast-message';
import { connect } from "react-redux"; import { connect } from 'react-redux';
import { createStructuredSelector } from "reselect"; import { createStructuredSelector } from 'reselect';
import { logImEXEvent } from "../../firebase/firebase.analytics"; import { logImEXEvent } from '../../firebase/firebase.analytics';
import { import {
selectCurrentCameraJobId, selectCurrentCameraJobId,
selectDeleteAfterUpload, selectDeleteAfterUpload,
} from "../../redux/app/app.selectors"; } from '../../redux/app/app.selectors';
import * as Sentry from "sentry-expo"; import * as Sentry from '@sentry/react-native';
import { formatBytes } from "../../util/document-upload.utility"; import { formatBytes } from '../../util/document-upload.utility';
import { handleLocalUpload } from "../../util/local-document-upload.utility"; import { handleLocalUpload } from '../../util/local-document-upload.utility';
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
selectedCameraJobId: selectCurrentCameraJobId, selectedCameraJobId: selectCurrentCameraJobId,
@@ -54,7 +54,7 @@ export function UploadProgress({
async function handleOnSuccess({ duration, data }) { async function handleOnSuccess({ duration, data }) {
//If it's not in production, show a toast with the time. //If it's not in production, show a toast with the time.
Toast.show({ Toast.show({
type: "success", type: 'success',
text1: ` Upload completed in ${duration}.`, text1: ` Upload completed in ${duration}.`,
// //
// text2: duration, // text2: duration,
@@ -62,13 +62,28 @@ export function UploadProgress({
if (deleteAfterUpload) { if (deleteAfterUpload) {
try { try {
await MediaLibrary.deleteAssetsAsync(data); await MediaLibrary.deleteAssetsAsync(data);
const album = await MediaLibrary.createAlbumAsync(
'ImEX Mobile Deleted',
data.pop(),
false
);
//Move the rest.
if (data.length > 0) {
const moveResult = await MediaLibrary.addAssetsToAlbumAsync(
data,
album,
false
);
}
const deleteResult = await MediaLibrary.deleteAlbumsAsync(album);
} catch (error) { } catch (error) {
console.log("Unable to delete picture.", error); console.log('Unable to delete picture.', error);
Sentry.Native.captureException(error); Sentry.Native.captureException(error);
} }
} }
logImEXEvent("imexmobile_successful_upload"); logImEXEvent('imexmobile_successful_upload');
forceRerender(); forceRerender();
setProgress({ ...progress, speed: 0, percent: 1, uploadInProgress: false }); setProgress({ ...progress, speed: 0, percent: 1, uploadInProgress: false });
} }
@@ -83,10 +98,10 @@ export function UploadProgress({
} }
function handleOnError({ assetid, error }) { function handleOnError({ assetid, error }) {
logImEXEvent("imexmobile_upload_documents_error"); logImEXEvent('imexmobile_upload_documents_error');
Toast.show({ Toast.show({
type: "error", type: 'error',
text1: "Unable to upload documents.", text1: 'Unable to upload documents.',
text2: error, text2: error,
autoHide: false, autoHide: false,
}); });
@@ -115,7 +130,7 @@ export function UploadProgress({
onSuccess: ({ duration }) => handleOnSuccess({ duration, data }), onSuccess: ({ duration }) => handleOnSuccess({ duration, data }),
context: { context: {
jobid: jobid:
selectedCameraJobId !== "temp" ? selectedCameraJobId : "temporary", selectedCameraJobId !== 'temp' ? selectedCameraJobId : 'temporary',
}, },
}); });
}; };
@@ -123,41 +138,41 @@ export function UploadProgress({
return ( return (
<Modal <Modal
visible={progress.uploadInProgress} visible={progress.uploadInProgress}
animationType="slide" animationType='slide'
transparent={true} transparent={true}
onRequestClose={() => { onRequestClose={() => {
Alert.alert("Cancel?", "Do you want to abort the upload?", [ Alert.alert('Cancel?', 'Do you want to abort the upload?', [
{ {
text: "Yes", text: 'Yes',
onPress: () => { onPress: () => {
setUploads(null); setUploads(null);
setProgress(null); setProgress(null);
}, },
}, },
{ text: "No" }, { text: 'No' },
]); ]);
}} }}
> >
<View style={styles.modalContainer}> <View style={styles.modalContainer}>
<View style={styles.modal}> <View style={styles.modal}>
<ActivityIndicator style={{ alignSelf: "center", marginTop: 16 }} /> <ActivityIndicator style={{ alignSelf: 'center', marginTop: 16 }} />
<ProgressBar <ProgressBar
progress={progress.percent} progress={progress.percent}
style={{ alignSelf: "center", marginTop: 16 }} style={{ alignSelf: 'center', marginTop: 16 }}
color={progress.percent === 1 ? "green" : "blue"} color={progress.percent === 1 ? 'green' : 'blue'}
/> />
<Text style={{ alignSelf: "center", marginTop: 16 }}>{`${formatBytes( <Text style={{ alignSelf: 'center', marginTop: 16 }}>{`${formatBytes(
progress.speed progress.speed
)}/sec`}</Text> )}/sec`}</Text>
<Text <Text
style={{ alignSelf: "center", marginTop: 16 }} style={{ alignSelf: 'center', marginTop: 16 }}
>{`Avg. ${formatBytes( >{`Avg. ${formatBytes(
progress.loaded / ((new Date() - progress.start) / 1000) progress.loaded / ((new Date() - progress.start) / 1000)
)}/sec`}</Text> )}/sec`}</Text>
<Text <Text
style={{ alignSelf: "center", marginTop: 16 }} style={{ alignSelf: 'center', marginTop: 16 }}
>{`Total Uploaded ${formatBytes(progress.loaded)}`}</Text> >{`Total Uploaded ${formatBytes(progress.loaded)}`}</Text>
<Text style={{ alignSelf: "center", marginTop: 16 }}>{`Duration ${( <Text style={{ alignSelf: 'center', marginTop: 16 }}>{`Duration ${(
(new Date() - progress.start) / (new Date() - progress.start) /
1000 1000
).toFixed(1)} sec`}</Text> ).toFixed(1)} sec`}</Text>
@@ -168,19 +183,19 @@ export function UploadProgress({
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
modalContainer: { modalContainer: {
display: "flex", display: 'flex',
flex: 1, flex: 1,
justifyContent: "center", justifyContent: 'center',
}, },
modal: { modal: {
// flex: 1, // flex: 1,
display: "flex", display: 'flex',
marginLeft: 20, marginLeft: 20,
marginRight: 20, marginRight: 20,
backgroundColor: "white", backgroundColor: 'white',
borderRadius: 20, borderRadius: 20,
padding: 18, padding: 18,
shadowColor: "#000", shadowColor: '#000',
shadowOffset: { shadowOffset: {
width: 0, width: 0,
height: 2, height: 2,

View File

@@ -92,7 +92,7 @@ const JobsTabNavigator = connect(
navigation.navigate("MediaBrowserTab"); navigation.navigate("MediaBrowserTab");
}} }}
> >
<Ionicons name="ios-add" size={32} color="dodgerblue" /> <Ionicons name="add" size={32} color="dodgerblue" />
</Button> </Button>
), ),
})} })}
@@ -191,11 +191,11 @@ const BottomTabsNavigator = () => (
tabBarIcon: ({ color, size }) => { tabBarIcon: ({ color, size }) => {
let iconName; let iconName;
if (route.name === "JobTab") { if (route.name === "JobTab") {
iconName = "ios-list"; iconName = "list";
} else if (route.name === "MoreTab") { } else if (route.name === "MoreTab") {
iconName = "ios-settings"; iconName = "settings";
} else if (route.name === "MediaBrowserTab") { } else if (route.name === "MediaBrowserTab") {
iconName = "ios-camera"; iconName = "camera";
} else if (route.name === "TimeTicketBrowserTab") { } else if (route.name === "TimeTicketBrowserTab") {
iconName = "ios-stopwatch-outline"; iconName = "ios-stopwatch-outline";
} else { } else {

View File

@@ -1,26 +1,40 @@
import { Ionicons } from "@expo/vector-icons"; import { Ionicons } from '@expo/vector-icons';
import { AssetsSelector } from "expo-images-picker"; import { AssetsSelector } from 'expo-images-picker';
import React, { useCallback, useMemo, useState } from "react"; import { MediaType } from 'expo-media-library';
import { useTranslation } from "react-i18next"; import React, { useCallback, useMemo, useState } from 'react';
import { StyleSheet, Text, View } from "react-native"; import { useTranslation } from 'react-i18next';
import { connect } from "react-redux"; import { StyleSheet, Text, View } from 'react-native';
import { createStructuredSelector } from "reselect"; import { connect } from 'react-redux';
import { logImEXEvent } from "../../firebase/firebase.analytics"; import { createStructuredSelector } from 'reselect';
import { selectCurrentCameraJobId } from "../../redux/app/app.selectors"; import { logImEXEvent } from '../../firebase/firebase.analytics';
import CameraSelectJob from "../camera-select-job/camera-select-job.component"; import { toggleDeleteAfterUpload } from '../../redux/app/app.actions';
import JobSpaceAvailable from "../job-space-available/job-space-available.component"; import {
import UploadDeleteSwitch from "../upload-delete-switch/upload-delete-switch.component"; selectCurrentCameraJobId,
import UploadProgress from "../upload-progress/upload-progress.component"; selectDeleteAfterUpload,
import { MediaType } from "expo-media-library"; } from '../../redux/app/app.selectors';
import { selectBodyshop } from "../../redux/user/user.selectors"; import { selectBodyshop } from '../../redux/user/user.selectors';
import LocalUploadProgress from "../local-upload-progress/local-upload-progress.component"; import CameraSelectJob from '../camera-select-job/camera-select-job.component';
import JobSpaceAvailable from '../job-space-available/job-space-available.component';
import LocalUploadProgress from '../local-upload-progress/local-upload-progress.component';
import UploadDeleteSwitch from '../upload-delete-switch/upload-delete-switch.component';
import UploadProgress from '../upload-progress/upload-progress.component';
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
selectedCameraJobId: selectCurrentCameraJobId, selectedCameraJobId: selectCurrentCameraJobId,
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
deleteAfterUpload: selectDeleteAfterUpload,
}); });
export function ImageBrowserScreen({ bodyshop, selectedCameraJobId }) { const mapDispatchToProps = (dispatch) => ({
toggleDeleteAfterUpload: () => dispatch(toggleDeleteAfterUpload()),
});
export function ImageBrowserScreen({
bodyshop,
selectedCameraJobId,
//toggleDeleteAfterUpload,
// deleteAfterUpload,
}) {
const { t } = useTranslation(); const { t } = useTranslation();
const [uploads, setUploads] = useState(null); const [uploads, setUploads] = useState(null);
const [tick, setTick] = useState(0); const [tick, setTick] = useState(0);
@@ -29,18 +43,18 @@ export function ImageBrowserScreen({ bodyshop, selectedCameraJobId }) {
}, []); }, []);
const onDone = (data) => { const onDone = (data) => {
logImEXEvent("imexmobile_upload_documents", { count: data.length }); logImEXEvent('imexmobile_upload_documents', { count: data.length });
if (data.length !== 0) setUploads(data); if (data.length !== 0) setUploads(data);
}; };
const widgetErrors = useMemo( const widgetErrors = useMemo(
() => ({ () => ({
errorTextColor: "black", errorTextColor: 'black',
errorMessages: { errorMessages: {
hasErrorWithPermissions: "Please Allow media gallery permissions.", hasErrorWithPermissions: 'Please Allow media gallery permissions.',
hasErrorWithLoading: "There was an error while loading images.", hasErrorWithLoading: 'There was an error while loading images.',
hasErrorWithResizing: "There was an error while loading images.", hasErrorWithResizing: 'There was an error while loading images.',
hasNoAssets: "No images found.", hasNoAssets: 'No images found.',
}, },
}), }),
[] []
@@ -64,28 +78,28 @@ export function ImageBrowserScreen({ bodyshop, selectedCameraJobId }) {
width: 50, width: 50,
compress: 0.7, compress: 0.7,
base64: false, base64: false,
saveTo: "jpeg", saveTo: 'jpeg',
}), }),
[] []
); );
const _textStyle = { const _textStyle = {
color: "white", color: 'white',
}; };
const _buttonStyle = { const _buttonStyle = {
backgroundColor: "orange", backgroundColor: 'orange',
borderRadius: 5, borderRadius: 5,
}; };
const widgetNavigator = useMemo( const widgetNavigator = useMemo(
() => ({ () => ({
Texts: { Texts: {
finish: t("mediabrowser.actions.upload"), finish: t('mediabrowser.actions.upload'),
back: t("mediabrowser.actions.refresh"), back: t('mediabrowser.actions.refresh'),
selected: "selected", selected: 'selected',
}, },
midTextColor: "black", midTextColor: 'black',
minSelection: 1, minSelection: 1,
buttonTextStyle: styles.textStyle, buttonTextStyle: styles.textStyle,
buttonStyle: styles.buttonStyle, buttonStyle: styles.buttonStyle,
@@ -100,20 +114,20 @@ export function ImageBrowserScreen({ bodyshop, selectedCameraJobId }) {
const widgetStyles = useMemo( const widgetStyles = useMemo(
() => ({ () => ({
margin: 2, margin: 2,
bgColor: "white", bgColor: 'white',
spinnerColor: "blue", spinnerColor: 'blue',
widgetWidth: 99, widgetWidth: 99,
videoIcon: { videoIcon: {
Component: Ionicons, Component: Ionicons,
iconName: "ios-videocam", iconName: 'videocam',
color: "white", color: 'white',
size: 20, size: 20,
}, },
selectedIcon: { selectedIcon: {
Component: Ionicons, Component: Ionicons,
iconName: "ios-checkmark-circle-outline", iconName: 'checkmark-circle-outline',
color: "white", color: 'white',
bg: "rgba(35,35,35, 0.75)", bg: 'rgba(35,35,35, 0.75)',
size: 32, size: 32,
}, },
}), }),
@@ -125,7 +139,7 @@ export function ImageBrowserScreen({ bodyshop, selectedCameraJobId }) {
<CameraSelectJob /> <CameraSelectJob />
{bodyshop.uselocalmediaserver ? ( {bodyshop.uselocalmediaserver ? (
<Text style={{ margin: 10 }}> <Text style={{ margin: 10 }}>
{t("mediabrowser.labels.localserver", { {t('mediabrowser.labels.localserver', {
url: bodyshop.localmediaserverhttp, url: bodyshop.localmediaserverhttp,
})} })}
</Text> </Text>
@@ -133,15 +147,25 @@ export function ImageBrowserScreen({ bodyshop, selectedCameraJobId }) {
<JobSpaceAvailable jobid={selectedCameraJobId} key={`${tick}-space`} /> <JobSpaceAvailable jobid={selectedCameraJobId} key={`${tick}-space`} />
)} )}
<UploadDeleteSwitch /> <UploadDeleteSwitch />
{
// <Button
// onPress={() => {
// //Mutate the state
// toggleDeleteAfterUpload();
// }}
// >
// <Text>{`From screen. ${deleteAfterUpload}`}</Text>
// </Button>
}
{!selectedCameraJobId && ( {!selectedCameraJobId && (
<View <View
style={{ style={{
flex: 1, flex: 1,
justifyContent: "center", justifyContent: 'center',
alignItems: "center", alignItems: 'center',
}} }}
> >
<Text>{t("mediabrowser.labels.selectjobassetselector")}</Text> <Text>{t('mediabrowser.labels.selectjobassetselector')}</Text>
</View> </View>
)} )}
{selectedCameraJobId && ( {selectedCameraJobId && (
@@ -176,7 +200,7 @@ const styles = StyleSheet.create({
flex: 1, flex: 1,
}, },
container: { container: {
display: "flex", display: 'flex',
// position: "relative", // position: "relative",
}, },
buttonStyle: { buttonStyle: {
@@ -184,11 +208,11 @@ const styles = StyleSheet.create({
}, },
// eslint-disable-next-line react-native/no-color-literals // eslint-disable-next-line react-native/no-color-literals
textStyle: { textStyle: {
color: "dodgerblue", color: 'dodgerblue',
}, },
}); });
export default connect(mapStateToProps, null)(ImageBrowserScreen); export default connect(mapStateToProps, mapDispatchToProps)(ImageBrowserScreen);
// options={{ // options={{
// assetsType: ["photo", "video"], // assetsType: ["photo", "video"],

View File

@@ -25,7 +25,7 @@ export default function ScreenSettingsComponent() {
})} })}
</Title> </Title>
<Text>Release Channel {Updates.releaseChannel}</Text> <Text>Release Channel {Updates.channel}</Text>
<SignOutButton /> <SignOutButton />
{/* <Button title="Purge State" onPress={() => purgeStoredState()} /> */} {/* <Button title="Purge State" onPress={() => purgeStoredState()} /> */}
</View> </View>

View File

@@ -90,7 +90,7 @@ export function SignIn({ emailSignInStart, signingIn }) {
</View> </View>
<Text style={{ padding: 10, alignSelf: "center" }}> <Text style={{ padding: 10, alignSelf: "center" }}>
{t("settings.labels.version", { {t("settings.labels.version", {
number: Constants.manifest.version, number: Constants.expoConfig.version,
})} })}
</Text> </Text>
</View> </View>

View File

@@ -1,11 +1,11 @@
import React from "react"; import React from 'react';
import { useTranslation } from "react-i18next"; import { useTranslation } from 'react-i18next';
import { StyleSheet, Switch, Text, View } from "react-native"; import { StyleSheet, Text, View } from 'react-native';
import { connect } from "react-redux"; import { Checkbox } from 'react-native-paper';
import { createStructuredSelector } from "reselect"; import { connect } from 'react-redux';
import { logImEXEvent } from "../../firebase/firebase.analytics"; import { createStructuredSelector } from 'reselect';
import { toggleDeleteAfterUpload } from "../../redux/app/app.actions"; import { toggleDeleteAfterUpload } from '../../redux/app/app.actions';
import { selectDeleteAfterUpload } from "../../redux/app/app.selectors"; import { selectDeleteAfterUpload } from '../../redux/app/app.selectors';
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
deleteAfterUpload: selectDeleteAfterUpload, deleteAfterUpload: selectDeleteAfterUpload,
@@ -21,29 +21,29 @@ export function UploadDeleteSwitch({
}) { }) {
const { t } = useTranslation(); const { t } = useTranslation();
console.log('🚀 ~ deleteAfterUpload:', deleteAfterUpload);
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.text}> <Text style={styles.text}>
{t("mediabrowser.labels.deleteafterupload")} {t('mediabrowser.labels.deleteafterupload')}
</Text> </Text>
<Switch <Checkbox
trackColor={{ false: "#767577", true: "#81b0ff" }} // trackColor={{ false: '#767577', true: '#81b0ff' }}
thumbColor={deleteAfterUpload ? "tomato" : "#f4f3f4"} // thumbColor={deleteAfterUpload ? 'tomato' : '#f4f3f4'}
ios_backgroundColor="#3e3e3e" // ios_backgroundColor='#3e3e3e'
onValueChange={() => { onPress={() => {
logImEXEvent("imexmobile_toggle_delete_after_upload");
toggleDeleteAfterUpload(); toggleDeleteAfterUpload();
}} }}
value={deleteAfterUpload} status={deleteAfterUpload ? 'checked' : 'unchecked'}
/> />
</View> </View>
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
display: "flex", display: 'flex',
flexDirection: "row", flexDirection: 'row',
alignItems: "center", alignItems: 'center',
margin: 10, margin: 10,
}, },

View File

@@ -1,8 +1,8 @@
import { useApolloClient } from "@apollo/client"; import { useApolloClient } from '@apollo/client';
import * as FileSystem from "expo-file-system"; import * as FileSystem from 'expo-file-system';
import * as MediaLibrary from "expo-media-library"; import * as MediaLibrary from 'expo-media-library';
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react';
import { useTranslation } from "react-i18next"; import { useTranslation } from 'react-i18next';
import { import {
ActivityIndicator, ActivityIndicator,
Alert, Alert,
@@ -11,23 +11,23 @@ import {
StyleSheet, StyleSheet,
Text, Text,
View, View,
} from "react-native"; } from 'react-native';
import { Divider, ProgressBar } from "react-native-paper"; import { Divider, ProgressBar } from 'react-native-paper';
import Toast from "react-native-toast-message"; import Toast from 'react-native-toast-message';
import { connect } from "react-redux"; import { connect } from 'react-redux';
import { createStructuredSelector } from "reselect"; import { createStructuredSelector } from 'reselect';
import * as Sentry from "sentry-expo"; import * as Sentry from '@sentry/react-native';
import { logImEXEvent } from "../../firebase/firebase.analytics"; import { logImEXEvent } from '../../firebase/firebase.analytics';
import { GET_DOC_SIZE_TOTALS } from "../../graphql/documents.queries"; import { GET_DOC_SIZE_TOTALS } from '../../graphql/documents.queries';
import { import {
selectCurrentCameraJobId, selectCurrentCameraJobId,
selectDeleteAfterUpload, selectDeleteAfterUpload,
} from "../../redux/app/app.selectors"; } from '../../redux/app/app.selectors';
import { import {
selectBodyshop, selectBodyshop,
selectCurrentUser, selectCurrentUser,
} from "../../redux/user/user.selectors"; } from '../../redux/user/user.selectors';
import { formatBytes, handleUpload } from "../../util/document-upload.utility"; import { formatBytes, handleUpload } from '../../util/document-upload.utility';
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
currentUser: selectCurrentUser, currentUser: selectCurrentUser,
@@ -110,10 +110,10 @@ export function UploadProgress({
}); });
} }
function handleOnError(error) { function handleOnError(error) {
logImEXEvent("imexmobile_upload_documents_error", { error }); logImEXEvent('imexmobile_upload_documents_error', { error });
Toast.show({ Toast.show({
type: "error", type: 'error',
text1: "Unable to upload document.", text1: 'Unable to upload document.',
text2: error, text2: error,
autoHide: false, autoHide: false,
}); });
@@ -124,7 +124,7 @@ export function UploadProgress({
return { return {
...progress, ...progress,
uploadInProgress: true, uploadInProgress: true,
statusText: "Preparing upload...", statusText: 'Preparing upload...',
}; };
}); });
@@ -138,10 +138,10 @@ export function UploadProgress({
return (await acc) + info.size; return (await acc) + info.size;
}, 0); }, 0);
if (selectedCameraJobId !== "temp") { if (selectedCameraJobId !== 'temp') {
const queryData = await client.query({ const queryData = await client.query({
query: GET_DOC_SIZE_TOTALS, query: GET_DOC_SIZE_TOTALS,
fetchPolicy: "network-only", fetchPolicy: 'network-only',
variables: { variables: {
jobId: selectedCameraJobId, jobId: selectedCameraJobId,
}, },
@@ -161,8 +161,8 @@ export function UploadProgress({
uploadInProgress: false, uploadInProgress: false,
})); }));
Alert.alert( Alert.alert(
t("mediabrowser.labels.storageexceeded_title"), t('mediabrowser.labels.storageexceeded_title'),
t("mediabrowser.labels.storageexceeded") t('mediabrowser.labels.storageexceeded')
); );
return; return;
} }
@@ -203,56 +203,41 @@ export function UploadProgress({
//Everything is uploaded, delete the succesful ones. //Everything is uploaded, delete the succesful ones.
if (deleteAfterUpload) { if (deleteAfterUpload) {
try { try {
console.log("Trying to Delete", filesToDelete); console.log('Trying to Delete', filesToDelete);
if (Platform.OS === "android") { if (Platform.OS === 'android') {
//Create a new asset with the first file to delete. //Create a new asset with the first file to delete.
console.log("Trying new delete."); // console.log('Trying new delete.');
await MediaLibrary.getPermissionsAsync(false);
const delres = await MediaLibrary.removeAssetsFromAlbumAsync( const album = await MediaLibrary.createAlbumAsync(
filesToDelete, 'ImEX Mobile Deleted',
filesToDelete[0].albumId filesToDelete.pop(),
false
); );
//Move the rest.
if (filesToDelete.length > 0) {
const moveResult = await MediaLibrary.addAssetsToAlbumAsync(
filesToDelete,
album,
false
);
}
const deleteResult = await MediaLibrary.deleteAlbumsAsync(album);
// const album = await MediaLibrary.createAlbumAsync( //Delete the album.
// "Deleted",
// filesToDelete.pop(),
// false
// );
// console.log(
// "🚀 ~ file: upload-progress.component.jsx ~ line 215 ~ album",
// album
// );
// //Move the rest.
// const moveResult = await MediaLibrary.addAssetsToAlbumAsync(
// filesToDelete,
// album.id,
// false
// );
// console.log(
// "🚀 ~ file: upload-progress.component.jsx ~ line 221 ~ moveResult",
// moveResult
// );
// //Delete the album.
// const deleteResult = await MediaLibrary.deleteAlbumsAsync( //This defaults to delete all assets in the album.
// album.id,
// true
// );
// console.log(
// "🚀 ~ file: upload-progress.component.jsx ~ line 228 ~ deleteResult",
// deleteResult
// );
} else { } else {
await MediaLibrary.deleteAssetsAsync(filesToDelete.map((f) => f.id)); await MediaLibrary.deleteAssetsAsync(filesToDelete.map((f) => f.id));
} }
} catch (error) { } catch (error) {
console.log("Unable to delete picture.", error); console.log('Unable to delete picture.', error);
Sentry.Native.captureException(error); Sentry.Native.captureException(error);
} }
} }
filesToDelete = []; filesToDelete = [];
Toast.show({ Toast.show({
type: "success", type: 'success',
text1: ` Upload completed.`, text1: ` Upload completed.`,
// //
// text2: duration, // text2: duration,
@@ -284,7 +269,7 @@ export function UploadProgress({
}, },
{ {
bodyshop: bodyshop, bodyshop: bodyshop,
jobId: selectedCameraJobId !== "temp" ? selectedCameraJobId : null, jobId: selectedCameraJobId !== 'temp' ? selectedCameraJobId : null,
uploaded_by: currentUser.email, uploaded_by: currentUser.email,
photo: p, photo: p,
} }
@@ -294,12 +279,12 @@ export function UploadProgress({
return ( return (
<Modal <Modal
visible={progress.uploadInProgress} visible={progress.uploadInProgress}
animationType="slide" animationType='slide'
transparent={true} transparent={true}
onRequestClose={() => { onRequestClose={() => {
Alert.alert("Cancel?", "Do you want to abort the upload?", [ Alert.alert('Cancel?', 'Do you want to abort the upload?', [
{ {
text: "Yes", text: 'Yes',
onPress: () => { onPress: () => {
setUploads(null); setUploads(null);
setProgress({ setProgress({
@@ -314,7 +299,7 @@ export function UploadProgress({
}); });
}, },
}, },
{ text: "No" }, { text: 'No' },
]); ]);
}} }}
> >
@@ -329,13 +314,13 @@ export function UploadProgress({
<ProgressBar <ProgressBar
progress={progress.files[key].percent} progress={progress.files[key].percent}
style={styles.progress} style={styles.progress}
color={progress.files[key].percent === 1 ? "green" : "blue"} color={progress.files[key].percent === 1 ? 'green' : 'blue'}
/> />
<View <View
style={{ style={{
display: "flex", display: 'flex',
flexDirection: "row", flexDirection: 'row',
alignItems: "center", alignItems: 'center',
}} }}
> >
<Text>{`${formatBytes( <Text>{`${formatBytes(
@@ -377,19 +362,19 @@ export function UploadProgress({
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
modalContainer: { modalContainer: {
display: "flex", display: 'flex',
flex: 1, flex: 1,
justifyContent: "center", justifyContent: 'center',
}, },
modal: { modal: {
//flex: 1, //flex: 1,
display: "flex", display: 'flex',
marginLeft: 20, marginLeft: 20,
marginRight: 20, marginRight: 20,
backgroundColor: "white", backgroundColor: 'white',
borderRadius: 20, borderRadius: 20,
padding: 18, padding: 18,
shadowColor: "#000", shadowColor: '#000',
shadowOffset: { shadowOffset: {
width: 0, width: 0,
height: 2, height: 2,
@@ -399,14 +384,14 @@ const styles = StyleSheet.create({
elevation: 5, elevation: 5,
}, },
centeredView: { centeredView: {
justifyContent: "center", justifyContent: 'center',
alignItems: "center", alignItems: 'center',
marginTop: 22, marginTop: 22,
}, },
progressItem: { progressItem: {
display: "flex", display: 'flex',
flexDirection: "row", flexDirection: 'row',
alignItems: "center", alignItems: 'center',
marginBottom: 12, marginBottom: 12,
marginLeft: 12, marginLeft: 12,
marginRight: 12, marginRight: 12,

View File

@@ -5,20 +5,18 @@
"build": { "build": {
"development": { "development": {
"developmentClient": true, "developmentClient": true,
"distribution": "internal", "channel": "test",
"channel": "development" "distribution": "internal"
}, },
"test": { "test": {
"releaseChannel": "test",
"channel": "test", "channel": "test",
"env": { "env": { "API_URL": "https://api.test.romeonline.io" }
"ANDROID_SDK_ROOT": "/Users/pfic/Library/Android/sdk"
}
}, },
"production": { "production": {
"channel": "production", "channel": "production",
"env": { "releaseChannel": "production",
"ANDROID_SDK_ROOT": "/Users/pfic/Library/Android/sdk" "env": { "ANDROID_SDK_ROOT": "/Users/pfic/Library/Android/sdk" }
}
} }
}, },
"submit": { "submit": {

2
env.js
View File

@@ -45,7 +45,7 @@ const ENV = {
function getEnvVars() { function getEnvVars() {
if (process.env.NODE_ENV === "development") return ENV.test; if (process.env.NODE_ENV === "development") return ENV.test;
let releaseChannel = Updates.releaseChannel; let releaseChannel = Updates.channel;
if ( if (
releaseChannel === null || releaseChannel === null ||
releaseChannel === undefined || releaseChannel === undefined ||

View File

@@ -3,8 +3,7 @@ import "firebase/auth";
import env from "../env"; import env from "../env";
import { initializeApp } from "firebase/app"; import { initializeApp } from "firebase/app";
import { getAuth, initializeAuth } from "firebase/auth"; import { getAuth, initializeAuth , getReactNativePersistence} from "firebase/auth";
import { getReactNativePersistence } from "firebase/auth/react-native";
import AsyncStorage from "@react-native-async-storage/async-storage"; import AsyncStorage from "@react-native-async-storage/async-storage";
const defaultApp = initializeApp(env.firebase); const defaultApp = initializeApp(env.firebase);

17873
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -16,87 +16,85 @@
"build:production:local:android": "eas build --profile production --platform android --local" "build:production:local:android": "eas build --profile production --platform android --local"
}, },
"dependencies": { "dependencies": {
"@apollo/client": "^3.7.17", "@apollo/client": "^3.9.5",
"@babel/preset-env": "7.22.9", "@babel/preset-env": "7.1.6",
"@expo/vector-icons": "^13.0.0", "@expo/vector-icons": "^14.0.0",
"@react-native-async-storage/async-storage": "1.18.2", "@react-native-async-storage/async-storage": "1.21.0",
"@react-native-community/art": "^1.2.0", "@react-native-community/cli-debugger-ui": "^9.0.0",
"@react-native-community/cli-debugger-ui": "^11.3.6", "@react-native-community/datetimepicker": "7.6.1",
"@react-native-community/datetimepicker": "7.2.0",
"@react-native-community/masked-view": "^0.1.11", "@react-native-community/masked-view": "^0.1.11",
"@react-navigation/bottom-tabs": "^6.5.8", "@react-navigation/bottom-tabs": "^6.3.3",
"@react-navigation/drawer": "^6.6.3", "@react-navigation/drawer": "^6.4.4",
"@react-navigation/native": "^6.1.7", "@react-navigation/native": "^6.0.12",
"@react-navigation/native-stack": "^6.9.13", "@react-navigation/native-stack": "^6.8.0",
"@react-navigation/stack": "^6.3.17", "@react-navigation/stack": "^6.2.3",
"axios": "^1.4.0", "@sentry/react-native": "5.19.1",
"axios": "^1.6.7",
"cloudinary-core": "^2.13.0", "cloudinary-core": "^2.13.0",
"dinero.js": "^1.9.1", "dinero.js": "^1.9.1",
"expo": "^49.0.0", "expo": "~50.0.8",
"expo-application": "~5.3.0", "expo-application": "~5.8.3",
"expo-av": "~13.4.1", "expo-av": "~13.10.5",
"expo-constants": "~14.4.2", "expo-constants": "~15.4.5",
"expo-dev-client": "~2.4.6", "expo-dev-client": "~3.3.9",
"expo-device": "~5.4.0", "expo-device": "~5.9.3",
"expo-file-system": "~15.4.3", "expo-file-system": "~16.0.6",
"expo-font": "~11.4.0", "expo-font": "~11.10.3",
"expo-image-manipulator": "~11.3.0", "expo-image-manipulator": "~11.8.0",
"expo-images-picker": "^2.4.1", "expo-images-picker": "^2.4.1",
"expo-localization": "~14.3.0", "expo-localization": "~14.8.3",
"expo-media-library": "~15.4.1", "expo-media-library": "~15.9.1",
"expo-permissions": "~14.2.1", "expo-status-bar": "~1.11.1",
"expo-status-bar": "~1.6.0", "expo-system-ui": "~2.9.3",
"expo-system-ui": "~2.4.0", "expo-updates": "~0.24.11",
"expo-updates": "~0.18.11", "expo-video-thumbnails": "~7.9.0",
"expo-video-thumbnails": "~7.4.0", "firebase": "^10.8.0",
"firebase": "^9.8.3", "formik": "^2.4.5",
"formik": "^2.4.3", "graphql": "^16.8.1",
"graphql": "^16.7.1", "i18next": "^21.9.1",
"i18next": "^23.4.1",
"intl": "^1.2.5", "intl": "^1.2.5",
"lodash": "^4.17.20", "lodash": "^4.17.21",
"luxon": "^3.0.3", "luxon": "^3.4.4",
"mime": "^3.0.0", "mime": "^3.0.0",
"moment": "^2.29.4", "moment": "^2.30.1",
"normalize-url": "^7.0.3", "normalize-url": "^7.0.3",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-i18next": "^13.0.3", "react-i18next": "^14.0.5",
"react-is": ">= 16.8.0", "react-is": ">=18.2.0",
"react-native": "0.72.3", "react-native": "0.73.4",
"react-native-draggable-flatlist": "^4.0.1", "react-native-draggable-flatlist": "^4.0.1",
"react-native-element-dropdown": "^2.9.0", "react-native-element-dropdown": "^2.10.1",
"react-native-gesture-handler": "~2.12.0", "react-native-gesture-handler": "~2.14.0",
"react-native-image-gallery": "^2.1.5", "react-native-image-gallery": "^2.1.5",
"react-native-image-viewing": "^0.2.2", "react-native-image-viewing": "^0.2.2",
"react-native-indicators": "^0.17.0", "react-native-indicators": "^0.17.0",
"react-native-modal-datetime-picker": "^17.0.0", "react-native-modal-datetime-picker": "^17.1.0",
"react-native-pager-view": "6.2.0", "react-native-pager-view": "6.2.3",
"react-native-paper": "^4.12.5", "react-native-paper": "^5.12.3",
"react-native-progress": "^5.0.0", "react-native-progress": "^5.0.1",
"react-native-reanimated": "~3.3.0", "react-native-reanimated": "~3.6.2",
"react-native-safe-area-context": "4.6.3", "react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.22.0", "react-native-screens": "~3.29.0",
"react-native-svg": "13.9.0", "react-native-svg": "14.1.0",
"react-native-tab-view": "3.5.2", "react-native-tab-view": "3.5.2",
"react-native-toast-message": "^2.1.5", "react-native-toast-message": "^2.2.0",
"react-native-vector-icons": "10.0.0", "react-native-vector-icons": "*",
"react-native-web": "~0.19.6", "react-native-web": "~0.19.10",
"react-redux": "^8.1.2", "react-redux": "^9.1.0",
"redux": "^4.1.2", "redux": "^5.0.1",
"redux-logger": "^3.0.6", "redux-logger": "^3.0.6",
"redux-persist": "^6.0.0", "redux-persist": "^6.0.0",
"redux-saga": "^1.1.3", "redux-saga": "^1.3.0",
"reselect": "^4.1.8", "reselect": "^5.1.0",
"sentry-expo": "~7.0.0", "subscriptions-transport-ws": "^0.9.18"
"subscriptions-transport-ws": "^0.11.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.19.3", "@babel/core": "^7.23.9",
"babel-preset-expo": "^9.5.0", "babel-preset-expo": "^10.0.1",
"eslint": "^7.27.0", "eslint": "^8.57.0",
"eslint-plugin-react": "^7.24.0", "eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-native": "^3.11.0" "eslint-plugin-react-native": "^4.1.0"
}, },
"private": true "private": true
} }

View File

@@ -40,6 +40,7 @@ const appReducer = (state = INITIAL_STATE, action) => {
documentUploadInProgress: null, documentUploadInProgress: null,
}; };
case AppActionTypes.TOGGLE_DLETE_AFTER_UPLOAD: case AppActionTypes.TOGGLE_DLETE_AFTER_UPLOAD:
console.log("It was toggled.")
return { return {
...state, ...state,
deleteAfterUpload: !state.deleteAfterUpload, deleteAfterUpload: !state.deleteAfterUpload,

View File

@@ -1,4 +1,4 @@
import { createSelector } from "reselect"; import { createSelector } from 'reselect';
const selectApp = (state) => state.app; const selectApp = (state) => state.app;

View File

@@ -1,7 +1,7 @@
//import * as Analytics from "expo-firebase-analytics";//JF:commenting out the firebase analytics portion //import * as Analytics from "expo-firebase-analytics";//JF:commenting out the firebase analytics portion
import { signInWithEmailAndPassword, signOut } from "firebase/auth"; import { signInWithEmailAndPassword, signOut } from "firebase/auth";
import { all, call, put, takeLatest } from "redux-saga/effects"; import { all, call, put, takeLatest } from "redux-saga/effects";
import * as Sentry from "sentry-expo"; import * as Sentry from '@sentry/react-native';
import { logImEXEvent } from "../../firebase/firebase.analytics"; import { logImEXEvent } from "../../firebase/firebase.analytics";
import { import {
auth, auth,
@@ -108,7 +108,7 @@ export function* onSignInSuccess() {
export function* signInSuccessSaga({ payload }) { export function* signInSuccessSaga({ payload }) {
try { try {
// Analytics.setUserId(payload.email);//JF:commenting out the firebase analytics portion // Analytics.setUserId(payload.email);//JF:commenting out the firebase analytics portion
Sentry.Native.setUser({ email: payload.email }); //Sentry.Native.setUser({ email: payload.email });
const shop = yield client.query({ query: QUERY_BODYSHOP }); const shop = yield client.query({ query: QUERY_BODYSHOP });
logImEXEvent("imexmobile_sign_in_success", payload); logImEXEvent("imexmobile_sign_in_success", payload);

View File

@@ -5,7 +5,7 @@ import { INSERT_NEW_DOCUMENT } from "../graphql/documents.queries";
import { axiosAuthInterceptorId } from "./CleanAxios"; import { axiosAuthInterceptorId } from "./CleanAxios";
import * as MediaLibrary from "expo-media-library"; import * as MediaLibrary from "expo-media-library";
import { gql } from "@apollo/client"; import { gql } from "@apollo/client";
import * as Sentry from "sentry-expo"; import * as Sentry from '@sentry/react-native';
//Context: currentUserEmail, bodyshop, jobid, invoiceid //Context: currentUserEmail, bodyshop, jobid, invoiceid

View File

@@ -2,7 +2,7 @@ import axios from "axios";
import { store } from "../redux/store"; import { store } from "../redux/store";
import mime from "mime"; import mime from "mime";
import * as MediaLibrary from "expo-media-library"; import * as MediaLibrary from "expo-media-library";
import * as Sentry from "sentry-expo"; import * as Sentry from '@sentry/react-native';
axios.interceptors.request.use( axios.interceptors.request.use(
function (config) { function (config) {

View File

@@ -1,6 +1,7 @@
const { getDefaultConfig } = require("expo/metro-config"); // This replaces `const { getDefaultConfig } = require('expo/metro-config');`
const { resolver: defaultResolver } = getDefaultConfig.getDefaultValues(); const { getSentryExpoConfig } = require('@sentry/react-native/metro');
exports.resolver = {
...defaultResolver, // This replaces `const config = getDefaultConfig(__dirname);`
sourceExts: [...defaultResolver.sourceExts, "cjs", "jsx"], const config = getSentryExpoConfig(__dirname);
};
module.exports = config;

10186
yarn.lock

File diff suppressed because it is too large Load Diff