Skip to content

Commit

Permalink
Merge pull request #114 from swapnilphalke03/NewFeat-auth
Browse files Browse the repository at this point in the history
Task# 233634/233632/233631/232942/232941/233636/233635
  • Loading branch information
rushi-tekdi authored Jan 22, 2025
2 parents 85a4b11 + a57b11c commit 9538325
Show file tree
Hide file tree
Showing 64 changed files with 6,847 additions and 4,626 deletions.
3,827 changes: 1,918 additions & 1,909 deletions android/app/src/main/assets/index.android.bundle

Large diffs are not rendered by default.

726 changes: 717 additions & 9 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"react-native-calendars": "^1.1307.0",
"react-native-check-version": "^1.3.0",
"react-native-config": "^1.5.2",
"react-native-copilot": "^3.3.3",
"react-native-device-info": "^11.1.0",
"react-native-fs": "^2.20.0",
"react-native-geolocation-service": "^5.3.1",
Expand All @@ -67,6 +68,7 @@
"react-native-linear-gradient": "^2.8.3",
"react-native-navigation-bar-color": "^2.0.2",
"react-native-orientation-locker": "^1.7.0",
"react-native-otp-entry": "^1.8.2",
"react-native-pdf": "^6.7.5",
"react-native-push-notification": "^8.1.1",
"react-native-reanimated": "^3.12.1",
Expand All @@ -79,7 +81,7 @@
"react-native-swiper-flatlist": "^3.2.5",
"react-native-uuid": "^2.0.2",
"react-native-vector-icons": "^10.1.0",
"react-native-webview": "^13.10.5",
"react-native-webview": "^13.12.5",
"react-native-zip-archive": "^7.0.0",
"yup": "^1.4.0"
},
Expand Down
18 changes: 12 additions & 6 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { NetworkProvider } from './context/NetworkContext'; // Adjust path as ne
import { ConfirmationProvider } from '@context/Confirmation/ConfirmationContext';
import changeNavigationBarColor from 'react-native-navigation-bar-color';
import StackScreen from './Routes/Public/StackScreen';
import { BackHandler, Text, View } from 'react-native';
import { BackHandler, Dimensions, Text, View } from 'react-native';
import { PermissionsAndroid, Platform, Alert } from 'react-native';
import {
getDataFromStorage,
Expand All @@ -24,6 +24,7 @@ import PushNotification from 'react-native-push-notification';
import { notificationSubscribe } from './utils/API/AuthService';

import GlobalText from '@components/GlobalText/GlobalText';
import { CopilotProvider } from 'react-native-copilot';

const linking = {
prefixes: ['pratham://'],
Expand Down Expand Up @@ -198,11 +199,16 @@ const App = () => {
{/* // App.js file has to be wrapped with ApplicationProvider for UI Kitten to
work */}
<ApplicationProvider {...eva} theme={{ ...eva.light, ...theme }}>
<NavigationContainer linking={linking}>
<Suspense fallback={<GlobalText>Loading Screen...</GlobalText>}>
<StackScreen />
</Suspense>
</NavigationContainer>
<CopilotProvider
tooltipStyle={{ backgroundColor: 'black' }}
androidStatusBarVisible={true}
>
<NavigationContainer linking={linking}>
<Suspense fallback={<GlobalText>Loading Screen...</GlobalText>}>
<StackScreen />
</Suspense>
</NavigationContainer>
</CopilotProvider>
</ApplicationProvider>
</LanguageProvider>
</ConfirmationProvider>
Expand Down
12 changes: 6 additions & 6 deletions src/Routes/Public/DashboardStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import UnitList from '../../screens/Dashboard/Courses/UnitList';

const Stack = createNativeStackNavigator();

const DashboardStack = () => {
const DashboardStack = ({ CopilotStopped }) => {
console.log('CopilotSopped', CopilotStopped);

return (
<Stack.Navigator screenOptions={{ headerShown: false }}>
<Stack.Screen
name="Courses"
component={Courses}
options={{ lazy: true }} // Lazily load LoadingScreen
/>
<Stack.Screen name="Courses" options={{ lazy: true }}>
{(props) => <Courses {...props} CopilotStopped={CopilotStopped} />}
</Stack.Screen>
<Stack.Screen
name="CourseContentList"
component={CourseContentList}
Expand Down
12 changes: 12 additions & 0 deletions src/Routes/Public/ProfileStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import React from 'react';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import Profile from '../../screens/Profile/Profile';
import ProfileUpdateScreen from '../../screens/Profile/ProfileUpdateScreen';
import OtherSettings from '../../screens/Profile/OtherSettings';
import ResetPassword from '../../screens/ForgotPassword/ResetPassword';
import ResetUsername from '../../screens/ForgotPassword/ResetUsername';

const Stack = createNativeStackNavigator();

Expand All @@ -24,6 +26,16 @@ const ProfileStack = () => {
component={ResetPassword}
options={{ lazy: true }} // Lazily load LoadingScreen
/>
<Stack.Screen
name="OtherSettings"
component={OtherSettings}
options={{ lazy: true }} // Lazily load LoadingScreen
/>
<Stack.Screen
name="ResetUsername"
component={ResetUsername}
options={{ lazy: true }} // Lazily load LoadingScreen
/>
</Stack.Navigator>
);
};
Expand Down
9 changes: 5 additions & 4 deletions src/Routes/Public/StackScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import StandAlonePlayer from '../../screens/PlayerScreen/StandAlonePlayer/StandA
import EnableLocationScreen from '../../screens/Location/EnableLocationScreen';
import DashboardStack from './DashboardStack';
import SCPUserTabScreen from '../SCPUser/SCPUserTabScreen';
// import YouthNetTabScreen from '../Youthnet/YouthNetTabScreen';
import YouthNetTabScreen from '../Youthnet/YouthNetTabScreen';

const StackScreen = (props) => {
const StackScreen = () => {
const Stack = createNativeStackNavigator();

const headerBackground = () => {
Expand Down Expand Up @@ -65,6 +65,7 @@ const StackScreen = (props) => {
lazy: true,
}}
/>

<Stack.Screen
name="LoginSignUpScreen"
component={LoginSignUpScreen}
Expand Down Expand Up @@ -93,11 +94,11 @@ const StackScreen = (props) => {
//component={AssessmentStack} // Changed to AssessmentStack for now to show only Assessment
options={{ headerShown: false, lazy: true }}
/>
{/* <Stack.Screen
<Stack.Screen
name="YouthNetTabScreen"
component={YouthNetTabScreen}
options={{ headerShown: false, lazy: true }}
/> */}
/>

<Stack.Screen
name="PlayerScreen"
Expand Down
182 changes: 103 additions & 79 deletions src/Routes/Public/TabScreen.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { Image, StyleSheet } from 'react-native';
import { Image, StyleSheet, TouchableOpacity, View } from 'react-native';
import { useTranslation } from '../../context/LanguageContext';
import SimpleIcon from 'react-native-vector-icons/SimpleLineIcons';
import DashboardStack from './DashboardStack';
Expand All @@ -13,88 +13,56 @@ import content2 from '../../assets/images/png/content2.png';
import Coursesunfilled from '../../assets/images/png/Coursesunfilled.png';
import ProfileStack from './ProfileStack';
import { getDataFromStorage, getTentantId } from '../../utils/JsHelper/Helper';
import { CopilotStep, useCopilot, walkthroughable } from 'react-native-copilot';
import Config from 'react-native-config';

const Tab = createBottomTabNavigator();
const WalkthroughableView = walkthroughable(View); // Wrap Image component

const TabScreen = () => {
const { t } = useTranslation();
const [contentShow, setContentShow] = useState(true);
const [CopilotStarted, setCopilotStarted] = useState(false);
const [CopilotStopped, setCopilotStopped] = useState(false);
const { start, goToNth, unregisterStep, copilotEvents } = useCopilot();

useEffect(() => {
const fetchData = async () => {
const tenantId = await getTentantId();
const tenantDetails = JSON.parse(
await getDataFromStorage('tenantDetails')
);
// useEffect(() => {
// const COPILOT_ENABLE = Config.COPILOT_ENABLE;

const youthnetTenantIds = tenantDetails?.filter((item) => {
if (item?.name === 'YouthNet') {
return item;
}
});
if (tenantId === youthnetTenantIds?.[0]?.tenantId) {
setContentShow(false);
}
};
// if (!CopilotStarted && COPILOT_ENABLE) {
// unregisterStep('login'); // Unregister step 1
// unregisterStep('create_account'); // Unregister step 2
// start();
// copilotEvents.on('start', () => setCopilotStarted(true));
// }
// copilotEvents.on('stop', () => setCopilotStopped(true));
// }, [start, copilotEvents]);

fetchData();
}, []);
// useEffect(() => {
// const fetchData = async () => {
// const tenantId = await getTentantId();
// const tenantDetails = JSON.parse(
// await getDataFromStorage('tenantDetails')
// );

// const youthnetTenantIds = tenantDetails?.filter((item) => {
// if (item?.name === 'YouthNet') {
// return item;
// }
// });
// if (tenantId === youthnetTenantIds?.[0]?.tenantId) {
// setContentShow(false);
// }
// };

// fetchData();
// }, []);

return (
<Tab.Navigator
initialRouteName="DashboardStack"
screenOptions={({ route }) => ({
screenOptions={() => ({
headerShown: false,
tabBarIcon: ({ focused }) => {
if (route.name === 'content') {
if (focused) {
return (
<Image source={content2} style={{ width: 30, height: 30 }} />
);
} else {
return (
<Image source={content} style={{ width: 30, height: 30 }} />
);
}
} else if (route.name === 'DashboardStack') {
if (focused) {
return (
<Image
source={Coursesfilled}
style={{ width: 30, height: 30 }}
/>
);
} else {
return (
<Image
source={Coursesunfilled}
style={{ width: 30, height: 30 }}
/>
);
}
} else if (route.name === 'AssessmentStack') {
return (
<SimpleIcon
name="note"
color={focused ? '#987100' : 'black'}
size={30}
/>
);
} else if (route.name === 'Profile') {
if (focused) {
return (
<Image
source={profile_filled}
style={{ width: 30, height: 30 }}
/>
);
} else {
return (
<Image source={profile} style={{ width: 30, height: 30 }} />
);
}
}
},
tabBarStyle: styles.footer,
tabBarActiveTintColor: '#987100',
tabBarInactiveTintColor: 'gray',
Expand All @@ -104,26 +72,82 @@ const TabScreen = () => {
>
<Tab.Screen
name="DashboardStack"
component={DashboardStack}
options={{ tabBarLabel: t('courses') }}
/>
options={{
tabBarLabel: t('courses'),
tabBarButton: (props) => (
<CopilotStep
text="This is the courses tab. Tap here to explore courses!"
order={3}
name="coursesTab"
>
<WalkthroughableView style={{ flex: 1 }}>
<TouchableOpacity {...props} />
</WalkthroughableView>
</CopilotStep>
),
tabBarIcon: ({ focused }) => (
<Image
source={focused ? Coursesfilled : Coursesunfilled}
style={{ width: 30, height: 30 }}
/>
),
}}
>
{(props) => (
<DashboardStack {...props} CopilotStopped={CopilotStopped} />
)}
</Tab.Screen>

{contentShow && (
<Tab.Screen
name="content"
component={Contents}
options={{ tabBarLabel: t('content') }}
options={{
tabBarLabel: t('content'),
tabBarButton: (props) => (
<CopilotStep
text="This is the Content tab. Tap here to explore Content!"
order={4}
name="cotentTab"
>
<WalkthroughableView style={{ flex: 1 }}>
<TouchableOpacity {...props} />
</WalkthroughableView>
</CopilotStep>
),
tabBarIcon: ({ focused }) => (
<Image
source={focused ? profile_filled : profile}
style={{ width: 30, height: 30 }}
/>
),
}}
/>
)}

{/* <Tab.Screen
name="AssessmentStack"
component={AssessmentStack}
options={{ tabBarLabel: t('assessment') }}
/> */}
<Tab.Screen
name="Profile"
component={ProfileStack}
options={{ tabBarLabel: t('profile') }}
options={{
tabBarLabel: t('profile'),
tabBarButton: (props) => (
<CopilotStep
text="This is the Profile tab. Tap here to explore Profile!"
order={5}
name="Profile"
>
<WalkthroughableView style={{ flex: 1 }}>
<TouchableOpacity {...props} />
</WalkthroughableView>
</CopilotStep>
),
tabBarIcon: ({ focused }) => (
<Image
source={focused ? profile_filled : profile}
style={{ width: 30, height: 30 }}
/>
),
}}
/>
</Tab.Navigator>
);
Expand Down
Loading

0 comments on commit 9538325

Please sign in to comment.