Files
address-verification-app/App.tsx
Prateek Shankar 4984933ec2 Release to master (#291)
* change apm url to portal url TP-25597 (#262)

* change apm url to portal url TP-25597

* fix config dev TP-25597

* enable sso TP-122 (#261)

* TP-24980 | Package version bump and submodule update

* enable sso TP-122

* TP-122 update rnUi

* fix crypto js failing issue TP-122

* error handling add TP-122

* change error text TP-122

* add disable button timer TP-122

* remove extra dispatch TP-122

* fix UI with design TP-122

* fix icon TP-122

* fix design nit picks and add google icon TP-122

* Revert "TP-25967 | Added Web Alias config + Updating NewAddressContainer  with alias (#266)" (#267)

This reverts commit c9fefc0309.

* move code back to AuthRouter TP-122

* foreground service notification title and config update TP-122

* fix package json TP-122

* emiBreakupBottomSheet formatting revert TP-122

* remoce disable function TP-122

Co-authored-by: Aman Chaturvedi <aman.chaturvedi@navi.com>
Co-authored-by: Himanshu Kansal <himanshu.kansal@navi.com>

* TP-122 bump package

* enable sso TP-122 (#261)

* TP-24980 | Package version bump and submodule update

* enable sso TP-122

* TP-122 update rnUi

* fix crypto js failing issue TP-122

* error handling add TP-122

* change error text TP-122

* add disable button timer TP-122

* remove extra dispatch TP-122

* fix UI with design TP-122

* fix icon TP-122

* fix design nit picks and add google icon TP-122

* Revert "TP-25967 | Added Web Alias config + Updating NewAddressContainer  with alias (#266)" (#267)

This reverts commit c9fefc0309.

* move code back to AuthRouter TP-122

* foreground service notification title and config update TP-122

* fix package json TP-122

* emiBreakupBottomSheet formatting revert TP-122

* remoce disable function TP-122

Co-authored-by: Aman Chaturvedi <aman.chaturvedi@navi.com>
Co-authored-by: Himanshu Kansal <himanshu.kansal@navi.com>

* TP-0 | asdf

* TP-25952 | Feedback List icons added (#264)

* TP-25952 | Feedback List icons added

* TP-25952 | Feedback List icons added

* TP-25917 | rn-fetch-blob library update (#263)

* TP-25917 | rn-fetch-blob library update

* TP-25915 | remove comment

* TP-25917 | fix

* Temp release (#276)

* TP-0 | Version bump/21 april (#273)

* version upgrade to 2.1.13 and notification text update TP-0

* reset formatting TP-0

* TP-25963 | Fix Linting in `.tsx` extension files (#275)

Co-authored-by: Aman Sethi <aman.sethi@navi.com>

* Feature/tp 26024 (#278)

* replace with function api call clicks
tream TP-26024

* remoce emi schedule api helper TP-26024

* fix filter all event issues and feedback issues with caselist issues TP-26024

* TP-26026 fix and add new events

* TP-26026 collection case remove fromatting

* TP-26024 remove logs and add notifications loaded

* remove log TP-26024

* fix form load events TP-26024

* review comments TP-26024

* 24april sanity events fix TP-26026

* add battery level TP-26026

* add new event for view more address TP-26024

* remove console TP-26024

Co-authored-by: Aman Sethi <aman.sethi@navi.com>

* TP-0 | Lint fixes (#280)

* fix reading name of screen TP-26024 (#279)

* TP-26182 | OTP boxes added with custom component + FCM fix (#272)

* TP-26182 | OTP input component

* TP-26182 | OTP input component fixes

* TP-26182 | OTP input component

* TP-26182 | OTP input component fixes

* TP-26182 | fix

* TP-26182 | Login screen fixes

* TP-26182 | Toast message changed

* TP-26182 | submodule update

* TP-26182 | submodule update

* TP-26598 | PTP amount fixes (#281)

* TP-26598 | PTP amount fixes

* TP-26598 | fix

* TP-26598 | Fixed PTP amount

* TP-0 | Added scroll view on profile section (#284)

* TP-0 | Version Bump + submodule udpate (#285)

* TP-26182 | Fixes - PTP amount + doNotHandle header handler fixes (#286)

* TP-26182 | OTP input component

* TP-26182 | OTP input component fixes

* TP-26182 | OTP input component

* TP-26182 | OTP input component fixes

* TP-26182 | fix

* TP-26182 | Login screen fixes

* TP-26182 | Toast message changed

* TP-26182 | submodule update

* TP-26182 | submodule update

* TP-26182 | fixes

* TP-26182 | fixes

* TP-26182 | Firebase logout fixes

* TP-26182 | fix placeholder text

* TP-26212 | Hot fix on the feedback screen (#290)

* TP-26212 | Hot fix on the feedback screen

* TP-26213 | review comment

Co-authored-by: Aman Sethi <aman.sethi@navi.com>
Co-authored-by: Aman Chaturvedi <aman.chaturvedi@navi.com>
Co-authored-by: Himanshu Kansal <himanshu.kansal@navi.com>
2023-04-27 18:24:11 +05:30

133 lines
4.2 KiB
TypeScript

import React from 'react';
import {
AppState,
KeyboardAvoidingView,
LogBox,
Permission,
PermissionsAndroid,
Platform,
StatusBar,
} from 'react-native';
import { Provider } from 'react-redux';
import { init as initApm } from '@cobo/apm-rum-react-native';
import store, { persistor } from './src/store/store';
import { PersistGate } from 'redux-persist/integration/react';
import { NavigationContainer } from '@react-navigation/native';
import { navigationRef } from './src/components/utlis/navigationUtlis';
import FullScreenLoader from './RN-UI-LIB/src/components/FullScreenLoader';
import { toastConfigs, ToastContainer } from './RN-UI-LIB/src/components/toast';
import * as Sentry from '@sentry/browser';
import { APM_APP_NAME, APM_BASE_URL, ENV, SENTRY_DSN } from './src/constants/config';
import { COLORS } from './RN-UI-LIB/src/styles/colors';
import codePush from 'react-native-code-push';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { LocalStorageKeys, PermissionsToCheck } from './src/common/Constants';
import Permissions from './src/screens/permissions/Permissions';
import { setJsErrorHandler } from './src/services/exception-handler.service';
import SuspenseLoader from './RN-UI-LIB/src/components/suspense_loader/SuspenseLoader';
import ErrorBoundary from './src/common/ErrorBoundary';
import CodePush from 'react-native-code-push';
import { TDocumentObj } from './src/screens/caseDetails/interface';
import AuthRouter from './src/screens/auth/AuthRouter';
Sentry.init({ dsn: SENTRY_DSN });
if (ENV !== 'prod') {
// mockApiServer();
}
setJsErrorHandler();
LogBox.ignoreAllLogs();
export let GlobalDocumentMap: Record<string, TDocumentObj> = {};
async function checkCodePushAndSync() {
try {
await CodePush.sync({
installMode: codePush.InstallMode.IMMEDIATE,
});
} catch (error) {}
}
function handleAppStateChange(nextAppState: any) {
if (nextAppState == 'active') {
checkCodePushAndSync();
}
}
const askForPermissions = async (setPermissions: React.Dispatch<React.SetStateAction<boolean>>) => {
if (Platform.OS === 'android') {
PermissionsAndroid.requestMultiple(PermissionsToCheck)
.then(async (result) => {
let isAllPermissionsGranted = true;
for (const permission in result) {
if (!(result?.[permission as Permission] === PermissionsAndroid.RESULTS.GRANTED)) {
isAllPermissionsGranted = false;
break;
}
}
setPermissions(isAllPermissionsGranted);
})
.catch((err) => {
setPermissions(false);
});
}
};
const App = () => {
const [permissions, setPermissions] = React.useState(true);
const [isGlobalDocumentMapLoaded, setIsGlobalDocumentMapLoaded] = React.useState(false);
initApm({
serviceName: APM_APP_NAME,
serverUrl: APM_BASE_URL,
serviceVersion: '1.0.0',
environment: ENV,
active: true,
});
React.useEffect(() => {
const appStateChange = AppState.addEventListener('change', (change) => {
handleAppStateChange(change);
askForPermissions(setPermissions);
});
(async () => {
const data = await AsyncStorage.getItem(LocalStorageKeys.GLOBAL_DOCUMENT_MAP);
if (data) {
const parsedData = JSON.parse(data);
GlobalDocumentMap = parsedData;
}
setIsGlobalDocumentMapLoaded(true);
})();
checkCodePushAndSync();
return () => {
appStateChange.remove();
};
}, []);
return (
<Provider store={store}>
<PersistGate loading={<FullScreenLoader loading />} persistor={persistor}>
<NavigationContainer ref={navigationRef}>
<StatusBar backgroundColor={COLORS.BACKGROUND.INDIGO_DARK} />
<SuspenseLoader
fallBack={<FullScreenLoader loading />}
loading={!isGlobalDocumentMapLoaded}
children={
<ErrorBoundary>{permissions ? <AuthRouter /> : <Permissions />}</ErrorBoundary>
}
/>
</NavigationContainer>
{
<KeyboardAvoidingView behavior="position">
<ToastContainer config={toastConfigs} position="bottom" />
</KeyboardAvoidingView>
}
</PersistGate>
</Provider>
);
};
export default App;