Check for mobile app access.
This commit is contained in:
@@ -24,6 +24,27 @@
|
|||||||
<folder_node>
|
<folder_node>
|
||||||
<name>app</name>
|
<name>app</name>
|
||||||
<children>
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>nomobileaccess</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>title</name>
|
<name>title</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -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();
|
||||||
@@ -155,16 +155,27 @@ 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 ? (
|
bodyshop && hasMobileAccess ? (
|
||||||
<BottomTabsNavigator />
|
<BottomTabsNavigator />
|
||||||
) : (
|
) : (
|
||||||
<ScreenSplash />
|
<ScreenSplash noAccess />
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
<ScreenSignIn />
|
<ScreenSignIn />
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { ActivityIndicator, Image, StyleSheet, View } from "react-native";
|
import { ActivityIndicator, Image, StyleSheet, View } from "react-native";
|
||||||
import { Title } from "react-native-paper";
|
import { Title, Subheading } from "react-native-paper";
|
||||||
import Logo from "../../assets/logo192.png";
|
import Logo from "../../assets/logo192.png";
|
||||||
|
|
||||||
export default function ScreenSplash() {
|
export default function ScreenSplash({ noAccess }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<View style={[localStyles.container]}>
|
<View style={[localStyles.container]}>
|
||||||
@@ -13,7 +13,15 @@ export default function ScreenSplash() {
|
|||||||
<Title>{t("app.title")}</Title>
|
<Title>{t("app.title")}</Title>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<ActivityIndicator color="dodgerblue" size="large" />
|
{noAccess ? (
|
||||||
|
<View style={[localStyles.logoContainer]}>
|
||||||
|
<Subheading style={{ textAlign: "center" }}>
|
||||||
|
{t("app.nomobileaccess")}
|
||||||
|
</Subheading>
|
||||||
|
</View>
|
||||||
|
) : (
|
||||||
|
<ActivityIndicator color="dodgerblue" size="large" />
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,13 +6,10 @@ export const QUERY_BODYSHOP = gql`
|
|||||||
id
|
id
|
||||||
jobsizelimit
|
jobsizelimit
|
||||||
md_ro_statuses
|
md_ro_statuses
|
||||||
md_order_statuses
|
|
||||||
shopname
|
shopname
|
||||||
messagingservicesid
|
|
||||||
md_referral_sources
|
features
|
||||||
md_messaging_presets
|
|
||||||
md_parts_locations
|
|
||||||
md_notes_presets
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -67,14 +67,13 @@ const link = split(
|
|||||||
// split based on operation type
|
// split based on operation type
|
||||||
({ query }) => {
|
({ query }) => {
|
||||||
const definition = getMainDefinition(query);
|
const definition = getMainDefinition(query);
|
||||||
// console.log(
|
console.log(
|
||||||
// "##Intercepted GQL Transaction : " +
|
"##Intercepted GQL Transaction : " +
|
||||||
// definition.operation +
|
definition.operation +
|
||||||
// "|" +
|
"|" +
|
||||||
// definition.name.value +
|
// definition.name.value +
|
||||||
// "##",
|
"##"
|
||||||
// query
|
);
|
||||||
// );
|
|
||||||
return (
|
return (
|
||||||
definition.kind === "OperationDefinition" &&
|
definition.kind === "OperationDefinition" &&
|
||||||
definition.operation === "subscription"
|
definition.operation === "subscription"
|
||||||
@@ -133,6 +132,10 @@ export const client = new ApolloClient({
|
|||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
watchQuery: {
|
watchQuery: {
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
|
nextFetchPolicy: "network-only",
|
||||||
|
},
|
||||||
|
query: {
|
||||||
|
fetchPolicy: "network-only",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"translation": {
|
"translation": {
|
||||||
"app": {
|
"app": {
|
||||||
|
"nomobileaccess": "Your shop does not currently have access to ImEX Mobile. ",
|
||||||
"title": "ImEX Mobile"
|
"title": "ImEX Mobile"
|
||||||
},
|
},
|
||||||
"camera": {
|
"camera": {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"translation": {
|
"translation": {
|
||||||
"app": {
|
"app": {
|
||||||
|
"nomobileaccess": "",
|
||||||
"title": ""
|
"title": ""
|
||||||
},
|
},
|
||||||
"camera": {
|
"camera": {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"translation": {
|
"translation": {
|
||||||
"app": {
|
"app": {
|
||||||
|
"nomobileaccess": "",
|
||||||
"title": ""
|
"title": ""
|
||||||
},
|
},
|
||||||
"camera": {
|
"camera": {
|
||||||
|
|||||||
Reference in New Issue
Block a user