From 7334b7d09e52dac750e7663d05270a5de23d7a8c Mon Sep 17 00:00:00 2001 From: SABITRADE Date: Mon, 24 Feb 2025 16:51:31 +0100 Subject: [PATCH 1/8] DBO DepositAddress.tsx --- packages/app/features/deposit/components/DepositAddress.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/app/features/deposit/components/DepositAddress.tsx b/packages/app/features/deposit/components/DepositAddress.tsx index 5487dd2b5..24559c09f 100644 --- a/packages/app/features/deposit/components/DepositAddress.tsx +++ b/packages/app/features/deposit/components/DepositAddress.tsx @@ -17,6 +17,7 @@ import { CheckCheck } from '@tamagui/lucide-icons' import { shorten } from 'app/utils/strings' import * as Clipboard from 'expo-clipboard' import { useState, useEffect } from 'react' +const [dontShowAgain, setDontShowAgain] = useState(false) import type { Address } from 'viem' import { IconCopy } from 'app/components/icons' import { useQRCode } from 'app/utils/useQRCode' From 008004d63359f847ce4a048316a180fd5f9c0100 Mon Sep 17 00:00:00 2001 From: SABITRADE Date: Mon, 24 Feb 2025 21:35:25 +0100 Subject: [PATCH 2/8] Update DepositAddress.tsx --- packages/app/features/deposit/components/DepositAddress.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/app/features/deposit/components/DepositAddress.tsx b/packages/app/features/deposit/components/DepositAddress.tsx index 24559c09f..edcdb923b 100644 --- a/packages/app/features/deposit/components/DepositAddress.tsx +++ b/packages/app/features/deposit/components/DepositAddress.tsx @@ -17,12 +17,11 @@ import { CheckCheck } from '@tamagui/lucide-icons' import { shorten } from 'app/utils/strings' import * as Clipboard from 'expo-clipboard' import { useState, useEffect } from 'react' -const [dontShowAgain, setDontShowAgain] = useState(false) import type { Address } from 'viem' import { IconCopy } from 'app/components/icons' import { useQRCode } from 'app/utils/useQRCode' -function CopyAddressDialog({ isOpen, onClose, onConfirm }) { +function CopyAddressDialog({ isOpen, onClose, onConfirm }) { const [dontShowAgain, setDontShowAgain] = useState(false) return ( From 435797842fa06891be52784c9261baa5bdfb92c3 Mon Sep 17 00:00:00 2001 From: SABITRADE Date: Mon, 24 Feb 2025 21:51:40 +0100 Subject: [PATCH 3/8] Update DepositAddress.tsx --- .../deposit/components/DepositAddress.tsx | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/packages/app/features/deposit/components/DepositAddress.tsx b/packages/app/features/deposit/components/DepositAddress.tsx index edcdb923b..00423e99f 100644 --- a/packages/app/features/deposit/components/DepositAddress.tsx +++ b/packages/app/features/deposit/components/DepositAddress.tsx @@ -61,14 +61,25 @@ function CopyAddressDialog({ isOpen, onClose, onConfirm }) { const [dontShowAgai 3. I understand that if I make any mistakes, there is no way to recover the funds. - - - - - - + + {/* Checkbox on the left */} + + setDontShowAgain(!dontShowAgain)} + /> + Don't show again + + + {/* Buttons on the right */} + + + + + @@ -109,7 +120,7 @@ export function DepositAddress({ address, ...props }: { address?: Address } & Bu return } - await Clipboard.setStringAsync(address).catch(() => + await Clipboard.setString(address).catch(() => toast.show('Something went wrong', { message: 'We were unable to copy your address to the clipboard', customData: { From fda1c47d81c5580e651bbfed2c5da26bd23f9b5f Mon Sep 17 00:00:00 2001 From: SABITRADE Date: Tue, 25 Feb 2025 09:00:07 +0100 Subject: [PATCH 4/8] Update DepositAddress.tsx --- .../deposit/components/DepositAddress.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/app/features/deposit/components/DepositAddress.tsx b/packages/app/features/deposit/components/DepositAddress.tsx index 00423e99f..84428cf40 100644 --- a/packages/app/features/deposit/components/DepositAddress.tsx +++ b/packages/app/features/deposit/components/DepositAddress.tsx @@ -20,6 +20,7 @@ import { useState, useEffect } from 'react' import type { Address } from 'viem' import { IconCopy } from 'app/components/icons' import { useQRCode } from 'app/utils/useQRCode' +import AsyncStorage from '@react-native-async-storage/async-storage' function CopyAddressDialog({ isOpen, onClose, onConfirm }) { const [dontShowAgain, setDontShowAgain] = useState(false) return ( @@ -92,6 +93,23 @@ export function DepositAddress({ address, ...props }: { address?: Address } & Bu const [hasCopied, setHasCopied] = useState(false) const [isConfirmed, setIsConfirmed] = useState(false) const [copyAddressDialogIsOpen, setCopyAddressDialogIsOpen] = useState(false) + const [dontShowAgain, setDontShowAgain] = useState(false) + +useEffect(() => { + const loadDontShowAgain = async () => { + try { + const savedValue = await AsyncStorage.getItem('dontShowAgain') + if (savedValue === 'true') { + setDontShowAgain(true) + setIsConfirmed(true) // Auto-confirm if "Don't show again" was checked + } + } catch (error) { + console.error('Failed to load dontShowAgain:', error) + } + } + + loadDontShowAgain() +}, []) const { data: qrData, error } = useQRCode(address, { width: 240, From 5ea8db93344ecbafaf6aeee77ed258a2e68f8e54 Mon Sep 17 00:00:00 2001 From: SABITRADE Date: Tue, 25 Feb 2025 09:03:47 +0100 Subject: [PATCH 5/8] Update DepositAddress.tsx --- .../deposit/components/DepositAddress.tsx | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/app/features/deposit/components/DepositAddress.tsx b/packages/app/features/deposit/components/DepositAddress.tsx index 84428cf40..1b278e8a5 100644 --- a/packages/app/features/deposit/components/DepositAddress.tsx +++ b/packages/app/features/deposit/components/DepositAddress.tsx @@ -133,6 +133,28 @@ useEffect(() => { if (!address) return null const copyOnPress = async () => { + if (!isConfirmed) { + if (dontShowAgain) { + try { + await AsyncStorage.setItem('dontShowAgain', 'true') + } catch (error) { + console.error('Failed to save dontShowAgain:', error) + } + } + setCopyAddressDialogIsOpen(true) + return + } + + await Clipboard.setString(address).catch(() => + toast.show('Something went wrong', { + message: 'We were unable to copy your address to the clipboard', + customData: { + theme: 'red', + }, + }) + ) + setHasCopied(true) + } if (!isConfirmed) { setCopyAddressDialogIsOpen(true) return From c3207150edc1baeca7b7d57dd2483871cf2fd66f Mon Sep 17 00:00:00 2001 From: SABITRADE Date: Tue, 25 Feb 2025 13:53:25 +0100 Subject: [PATCH 6/8] Update DepositAddress.tsx --- .../deposit/components/DepositAddress.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/app/features/deposit/components/DepositAddress.tsx b/packages/app/features/deposit/components/DepositAddress.tsx index 1b278e8a5..540be6570 100644 --- a/packages/app/features/deposit/components/DepositAddress.tsx +++ b/packages/app/features/deposit/components/DepositAddress.tsx @@ -93,23 +93,23 @@ export function DepositAddress({ address, ...props }: { address?: Address } & Bu const [hasCopied, setHasCopied] = useState(false) const [isConfirmed, setIsConfirmed] = useState(false) const [copyAddressDialogIsOpen, setCopyAddressDialogIsOpen] = useState(false) - const [dontShowAgain, setDontShowAgain] = useState(false) + const [dontShowAgain, setDontShowAgain] = useState(false); useEffect(() => { const loadDontShowAgain = async () => { try { - const savedValue = await AsyncStorage.getItem('dontShowAgain') - if (savedValue === 'true') { - setDontShowAgain(true) - setIsConfirmed(true) // Auto-confirm if "Don't show again" was checked + const savedValue = await AsyncStorage.getItem('dontShowAgain'); + if (savedValue !== null) { + setDontShowAgain(JSON.parse(savedValue)); + setIsConfirmed(JSON.parse(savedValue)); // Auto-confirm if "Don't show again" was checked } } catch (error) { - console.error('Failed to load dontShowAgain:', error) + console.error('Failed to load dontShowAgain:', error); } - } + }; - loadDontShowAgain() -}, []) + loadDontShowAgain(); +}, []); const { data: qrData, error } = useQRCode(address, { width: 240, From be25effd8734430461b3a3768a7d746cf6fe0606 Mon Sep 17 00:00:00 2001 From: SABITRADE Date: Tue, 25 Feb 2025 14:01:18 +0100 Subject: [PATCH 7/8] Update DepositAddress.tsx --- .../app/features/deposit/components/DepositAddress.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/app/features/deposit/components/DepositAddress.tsx b/packages/app/features/deposit/components/DepositAddress.tsx index 540be6570..4ede89aaa 100644 --- a/packages/app/features/deposit/components/DepositAddress.tsx +++ b/packages/app/features/deposit/components/DepositAddress.tsx @@ -68,7 +68,15 @@ function CopyAddressDialog({ isOpen, onClose, onConfirm }) { const [dontShowAgai setDontShowAgain(!dontShowAgain)} + onChange={async () => { + const newValue = !dontShowAgain; + setDontShowAgain(newValue); + try { + await AsyncStorage.setItem('dontShowAgain', JSON.stringify(newValue)); + } catch (error) { + console.error('Failed to save checkbox state:', error); + } +}} /> Don't show again From 3b4d5c86e7e21da653092f1f021add26d9a65267 Mon Sep 17 00:00:00 2001 From: SABITRADE Date: Tue, 25 Feb 2025 14:47:58 +0100 Subject: [PATCH 8/8] Update DepositAddress.tsx --- packages/app/features/deposit/components/DepositAddress.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/app/features/deposit/components/DepositAddress.tsx b/packages/app/features/deposit/components/DepositAddress.tsx index 4ede89aaa..06573cd18 100644 --- a/packages/app/features/deposit/components/DepositAddress.tsx +++ b/packages/app/features/deposit/components/DepositAddress.tsx @@ -149,7 +149,9 @@ useEffect(() => { console.error('Failed to save dontShowAgain:', error) } } - setCopyAddressDialogIsOpen(true) + if (!dontShowAgain) { + setCopyAddressDialogIsOpen(true); + } return }