Resolve jobs list refresh.
This commit is contained in:
14
app.json
14
app.json
@@ -2,7 +2,7 @@
|
|||||||
"expo": {
|
"expo": {
|
||||||
"name": "ImEX Mobile",
|
"name": "ImEX Mobile",
|
||||||
"slug": "imexmobile",
|
"slug": "imexmobile",
|
||||||
"version": "1.2.3",
|
"version": "1.3.0",
|
||||||
"extra": {
|
"extra": {
|
||||||
"expover": "1"
|
"expover": "1"
|
||||||
},
|
},
|
||||||
@@ -11,12 +11,12 @@
|
|||||||
"ios": {
|
"ios": {
|
||||||
"supportsTablet": true,
|
"supportsTablet": true,
|
||||||
"bundleIdentifier": "com.imex.imexmobile",
|
"bundleIdentifier": "com.imex.imexmobile",
|
||||||
"buildNumber": "1.2.3",
|
"buildNumber": "1.3.0",
|
||||||
"googleServicesFile": "./GoogleService-Info.plist"
|
"googleServicesFile": "./GoogleService-Info.plist"
|
||||||
},
|
},
|
||||||
"android": {
|
"android": {
|
||||||
"package": "com.imex.imexmobile",
|
"package": "com.imex.imexmobile",
|
||||||
"versionCode": 1020300,
|
"versionCode": 1030000,
|
||||||
"googleServicesFile": "./google-services.json"
|
"googleServicesFile": "./google-services.json"
|
||||||
},
|
},
|
||||||
"splash": {
|
"splash": {
|
||||||
@@ -29,9 +29,7 @@
|
|||||||
"updates": {
|
"updates": {
|
||||||
"fallbackToCacheTimeout": 0
|
"fallbackToCacheTimeout": 0
|
||||||
},
|
},
|
||||||
"assetBundlePatterns": [
|
"assetBundlePatterns": ["**/*"],
|
||||||
"**/*"
|
|
||||||
],
|
|
||||||
"web": {
|
"web": {
|
||||||
"favicon": "./assets/logo192noa.png",
|
"favicon": "./assets/logo192noa.png",
|
||||||
"config": {
|
"config": {
|
||||||
@@ -60,8 +58,6 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": ["sentry-expo"]
|
||||||
"sentry-expo"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { useQuery } from "@apollo/client";
|
import { useQuery } from "@apollo/client";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { RefreshControl, View, Text } from "react-native";
|
import { useTranslation } from "react-i18next";
|
||||||
import { FlatList } from "react-native-gesture-handler";
|
import { FlatList, RefreshControl, Text, View } from "react-native";
|
||||||
|
import { Button, Searchbar, Title } from "react-native-paper";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries";
|
import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries";
|
||||||
@@ -9,8 +10,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
|
|||||||
import ErrorDisplay from "../error-display/error-display.component";
|
import ErrorDisplay from "../error-display/error-display.component";
|
||||||
import JobListItem from "../job-list-item/job-list-item.component";
|
import JobListItem from "../job-list-item/job-list-item.component";
|
||||||
import LoadingDisplay from "../loading-display/loading-display.component";
|
import LoadingDisplay from "../loading-display/loading-display.component";
|
||||||
import { Title, Button, Searchbar } from "react-native-paper";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { createStackNavigator } from "@react-navigation/stack";
|
|||||||
import i18n from "i18next";
|
import i18n from "i18next";
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { Button } from "react-native-paper";
|
import { Button } from "react-native-paper";
|
||||||
import { SafeAreaView } from "react-native";
|
import { SafeAreaView } from "react-native-safe-area-context";
|
||||||
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";
|
||||||
@@ -25,7 +25,7 @@ import ScreenMediaBrowser from "../screen-media-browser/screen-media-browser.com
|
|||||||
import ScreenSettingsComponent from "../screen-settings/screen-settings.component";
|
import ScreenSettingsComponent from "../screen-settings/screen-settings.component";
|
||||||
import ScreenSignIn from "../screen-sign-in/screen-sign-in.component";
|
import ScreenSignIn from "../screen-sign-in/screen-sign-in.component";
|
||||||
import ScreenSplash from "../screen-splash/screen-splash.component";
|
import ScreenSplash from "../screen-splash/screen-splash.component";
|
||||||
import moment from "moment";
|
|
||||||
const JobStack = createStackNavigator();
|
const JobStack = createStackNavigator();
|
||||||
const MoreStack = createStackNavigator();
|
const MoreStack = createStackNavigator();
|
||||||
const BottomTabs = createBottomTabNavigator();
|
const BottomTabs = createBottomTabNavigator();
|
||||||
@@ -107,6 +107,15 @@ const MoreStackNavigator = () => (
|
|||||||
const BottomTabsNavigator = () => (
|
const BottomTabsNavigator = () => (
|
||||||
<BottomTabs.Navigator
|
<BottomTabs.Navigator
|
||||||
screenOptions={({ route }) => ({
|
screenOptions={({ route }) => ({
|
||||||
|
// tabBarActiveTintColor: "dodgerblue",
|
||||||
|
// tabBarInactiveTintColor: "slategrey",
|
||||||
|
// tabBarStyle: [
|
||||||
|
// {
|
||||||
|
// display: "flex",
|
||||||
|
// },
|
||||||
|
// null,
|
||||||
|
// ],
|
||||||
|
|
||||||
// eslint-disable-next-line react/display-name
|
// eslint-disable-next-line react/display-name
|
||||||
tabBarIcon: ({ color, size }) => {
|
tabBarIcon: ({ color, size }) => {
|
||||||
let iconName;
|
let iconName;
|
||||||
@@ -123,24 +132,27 @@ const BottomTabsNavigator = () => (
|
|||||||
return <Ionicons name={iconName} size={size} color={color} />;
|
return <Ionicons name={iconName} size={size} color={color} />;
|
||||||
},
|
},
|
||||||
})}
|
})}
|
||||||
tabBarOptions={{
|
|
||||||
activeTintColor: "dodgerblue",
|
|
||||||
inactiveTintColor: "slategrey",
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<BottomTabs.Screen
|
<BottomTabs.Screen
|
||||||
name="JobTab"
|
name="JobTab"
|
||||||
options={{ title: i18n.t("joblist.titles.jobtab") }}
|
options={{
|
||||||
|
title: i18n.t("joblist.titles.jobtab"),
|
||||||
|
|
||||||
|
headerShown: false,
|
||||||
|
}}
|
||||||
component={JobStackNavigator}
|
component={JobStackNavigator}
|
||||||
/>
|
/>
|
||||||
<BottomTabs.Screen
|
<BottomTabs.Screen
|
||||||
name="MediaBrowserTab"
|
name="MediaBrowserTab"
|
||||||
options={{ title: i18n.t("mediabrowser.titles.mediabrowsertab") }}
|
options={{
|
||||||
|
title: i18n.t("mediabrowser.titles.mediabrowsertab"),
|
||||||
|
headerShown: false,
|
||||||
|
}}
|
||||||
component={MediaBrowserStackNavigator}
|
component={MediaBrowserStackNavigator}
|
||||||
/>
|
/>
|
||||||
<BottomTabs.Screen
|
<BottomTabs.Screen
|
||||||
name="MoreTab"
|
name="MoreTab"
|
||||||
options={{ title: i18n.t("more.titles.moretab") }}
|
options={{ title: i18n.t("more.titles.moretab"), headerShown: false }}
|
||||||
component={MoreStackNavigator}
|
component={MoreStackNavigator}
|
||||||
/>
|
/>
|
||||||
</BottomTabs.Navigator>
|
</BottomTabs.Navigator>
|
||||||
@@ -155,27 +167,16 @@ export function ScreenMainComponent({
|
|||||||
checkUserSession();
|
checkUserSession();
|
||||||
}, [checkUserSession]);
|
}, [checkUserSession]);
|
||||||
|
|
||||||
const hasMobileAccess =
|
|
||||||
bodyshop &&
|
|
||||||
bodyshop.features &&
|
|
||||||
(bodyshop.features.allAccess === true ||
|
|
||||||
moment(bodyshop.features.mobile).isAfter(moment()));
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
"🚀 ~ file: screen-main.component.jsx ~ line 171 ~ hasMobileAccess",
|
|
||||||
hasMobileAccess,
|
|
||||||
bodyshop && bodyshop.features
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={{ flex: 1 }}>
|
<SafeAreaView style={{ flex: 1 }}>
|
||||||
<NavigationContainer>
|
<NavigationContainer>
|
||||||
{currentUser.authorized === null ? (
|
{currentUser.authorized === null ? (
|
||||||
<ScreenSplash />
|
<ScreenSplash />
|
||||||
) : currentUser.authorized ? (
|
) : currentUser.authorized ? (
|
||||||
bodyshop && hasMobileAccess ? (
|
bodyshop ? (
|
||||||
<BottomTabsNavigator />
|
<BottomTabsNavigator />
|
||||||
) : (
|
) : (
|
||||||
<ScreenSplash noAccess />
|
<ScreenSplash />
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
<ScreenSignIn />
|
<ScreenSignIn />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
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, useState } from "react";
|
import React, { useCallback, useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { StyleSheet, Text, View } from "react-native";
|
import { StyleSheet, Text, View } from "react-native";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -11,6 +11,7 @@ import CameraSelectJob from "../camera-select-job/camera-select-job.component";
|
|||||||
import JobSpaceAvailable from "../job-space-available/job-space-available.component";
|
import JobSpaceAvailable from "../job-space-available/job-space-available.component";
|
||||||
import UploadDeleteSwitch from "../upload-delete-switch/upload-delete-switch.component";
|
import UploadDeleteSwitch from "../upload-delete-switch/upload-delete-switch.component";
|
||||||
import UploadProgress from "../upload-progress/upload-progress.component";
|
import UploadProgress from "../upload-progress/upload-progress.component";
|
||||||
|
import { MediaType } from "expo-media-library";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
selectedCameraJobId: selectCurrentCameraJobId,
|
selectedCameraJobId: selectCurrentCameraJobId,
|
||||||
@@ -29,6 +30,93 @@ export function ImageBrowserScreen({ selectedCameraJobId }) {
|
|||||||
if (data.length !== 0) setUploads(data);
|
if (data.length !== 0) setUploads(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const widgetErrors = useMemo(
|
||||||
|
() => ({
|
||||||
|
errorTextColor: "black",
|
||||||
|
errorMessages: {
|
||||||
|
hasErrorWithPermissions: "Please Allow media gallery permissions.",
|
||||||
|
hasErrorWithLoading: "There was an error while loading images.",
|
||||||
|
hasErrorWithResizing: "There was an error while loading images.",
|
||||||
|
hasNoAssets: "No images found.",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const widgetSettings = useMemo(
|
||||||
|
() => ({
|
||||||
|
getImageMetaData: false, // true might perform slower results but gives meta data and absolute path for ios users
|
||||||
|
initialLoad: 100,
|
||||||
|
assetsType: [MediaType.photo, MediaType.video],
|
||||||
|
minSelection: 1,
|
||||||
|
maxSelection: 3,
|
||||||
|
portraitCols: 4,
|
||||||
|
landscapeCols: 4,
|
||||||
|
}),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const widgetResize = useMemo(
|
||||||
|
() => ({
|
||||||
|
width: 50,
|
||||||
|
compress: 0.7,
|
||||||
|
base64: false,
|
||||||
|
saveTo: "jpeg",
|
||||||
|
}),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const _textStyle = {
|
||||||
|
color: "white",
|
||||||
|
};
|
||||||
|
|
||||||
|
const _buttonStyle = {
|
||||||
|
backgroundColor: "orange",
|
||||||
|
borderRadius: 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
const widgetNavigator = useMemo(
|
||||||
|
() => ({
|
||||||
|
Texts: {
|
||||||
|
finish: t("mediabrowser.actions.upload"),
|
||||||
|
back: t("mediabrowser.actions.refresh"),
|
||||||
|
selected: "selected",
|
||||||
|
},
|
||||||
|
midTextColor: "black",
|
||||||
|
minSelection: 1,
|
||||||
|
buttonTextStyle: styles.textStyle,
|
||||||
|
buttonStyle: styles.buttonStyle,
|
||||||
|
onBack: () => {
|
||||||
|
forceRerender();
|
||||||
|
},
|
||||||
|
onSuccess: onDone,
|
||||||
|
}),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const widgetStyles = useMemo(
|
||||||
|
() => ({
|
||||||
|
margin: 2,
|
||||||
|
bgColor: "white",
|
||||||
|
spinnerColor: "blue",
|
||||||
|
widgetWidth: 99,
|
||||||
|
videoIcon: {
|
||||||
|
Component: Ionicons,
|
||||||
|
iconName: "ios-videocam",
|
||||||
|
color: "white",
|
||||||
|
size: 20,
|
||||||
|
},
|
||||||
|
selectedIcon: {
|
||||||
|
Component: Ionicons,
|
||||||
|
iconName: "ios-checkmark-circle-outline",
|
||||||
|
color: "white",
|
||||||
|
bg: "rgba(35,35,35, 0.75)",
|
||||||
|
size: 32,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.flex, styles.container]}>
|
<View style={[styles.flex, styles.container]}>
|
||||||
<CameraSelectJob />
|
<CameraSelectJob />
|
||||||
@@ -49,62 +137,10 @@ export function ImageBrowserScreen({ selectedCameraJobId }) {
|
|||||||
<AssetsSelector
|
<AssetsSelector
|
||||||
style={{ flex: 1 }}
|
style={{ flex: 1 }}
|
||||||
key={tick}
|
key={tick}
|
||||||
options={{
|
Settings={widgetSettings}
|
||||||
assetsType: ["photo", "video"],
|
Errors={widgetErrors}
|
||||||
margin: 3,
|
Styles={widgetStyles}
|
||||||
portraitCols: 4,
|
Navigator={widgetNavigator}
|
||||||
landscapeCols: 6,
|
|
||||||
widgetWidth: 100,
|
|
||||||
widgetBgColor: "white",
|
|
||||||
selectedBgColor: "#adadad",
|
|
||||||
spinnerColor: "#c8c8c8",
|
|
||||||
videoIcon: {
|
|
||||||
Component: Ionicons,
|
|
||||||
iconName: "ios-videocam",
|
|
||||||
color: "white",
|
|
||||||
size: 20,
|
|
||||||
},
|
|
||||||
selectedIcon: {
|
|
||||||
Component: Ionicons,
|
|
||||||
iconName: "ios-checkmark-circle-outline",
|
|
||||||
color: "white",
|
|
||||||
bg: "rgba(35,35,35, 0.75)",
|
|
||||||
size: 32,
|
|
||||||
},
|
|
||||||
defaultTopNavigator: {
|
|
||||||
continueText: t("mediabrowser.actions.upload"),
|
|
||||||
goBackText: t("mediabrowser.actions.refresh"),
|
|
||||||
buttonStyle: styles.buttonStyle,
|
|
||||||
textStyle: styles.textStyle,
|
|
||||||
backFunction: () => {
|
|
||||||
forceRerender();
|
|
||||||
},
|
|
||||||
doneFunction: onDone,
|
|
||||||
},
|
|
||||||
|
|
||||||
noAssets: {
|
|
||||||
Component: function NoAsset() {
|
|
||||||
return (
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
flex: 1,
|
|
||||||
height: 200,
|
|
||||||
marginHorizontal: 20,
|
|
||||||
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Ionicons name="ios-camera" size={72} />
|
|
||||||
<Text style={{ textAlign: "center", marginTop: 10 }}>
|
|
||||||
{t("mediabrowser.labels.nomedia")}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<UploadProgress uploads={uploads} forceRerender={forceRerender} />
|
<UploadProgress uploads={uploads} forceRerender={forceRerender} />
|
||||||
@@ -130,3 +166,60 @@ const styles = StyleSheet.create({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, null)(ImageBrowserScreen);
|
export default connect(mapStateToProps, null)(ImageBrowserScreen);
|
||||||
|
|
||||||
|
// options={{
|
||||||
|
// assetsType: ["photo", "video"],
|
||||||
|
// margin: 3,
|
||||||
|
// portraitCols: 4,
|
||||||
|
// landscapeCols: 6,
|
||||||
|
// widgetWidth: 100,
|
||||||
|
// widgetBgColor: "white",
|
||||||
|
// selectedBgColor: "#adadad",
|
||||||
|
// spinnerColor: "#c8c8c8",
|
||||||
|
// videoIcon: {
|
||||||
|
// Component: Ionicons,
|
||||||
|
// iconName: "ios-videocam",
|
||||||
|
// color: "white",
|
||||||
|
// size: 20,
|
||||||
|
// },
|
||||||
|
// selectedIcon: {
|
||||||
|
// Component: Ionicons,
|
||||||
|
// iconName: "ios-checkmark-circle-outline",
|
||||||
|
// color: "white",
|
||||||
|
// bg: "rgba(35,35,35, 0.75)",
|
||||||
|
// size: 32,
|
||||||
|
// },
|
||||||
|
// defaultTopNavigator: {
|
||||||
|
// continueText: t("mediabrowser.actions.upload"),
|
||||||
|
// goBackText: t("mediabrowser.actions.refresh"),
|
||||||
|
// buttonStyle: styles.buttonStyle,
|
||||||
|
// textStyle: styles.textStyle,
|
||||||
|
// backFunction: () => {
|
||||||
|
// forceRerender();
|
||||||
|
// },
|
||||||
|
// doneFunction: onDone,
|
||||||
|
// },
|
||||||
|
|
||||||
|
// noAssets: {
|
||||||
|
// Component: function NoAsset() {
|
||||||
|
// return (
|
||||||
|
// <View
|
||||||
|
// style={{
|
||||||
|
// display: "flex",
|
||||||
|
// flex: 1,
|
||||||
|
// height: 200,
|
||||||
|
// marginHorizontal: 20,
|
||||||
|
|
||||||
|
// alignItems: "center",
|
||||||
|
// justifyContent: "center",
|
||||||
|
// }}
|
||||||
|
// >
|
||||||
|
// <Ionicons name="ios-camera" size={72} />
|
||||||
|
// <Text style={{ textAlign: "center", marginTop: 10 }}>
|
||||||
|
// {t("mediabrowser.labels.nomedia")}
|
||||||
|
// </Text>
|
||||||
|
// </View>
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// }}
|
||||||
|
|||||||
Reference in New Issue
Block a user