Changed image viewer and added mobile feature check.

This commit is contained in:
Patrick Fic
2022-06-20 16:53:13 -07:00
parent 67312c1847
commit 49b77315ba
13 changed files with 406 additions and 395 deletions

View File

@@ -3,6 +3,7 @@ import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import i18n from "i18next";
import moment from "moment";
import React, { useEffect } from "react";
import { Button } from "react-native-paper";
import { SafeAreaView } from "react-native-safe-area-context";
@@ -174,7 +175,11 @@ export function ScreenMainComponent({
<ScreenSplash />
) : currentUser.authorized ? (
bodyshop ? (
<BottomTabsNavigator />
HasAccess(bodyshop) ? (
<BottomTabsNavigator />
) : (
<ScreenSplash noAccess />
)
) : (
<ScreenSplash />
)
@@ -189,3 +194,10 @@ export default connect(
mapStateToProps,
mapDispatchToProps
)(ScreenMainComponent);
function HasAccess({ features }) {
if (features.mobile === undefined) return true;
if (features.mobile === false) return false;
const d = moment(moment(features.mobile));
if (d.isValid()) return d.isAfter(moment());
}