Skip to content

Commit fb4029a

Browse files
committed
Add support for maintenance mode
1 parent 7f73947 commit fb4029a

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

src/app/_layout.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { EnhancedStore } from '@reduxjs/toolkit'
77
import React, { useEffect, useState } from 'react'
88
import { I18nextProvider } from 'react-i18next'
99
import { Provider } from 'react-redux'
10-
import { LoadingScreen } from '@/components'
10+
import { MaintenanceScreen, LoadingScreen } from '@/components'
1111
// eslint-disable-next-line camelcase
1212
import { useFonts, Inter_400Regular } from '@expo-google-fonts/inter'
1313
import RootContainer from '@/components/RootContainer'
@@ -82,6 +82,10 @@ const RootLayout = () => {
8282
return <LoadingScreen />
8383
}
8484

85+
if (process.env.EXPO_PUBLIC_MAINTENANCE_MODE === 'true') {
86+
return <MaintenanceScreen />
87+
}
88+
8589
let backgroundColor = getThemeStyle(colorScheme, 'backgroundColor')
8690

8791
return (
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from 'react'
2+
import { Text, View } from 'react-native'
3+
import RootContainer from './RootContainer'
4+
import RootImageBackground from './RootImageBackground'
5+
import { LogoIcon } from './svg'
6+
7+
const MaintenanceScreen: React.FC = () => {
8+
return (
9+
<RootContainer>
10+
<RootImageBackground>
11+
<View className='flex-1'>
12+
<View className='w-full p-8 items-center justify-start gap-4'>
13+
<LogoIcon />
14+
<Text className='text-center text-white text-xl' style={{ fontFamily: 'Inter' }}>
15+
Ansari Chat is currently under maintenance.
16+
</Text>
17+
<Text className='text-center text-white text-xl' style={{ fontFamily: 'Inter' }}>
18+
We are working hard to bring you the best experience possible.
19+
</Text>
20+
<Text className='text-center text-white text-xl' style={{ fontFamily: 'Inter' }}>
21+
Thank you for your patience!
22+
</Text>
23+
</View>
24+
</View>
25+
</RootImageBackground>
26+
</RootContainer>
27+
)
28+
}
29+
30+
export default MaintenanceScreen

src/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export { default as ConfirmationDialog } from './ConfirmationDialog'
22
export { default as Footer } from './Footer'
33
export { default as Header } from './Header'
44
export { default as LoadingScreen } from './LoadingScreen'
5+
export { default as MaintenanceScreen } from './MaintenanceScreen'
56
export { default as Subscription } from './Subscription'
67
export { default as Toast } from './Toast'
78
export { default as ChatContainer } from './chat/ChatContainer'

src/store/slices/authSlice.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ export async function loadAuthState() {
130130
}>
131131
}
132132

133+
if (process.env.EXPO_PUBLIC_MAINTENANCE_MODE === 'true') {
134+
return createAuthState(initialAuthState)
135+
}
136+
133137
const apiService = new ApiService()
134138
const baseURL = process.env.EXPO_PUBLIC_API_V2_URL
135139
let accessToken = await apiService.getAccessTokenFromStorage()

0 commit comments

Comments
 (0)