From 0f4f8c2000c6c57d094215f68a9c4b42ef4107c4 Mon Sep 17 00:00:00 2001 From: shubham Date: Thu, 5 Sep 2024 20:52:59 +0530 Subject: [PATCH] Add modal to dismiss custodial wallet warning --- locales/en.json | 1 + views/Settings/CustodialWalletWarning.tsx | 151 ++++++++++++++++++++-- 2 files changed, 144 insertions(+), 8 deletions(-) diff --git a/locales/en.json b/locales/en.json index 3d32d0a75..3e8bfa10a 100644 --- a/locales/en.json +++ b/locales/en.json @@ -1143,6 +1143,7 @@ "views.Settings.CustodialWalletWarning.graph3": "ZEUS has the ability to create a self-custodial wallet in the app. This wallet provides you with a 24-word seed phrase that gives you full control of your funds.", "views.Settings.CustodialWalletWarning.graph4": "To get started with your own self-custodial wallet, press the button below, and hit the 'Create mainnet wallet' button on the next screen.", "views.Settings.CustodialWalletWarning.create": "Create self-custodial wallet", + "views.Settings.CustodialWalletWarning.dismissWarning": "Dismiss warning", "views.PayCode.bolt12": "BOLT 12", "views.PayCode.offerId": "Offer ID", "views.PayCode.createOffer": "Create pay code", diff --git a/views/Settings/CustodialWalletWarning.tsx b/views/Settings/CustodialWalletWarning.tsx index b76fad7c1..a4d7b6e14 100644 --- a/views/Settings/CustodialWalletWarning.tsx +++ b/views/Settings/CustodialWalletWarning.tsx @@ -1,7 +1,8 @@ import * as React from 'react'; -import { StyleSheet, Text, View, ScrollView } from 'react-native'; +import { StyleSheet, Text, View, ScrollView, Modal } from 'react-native'; import { inject, observer } from 'mobx-react'; import { StackNavigationProp } from '@react-navigation/stack'; +import { CheckBox } from 'react-native-elements'; import Button from '../../components/Button'; import Header from '../../components/Header'; @@ -12,6 +13,14 @@ import { themeColor } from '../../utils/ThemeUtils'; import SettingsStore from '../../stores/SettingsStore'; +interface CustodialWalletWarningState { + checkbox1: boolean; + checkbox2: boolean; + checkbox3: boolean; + checkbox4: boolean; + showModal: boolean; +} + interface CustodialWalletWarningProps { SettingsStore: SettingsStore; navigation: StackNavigationProp; @@ -21,10 +30,37 @@ interface CustodialWalletWarningProps { @observer export default class CustodialWalletWarning extends React.Component< CustodialWalletWarningProps, - {} + CustodialWalletWarningState > { + constructor(props: CustodialWalletWarningProps) { + super(props); + this.state = { + checkbox1: false, + checkbox2: false, + checkbox3: false, + checkbox4: false, + showModal: false + }; + } + + areAllChecked = () => { + const { checkbox1, checkbox2, checkbox3, checkbox4 } = this.state; + return checkbox1 && checkbox2 && checkbox3 && checkbox4; + }; + + toggleModal = () => { + this.setState({ + showModal: !this.state.showModal, + checkbox1: false, + checkbox2: false, + checkbox3: false, + checkbox4: false + }); + }; + render() { const { SettingsStore, navigation } = this.props; + const { showModal } = this.state; const nodes = SettingsStore?.settings?.nodes || []; // check if user has embedded node wallet configured already @@ -107,14 +143,11 @@ export default class CustodialWalletWarning extends React.Component< )} - {!hasEmbeddedWallet && ( + {true && (