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