2nd set of WIP changes.

This commit is contained in:
Patrick Fic
2024-02-28 08:50:51 -08:00
parent 8e9fa7f81b
commit 93f77255e2
19 changed files with 748 additions and 10814 deletions

20
App.js
View File

@@ -3,7 +3,7 @@ import React from "react";
import { DefaultTheme, Provider as PaperProvider } from "react-native-paper";
import { Provider } from "react-redux";
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 { logImEXEvent } from "./firebase/firebase.analytics";
import { client } from "./graphql/client";
@@ -17,17 +17,16 @@ import { SafeAreaProvider } from "react-native-safe-area-context";
Sentry.init({
dsn: "https://8d6c3de1940a4e4f8b81cf4d2150bdea@o492140.ingest.sentry.io/5558869",
enableInExpoDevelopment: true,
tracesSampleRate: 0.2,
integrations: [
new Sentry.Native.ReactNativeTracing({
tracingOrigins: ["localhost", "imex.online", "cloudinary.com", /^\//],
// ... other options
}),
],
// tracesSampleRate: 0.2,
// integrations: [
// new Sentry.Native.ReactNativeTracing({
// tracingOrigins: ["localhost", "imex.online", "cloudinary.com", /^\//],
// // ... 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.
});
Sentry.Native.nativeCrash();
const theme = {
...DefaultTheme,
@@ -38,7 +37,7 @@ const theme = {
},
};
export default class App extends React.Component {
class App extends React.Component {
async componentDidMount() {
logImEXEvent("imexmobile_app_start");
}
@@ -60,3 +59,4 @@ export default class App extends React.Component {
);
}
}
export default Sentry.wrap(App);

View File

@@ -2,7 +2,7 @@
"expo": {
"name": "ImEX Mobile",
"slug": "imexmobile",
"version": "1.4.1",
"version": "1.6.0",
"extra": {
"expover": "1",
"eas": {
@@ -11,6 +11,7 @@
},
"orientation": "default",
"icon": "./assets/logo192noa.png",
"platforms": ["ios", "android"],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.imex.imexmobile",
@@ -23,7 +24,7 @@
},
"android": {
"package": "com.imex.imexmobile",
"versionCode": 1100025,
"versionCode": 1100026,
"googleServicesFile": "./google-services.json",
"permissions": [
"android.permission.READ_EXTERNAL_STORAGE",
@@ -41,9 +42,7 @@
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"assetBundlePatterns": ["**/*"],
"web": {
"favicon": "./assets/logo192noa.png",
"config": {
@@ -60,20 +59,15 @@
}
},
"description": "",
"hooks": {
"postPublish": [
{
"file": "sentry-expo/upload-sourcemaps",
"config": {
"organization": "snapt-software",
"project": "imexmobile",
"authToken": "32fed1c2d5a8440da684b624ee678874b64c51bb9b0b4b608ab4a15516d6dd02"
}
}
]
},
"plugins": [
"sentry-expo",
[
"@sentry/react-native/expo",
{
"url": "https://sentry.io/",
"organization": "imex",
"project": "imexmobile"
}
],
[
"expo-media-library",
{

View File

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

View File

@@ -8,7 +8,7 @@ import {
View,
} from "react-native";
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 cleanAxios from "../../util/CleanAxios";

View File

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

View File

@@ -18,7 +18,7 @@ import {
selectCurrentCameraJobId,
selectDeleteAfterUpload,
} 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 { handleLocalUpload } from "../../util/local-document-upload.utility";

View File

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

View File

@@ -105,13 +105,13 @@ export function ImageBrowserScreen({ bodyshop, selectedCameraJobId }) {
widgetWidth: 99,
videoIcon: {
Component: Ionicons,
iconName: "ios-videocam",
iconName: "videocam",
color: "white",
size: 20,
},
selectedIcon: {
Component: Ionicons,
iconName: "ios-checkmark-circle-outline",
iconName: "checkmark-circle-outline",
color: "white",
bg: "rgba(35,35,35, 0.75)",
size: 32,

View File

@@ -21,7 +21,7 @@ export default function ScreenSettingsComponent() {
>
<Title>
{t("settings.labels.version", {
number: `${Constants.manifest.version}-${Constants.manifest.extra.expover}`,
number: `${Constants.expoConfig.version}-${Constants.expoConfig.extra.expover}`,
})}
</Title>

View File

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

View File

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

View File

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

View File

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

1715
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -1,7 +1,7 @@
//import * as Analytics from "expo-firebase-analytics";//JF:commenting out the firebase analytics portion
import { signInWithEmailAndPassword, signOut } from "firebase/auth";
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 {
auth,
@@ -108,7 +108,7 @@ export function* onSignInSuccess() {
export function* signInSuccessSaga({ payload }) {
try {
// 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 });
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 * as MediaLibrary from "expo-media-library";
import { gql } from "@apollo/client";
import * as Sentry from "sentry-expo";
import * as Sentry from '@sentry/react-native';
//Context: currentUserEmail, bodyshop, jobid, invoiceid

View File

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

9480
yarn.lock

File diff suppressed because it is too large Load Diff