From 92d567b8ff56906f779e3b6b2ac78bfc3f0875b2 Mon Sep 17 00:00:00 2001
From: Noah Prince <83885631+ChewingGlass@users.noreply.github.com>
Date: Fri, 15 Sep 2023 14:33:19 -0500
Subject: [PATCH] feat(#463) Remove share helium address (#464)
---
src/features/settings/Settings.tsx | 64 ++++++--------------
src/features/settings/ShareAddressScreen.tsx | 54 +++++------------
2 files changed, 32 insertions(+), 86 deletions(-)
diff --git a/src/features/settings/Settings.tsx b/src/features/settings/Settings.tsx
index 28f5f2f4f..75915673b 100644
--- a/src/features/settings/Settings.tsx
+++ b/src/features/settings/Settings.tsx
@@ -1,34 +1,32 @@
-import React, { memo, ReactText, useCallback, useMemo } from 'react'
-import { useTranslation } from 'react-i18next'
+import Box from '@components/Box'
+import CloseButton from '@components/CloseButton'
+import SafeAreaBox from '@components/SafeAreaBox'
+import Text from '@components/Text'
+import useAlert from '@hooks/useAlert'
+import { useAppVersion } from '@hooks/useDevice'
import { useNavigation } from '@react-navigation/native'
-import { Alert, Linking, Platform, SectionList } from 'react-native'
import { Cluster } from '@solana/web3.js'
-import Text from '@components/Text'
-import SafeAreaBox from '@components/SafeAreaBox'
import { useHitSlop, useSpacing } from '@theme/themeHooks'
-import Box from '@components/Box'
-import { useAppVersion } from '@hooks/useDevice'
-import useCopyText from '@hooks/useCopyText'
-import useAlert from '@hooks/useAlert'
-import CloseButton from '@components/CloseButton'
+import React, { memo, ReactText, useCallback, useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { Alert, Linking, Platform, SectionList } from 'react-native'
import deviceInfo from 'react-native-device-info'
-import { HomeNavigationProp } from '../home/homeTypes'
-import SettingsListItem, { SettingsListItemType } from './SettingsListItem'
-import { SUPPORTED_LANGUAGUES } from '../../utils/i18n'
-import useAuthIntervals from './useAuthIntervals'
-import SUPPORTED_CURRENCIES from '../../utils/supportedCurrencies'
+import { PRIVACY_POLICY, TERMS_OF_SERVICE } from '../../constants/urls'
+import { RootNavigationProp } from '../../navigation/rootTypes'
+import { useSolana } from '../../solana/SolanaProvider'
import { useAccountStorage } from '../../storage/AccountStorageProvider'
import { useAppStorage } from '../../storage/AppStorageProvider'
-import { SettingsNavigationProp } from './settingsTypes'
import { useLanguageStorage } from '../../storage/LanguageProvider'
import {
checkSecureAccount,
getSecureAccount,
} from '../../storage/secureStorage'
-import { PRIVACY_POLICY, TERMS_OF_SERVICE } from '../../constants/urls'
-import { ellipsizeAddress } from '../../utils/accountUtils'
-import { RootNavigationProp } from '../../navigation/rootTypes'
-import { useSolana } from '../../solana/SolanaProvider'
+import { SUPPORTED_LANGUAGUES } from '../../utils/i18n'
+import SUPPORTED_CURRENCIES from '../../utils/supportedCurrencies'
+import { HomeNavigationProp } from '../home/homeTypes'
+import SettingsListItem, { SettingsListItemType } from './SettingsListItem'
+import { SettingsNavigationProp } from './settingsTypes'
+import useAuthIntervals from './useAuthIntervals'
const Settings = () => {
const { t } = useTranslation()
@@ -57,7 +55,6 @@ const Settings = () => {
updateCurrency,
updateRequirePinForPayment,
} = useAppStorage()
- const copyText = useCopyText()
const { showOKAlert, showOKCancelAlert } = useAlert()
const { updateCluster, cluster } = useSolana()
@@ -368,30 +365,6 @@ const Settings = () => {
onToggle: handleSetDefaultAccount,
value: isDefaultAccount,
},
- {
- title: t('settings.sections.account.copyAddress'),
- onPress: undefined,
- select: {
- items: [
- { label: 'Helium', value: 'helium' },
- { label: 'Solana', value: 'solana' },
- ],
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- onValueSelect: (val: any) => {
- const address =
- val === 'helium'
- ? currentAccount?.address
- : currentAccount?.solanaAddress
-
- if (!address) return
-
- copyText({
- message: ellipsizeAddress(address),
- copyText: address,
- })
- },
- },
- },
{
title: t('settings.sections.account.shareAddress'),
onPress: handleShareAddress,
@@ -494,7 +467,6 @@ const Settings = () => {
authInterval,
authIntervals,
cluster,
- copyText,
currency,
currentAccount,
handleCurrencyTypeChange,
diff --git a/src/features/settings/ShareAddressScreen.tsx b/src/features/settings/ShareAddressScreen.tsx
index 3571e1646..b112ce66e 100644
--- a/src/features/settings/ShareAddressScreen.tsx
+++ b/src/features/settings/ShareAddressScreen.tsx
@@ -1,21 +1,20 @@
-import React, { memo, useMemo, useCallback, useRef, useState } from 'react'
-import QRCode from 'react-native-qrcode-svg'
import ShareAddress from '@assets/images/shareAddress.svg'
-import { useTranslation } from 'react-i18next'
-import { Platform } from 'react-native'
-import Share, { ShareOptions } from 'react-native-share'
-import { Spacing } from '@theme/theme'
-import { useAccountStorage } from '@storage/AccountStorageProvider'
-import useHaptic from '@hooks/useHaptic'
-import { useSpacing } from '@theme/themeHooks'
-import Box from '@components/Box'
-import TouchableOpacityBox from '@components/TouchableOpacityBox'
-import Text from '@components/Text'
import BackScreen from '@components/BackScreen'
-import { ellipsizeAddress } from '@utils/accountUtils'
+import Box from '@components/Box'
import CopyAddress from '@components/CopyAddress'
-import TabBar from '@components/TabBar'
+import Text from '@components/Text'
+import TouchableOpacityBox from '@components/TouchableOpacityBox'
import useCopyText from '@hooks/useCopyText'
+import useHaptic from '@hooks/useHaptic'
+import { useAccountStorage } from '@storage/AccountStorageProvider'
+import { Spacing } from '@theme/theme'
+import { useSpacing } from '@theme/themeHooks'
+import { ellipsizeAddress } from '@utils/accountUtils'
+import React, { memo, useCallback, useMemo, useRef } from 'react'
+import { useTranslation } from 'react-i18next'
+import { Platform } from 'react-native'
+import QRCode from 'react-native-qrcode-svg'
+import Share, { ShareOptions } from 'react-native-share'
const QR_CONTAINER_SIZE = 225
@@ -30,23 +29,9 @@ const ShareAddressScreen = () => {
}>(null)
const copyText = useCopyText()
- const tabData = useMemo((): Array<{
- value: string
- title: string
- }> => {
- return [
- { title: 'Solana', value: 'solana' },
- { title: 'Helium', value: 'helium' },
- ]
- }, [])
-
- const [selectedOption, setSelectedOption] = useState(tabData[0].value)
-
const address = useMemo(() => {
- if (selectedOption === 'helium') return currentAccount?.address
-
return currentAccount?.solanaAddress
- }, [currentAccount, selectedOption])
+ }, [currentAccount])
const handleShare = useCallback(async () => {
if (!address) return
@@ -88,10 +73,6 @@ const ShareAddressScreen = () => {
})
}, [address, triggerNavHaptic])
- const handleItemSelected = useCallback((value: string) => {
- setSelectedOption(value)
- }, [])
-
if (!currentAccount || !address) return null
return (
@@ -103,13 +84,6 @@ const ShareAddressScreen = () => {
alignItems="center"
marginBottom="xxxl"
>
-
-