From 3b65110af632b3ef010906c3d54b30001ffda35d Mon Sep 17 00:00:00 2001 From: shubham Date: Thu, 5 Sep 2024 20:57:09 +0530 Subject: [PATCH 1/3] Add modal to dismiss custodial wallet warning --- locales/en.json | 1 + views/Settings/CustodialWalletWarning.tsx | 149 +++++++++++++++++++++- 2 files changed, 143 insertions(+), 7 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..6205127a7 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 @@ -111,10 +147,7 @@ export default class CustodialWalletWarning extends React.Component<