diff --git a/App.tsx b/App.tsx index 5f999bd74c..3b7761770a 100644 --- a/App.tsx +++ b/App.tsx @@ -9,7 +9,10 @@ import { getBuildConfigDetails, setBuildConfigDetails, } from "./App/common/utilities/CacheUtils"; -import { GenericShimmerScreen } from "./App/Container/Navi-Insurance"; +import { + GenericErrorScreen, + GenericShimmerScreen, +} from "./App/Container/Navi-Insurance"; import { getStringPreference, setStringPreference, @@ -126,7 +129,7 @@ export default class App extends Component<{}, AppState> { ) : this.state.bundleState === BundleState.LOADING ? ( ) : ( - <> + ); } } diff --git a/App/Container/Navi-Insurance/index.ts b/App/Container/Navi-Insurance/index.ts index cb0a067f6a..b7d077af08 100644 --- a/App/Container/Navi-Insurance/index.ts +++ b/App/Container/Navi-Insurance/index.ts @@ -1,4 +1,5 @@ export { default as QuoteOfferScreen } from "./screen/quote-offer-screen/QuoteOfferScreen"; export { default as QuoteApologyScreen } from "./screen/quote-apology-screen/QuoteApologyScreen"; export { default as ComparePlanScreen } from "./screen/compare-plan-screen/ComparePlanScreen"; -export { default as GenericShimmerScreen } from "./screen/generic-shimmer-screen/GenericShimmerScreen"; \ No newline at end of file +export { default as GenericShimmerScreen } from "./screen/generic-shimmer-screen/GenericShimmerScreen"; +export { default as GenericErrorScreen } from "./screen/generic-error-screen/GenericErrorScreen"; \ No newline at end of file diff --git a/App/Container/Navi-Insurance/screen/generic-error-screen/GenericErrorScreen.tsx b/App/Container/Navi-Insurance/screen/generic-error-screen/GenericErrorScreen.tsx new file mode 100644 index 0000000000..b65af9fadd --- /dev/null +++ b/App/Container/Navi-Insurance/screen/generic-error-screen/GenericErrorScreen.tsx @@ -0,0 +1,63 @@ +import { View, Text } from "react-native"; + +import { CtaData, CtaType } from "../../../../common/interface"; +import { StaticHeader } from "../../../../../components/reusable/static-header/StaticHeader"; +import { styles } from "./GenericErrorScreenStyle"; + +import { + ERROR_SUBTITLE, + ERROR_TITLE, + ImageName, +} from "../../../../common/constants/StringConstant"; +import { AppImage } from "../../../../../components/AppImage"; +import { logToSentry } from "../../../../common/hooks/useSentryLogging"; +import { NativeDeeplinkNavigatorModule } from "../../../../common/native-module/NativeModules"; +import { ConstantCta } from "../../../../common/constants"; + +const GenericErrorScreen = () => { + const handleClick = (cta?: CtaData) => { + if (!cta) { + logToSentry( + `Navigation cta is missing or invalid: ${cta} | MethodName: handleClick}`, + ); + return; + } + + try { + switch (cta.type) { + case CtaType.DEEP_LINK: + case CtaType.USE_ROOT_DEEPLINK_NAVIGATOR: + NativeDeeplinkNavigatorModule.navigateToNaviInsuranceDeeplinkNavigator( + JSON.stringify(cta), + ); + break; + default: + NativeDeeplinkNavigatorModule.navigateToNaviDeeplinkNavigator( + JSON.stringify(cta), + ); + break; + } + } catch (error) { + logToSentry( + `Error while navigating to deep link with CTA: ${cta} | MethodName: handleClick}`, + ); + } + }; + return ( + + + + {AppImage(ImageName.SWW, styles.centerIcon)} + {ERROR_TITLE} + {ERROR_SUBTITLE} + + + + ); +}; + +export default GenericErrorScreen; diff --git a/App/Container/Navi-Insurance/screen/generic-error-screen/GenericErrorScreenStyle.ts b/App/Container/Navi-Insurance/screen/generic-error-screen/GenericErrorScreenStyle.ts new file mode 100644 index 0000000000..d4868c49d5 --- /dev/null +++ b/App/Container/Navi-Insurance/screen/generic-error-screen/GenericErrorScreenStyle.ts @@ -0,0 +1,47 @@ +import { StyleSheet } from "react-native"; + +export const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: "space-between", + backgroundColor: "white", + }, + centerContent: { + justifyContent: "center", + alignItems: "center", + }, + centerIcon: { + width: 125, + height: 125, + }, + errorTitle: { + fontSize: 16, + lineHeight: 22, + fontFamily: "tt_semi_bold", + color: "#191919", + textAlign: "center", + marginTop: 32, + }, + errorSubtitle: { + fontSize: 14, + lineHeight: 22, + fontFamily: "tt_regular", + color: "#6B6B6B", + textAlign: "center", + marginTop: 16, + }, + retryButton: { + padding: 16, + marginHorizontal: 16, + marginVertical: 32, + borderRadius: 4, + justifyContent: "center", + alignItems: "center", + }, + buttonText: { + color: "white", + fontSize: 14, + lineHeight: 22, + fontFamily: "tt_semi_bold", + }, +});