Update handling of local images in app.
This commit is contained in:
22
app.json
22
app.json
@@ -4,20 +4,32 @@
|
||||
"slug": "imexmobile",
|
||||
"version": "1.4.0",
|
||||
"extra": {
|
||||
"expover": "1"
|
||||
"expover": "3",
|
||||
"eas": {
|
||||
"projectId": "ffe01f3a-d507-4698-82cd-da1f1cad450b"
|
||||
}
|
||||
},
|
||||
"orientation": "default",
|
||||
"icon": "./assets/logo192noa.png",
|
||||
"ios": {
|
||||
"supportsTablet": true,
|
||||
"bundleIdentifier": "com.imex.imexmobile",
|
||||
"buildNumber": "1",
|
||||
"googleServicesFile": "./GoogleService-Info.plist"
|
||||
"buildNumber": "3",
|
||||
"googleServicesFile": "./GoogleService-Info.plist",
|
||||
"infoPlist": {
|
||||
"NSPhotoLibraryUsageDescription": "Allow $(PRODUCT_NAME) to access your photos.",
|
||||
"NSPhotoLibraryAddUsageDescription": "Allow $(PRODUCT_NAME) to save photos."
|
||||
}
|
||||
},
|
||||
"android": {
|
||||
"package": "com.imex.imexmobile",
|
||||
"versionCode": 1100022,
|
||||
"googleServicesFile": "./google-services.json"
|
||||
"versionCode": 1100024,
|
||||
"googleServicesFile": "./google-services.json",
|
||||
"permissions": [
|
||||
"android.permission.READ_EXTERNAL_STORAGE",
|
||||
"android.permission.WRITE_EXTERNAL_STORAGE",
|
||||
"android.permission.ACCESS_MEDIA_LOCATION"
|
||||
]
|
||||
},
|
||||
"splash": {
|
||||
"image": "./assets/Splash.png",
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
} from "react-native";
|
||||
import MediaCacheOverlay from "../media-cache-overlay/media-cache-overlay.component";
|
||||
import * as Sentry from "sentry-expo";
|
||||
import Toast from "react-native-toast-message";
|
||||
|
||||
import cleanAxios from "../../util/CleanAxios";
|
||||
|
||||
@@ -71,7 +72,14 @@ export default function JobDocumentsLocalComponent({ bodyshop, job }) {
|
||||
}
|
||||
|
||||
async function getPhotos({ bodyshop, jobid, setImages }) {
|
||||
const localmediaserverhttp = bodyshop.localmediaserverhttp.trim();
|
||||
let localmediaserverhttp = bodyshop.localmediaserverhttp.trim();
|
||||
if (localmediaserverhttp.endsWith("/")) {
|
||||
localmediaserverhttp = localmediaserverhttp.slice(0, -1);
|
||||
}
|
||||
console.log(
|
||||
"🚀 ~ file: job-documents-local.component.jsx ~ line 78 ~ localmediaserverhttp",
|
||||
localmediaserverhttp
|
||||
);
|
||||
try {
|
||||
const imagesFetch = await cleanAxios.post(
|
||||
`${localmediaserverhttp}/jobs/list`,
|
||||
@@ -86,18 +94,22 @@ async function getPhotos({ bodyshop, jobid, setImages }) {
|
||||
.map((d, idx) => {
|
||||
return {
|
||||
...d,
|
||||
// src: `${bodyshop.localmediaserverhttp}/${d.src}`.replace("//", "/"),
|
||||
// src: `${localmediaserverhttp}/${d.src}`,
|
||||
|
||||
uri: `${bodyshop.localmediaserverhttp}/${d.src}`.replace("//", "/"),
|
||||
thumbUrl: `${bodyshop.localmediaserverhttp}/${d.thumbnail}`.replace(
|
||||
"//",
|
||||
"/"
|
||||
),
|
||||
uri: `${localmediaserverhttp}${d.src}`,
|
||||
thumbUrl: `${localmediaserverhttp}${d.thumbnail}`,
|
||||
id: idx,
|
||||
};
|
||||
});
|
||||
|
||||
setImages(normalizedImages);
|
||||
} catch (error) {
|
||||
Sentry.Native.captureException(error);
|
||||
Toast.show({
|
||||
type: "error",
|
||||
text1: `Error fetching photos.`,
|
||||
|
||||
text2: JSON.stringify(error),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user