diff --git a/packages/kit/src/views/DAppConnection/components/DAppAccountList/DAppAccountListItem.tsx b/packages/kit/src/views/DAppConnection/components/DAppAccountList/DAppAccountListItem.tsx index 26ee499c95d..1f267af11b4 100644 --- a/packages/kit/src/views/DAppConnection/components/DAppAccountList/DAppAccountListItem.tsx +++ b/packages/kit/src/views/DAppConnection/components/DAppAccountList/DAppAccountListItem.tsx @@ -15,8 +15,12 @@ import backgroundApiProxy from '@onekeyhq/kit/src/background/instance/background import { AccountSelectorProviderMirror, NetworkSelectorTriggerDappConnection, + NetworkSelectorTriggerDappConnectionCmp, } from '@onekeyhq/kit/src/components/AccountSelector'; -import { AccountSelectorTriggerDappConnection } from '@onekeyhq/kit/src/components/AccountSelector/AccountSelectorTrigger/AccountSelectorTriggerDApp'; +import { + AccountSelectorTriggerDappConnection, + AccountSelectorTriggerDappConnectionCmp, +} from '@onekeyhq/kit/src/components/AccountSelector/AccountSelectorTrigger/AccountSelectorTriggerDApp'; import useDappQuery from '@onekeyhq/kit/src/hooks/useDappQuery'; import { usePromiseResult } from '@onekeyhq/kit/src/hooks/usePromiseResult'; import type { IAccountSelectorAvailableNetworksMap } from '@onekeyhq/kit/src/states/jotai/contexts/accountSelector'; @@ -24,9 +28,11 @@ import { useAccountSelectorActions, useAccountSelectorSyncLoadingAtom, } from '@onekeyhq/kit/src/states/jotai/contexts/accountSelector'; +import type { IDBIndexedAccount } from '@onekeyhq/kit-bg/src/dbs/local/types'; import { getNetworkImplsFromDappScope } from '@onekeyhq/shared/src/background/backgroundUtils'; import { ETranslations } from '@onekeyhq/shared/src/locale'; import platformEnv from '@onekeyhq/shared/src/platformEnv'; +import accountUtils from '@onekeyhq/shared/src/utils/accountUtils'; import timerUtils from '@onekeyhq/shared/src/utils/timerUtils'; import { EAccountSelectorSceneName } from '@onekeyhq/shared/types'; @@ -282,25 +288,6 @@ function DAppAccountListStandAloneItem({ ); } -function DAppAccountListStandAloneItemForHomeScene() { - const intl = useIntl(); - return ( - - - {intl.formatMessage({ id: ETranslations.global_accounts })} - - - - - - ); -} - function WalletConnectAccountTriggerList({ sceneUrl, sessionAccountsInfo, @@ -356,9 +343,75 @@ function WalletConnectAccountTriggerList({ ); } +const StaticDAppConnectionInfoAloneItem = ({ + networkId, + accountId, +}: { + networkId: string; + accountId: string; +}) => { + const intl = useIntl(); + const { result, isLoading } = usePromiseResult(async () => { + const [network, account, wallet] = await Promise.all([ + backgroundApiProxy.serviceNetwork.getNetworkSafe({ + networkId, + }), + backgroundApiProxy.serviceAccount.getAccount({ + accountId, + networkId, + }), + backgroundApiProxy.serviceAccount.getWallet({ + walletId: accountUtils.getWalletIdFromAccountId({ accountId }), + }), + ]); + let indexedAccount: IDBIndexedAccount | undefined; + if (account.indexedAccountId) { + indexedAccount = + await backgroundApiProxy.serviceAccount.getIndexedAccount({ + id: account.indexedAccountId, + }); + } + + return { network, account, wallet, indexedAccount }; + }, [networkId, accountId]); + return ( + + + {intl.formatMessage({ id: ETranslations.global_accounts })} + + } + disabled + overflow="hidden" + > + + + + + + + + + ); +}; + export { DAppAccountListItem, DAppAccountListStandAloneItem, - DAppAccountListStandAloneItemForHomeScene, WalletConnectAccountTriggerList, + StaticDAppConnectionInfoAloneItem, }; diff --git a/packages/kit/src/views/DAppConnection/pages/SignMessageModal.tsx b/packages/kit/src/views/DAppConnection/pages/SignMessageModal.tsx index 0e8f4c6ee83..79e7fe6092f 100644 --- a/packages/kit/src/views/DAppConnection/pages/SignMessageModal.tsx +++ b/packages/kit/src/views/DAppConnection/pages/SignMessageModal.tsx @@ -1,27 +1,16 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; import { useIntl } from 'react-intl'; -import { StyleSheet } from 'react-native'; import type { IAlertProps } from '@onekeyhq/components'; -import { - Divider, - Page, - SizableText, - YGroup, - YStack, -} from '@onekeyhq/components'; +import { Page } from '@onekeyhq/components'; import type { IUnsignedMessage } from '@onekeyhq/core/src/types'; -import { NetworkSelectorTriggerDappConnectionCmp } from '@onekeyhq/kit/src/components/AccountSelector'; -import { AccountSelectorTriggerDappConnectionCmp } from '@onekeyhq/kit/src/components/AccountSelector/AccountSelectorTrigger/AccountSelectorTriggerDApp'; -import type { IDBIndexedAccount } from '@onekeyhq/kit-bg/src/dbs/local/types'; import { ETranslations } from '@onekeyhq/shared/src/locale'; import platformEnv from '@onekeyhq/shared/src/platformEnv'; import { isPrimaryTypeOrderSign, isPrimaryTypePermitSign, } from '@onekeyhq/shared/src/signMessage'; -import accountUtils from '@onekeyhq/shared/src/utils/accountUtils'; import { validateSignMessageData, validateTypedSignMessageDataV1, @@ -36,7 +25,7 @@ import backgroundApiProxy from '../../../background/instance/backgroundApiProxy' import useDappApproveAction from '../../../hooks/useDappApproveAction'; import useDappQuery from '../../../hooks/useDappQuery'; import { usePromiseResult } from '../../../hooks/usePromiseResult'; -import { DAppAccountListStandAloneItem } from '../components/DAppAccountList'; +import { StaticDAppConnectionInfoAloneItem } from '../components/DAppAccountList'; import { DAppSignMessageContent } from '../components/DAppRequestContent'; import { DAppRequestFooter, @@ -46,87 +35,14 @@ import { useRiskDetection } from '../hooks/useRiskDetection'; import DappOpenModalPage from './DappOpenModalPage'; -const WalletAccountListItem = ({ - networkId, - accountId, -}: { - networkId: string; - accountId: string; -}) => { - const intl = useIntl(); - const { result, isLoading } = usePromiseResult(async () => { - const [network, account, wallet] = await Promise.all([ - backgroundApiProxy.serviceNetwork.getNetworkSafe({ - networkId, - }), - backgroundApiProxy.serviceAccount.getAccount({ - accountId, - networkId, - }), - backgroundApiProxy.serviceAccount.getWallet({ - walletId: accountUtils.getWalletIdFromAccountId({ accountId }), - }), - ]); - let indexedAccount: IDBIndexedAccount | undefined; - if (account.indexedAccountId) { - indexedAccount = - await backgroundApiProxy.serviceAccount.getIndexedAccount({ - id: account.indexedAccountId, - }); - } - - return { network, account, wallet, indexedAccount }; - }, [networkId, accountId]); - return ( - - - {intl.formatMessage({ id: ETranslations.global_accounts })} - - } - disabled - overflow="hidden" - > - - - - - - - - - ); -}; - function SignMessageModal() { const intl = useIntl(); const [isLoading, setIsLoading] = useState(false); - const { - $sourceInfo, - unsignedMessage, - accountId, - networkId, - walletInternalSign, - } = useDappQuery<{ + const { $sourceInfo, unsignedMessage, accountId, networkId } = useDappQuery<{ unsignedMessage: IUnsignedMessage; accountId: string; networkId: string; indexedAccountId: string; - walletInternalSign?: boolean; }>(); const dappApprove = useDappApproveAction({ @@ -291,14 +207,10 @@ function SignMessageModal() { signMessageAlertProps={getSignMessageAlertProps()} fullScreen={!platformEnv.isNativeIOS} > - {walletInternalSign ? ( - - ) : ( - - )} + diff --git a/packages/kit/src/views/LightningNetwork/pages/Send/LnurlAuthModal.tsx b/packages/kit/src/views/LightningNetwork/pages/Send/LnurlAuthModal.tsx index 6dbe1615758..51d382c658a 100644 --- a/packages/kit/src/views/LightningNetwork/pages/Send/LnurlAuthModal.tsx +++ b/packages/kit/src/views/LightningNetwork/pages/Send/LnurlAuthModal.tsx @@ -18,10 +18,7 @@ import type { } from '@onekeyhq/shared/src/routes'; import { EDAppModalPageStatus } from '@onekeyhq/shared/types/dappConnection'; -import { - DAppAccountListStandAloneItem, - DAppAccountListStandAloneItemForHomeScene, -} from '../../../DAppConnection/components/DAppAccountList'; +import { StaticDAppConnectionInfoAloneItem } from '../../../DAppConnection/components/DAppAccountList'; import { DAppRequestedPermissionContent } from '../../../DAppConnection/components/DAppRequestContent'; import { DAppRequestFooter, @@ -236,11 +233,10 @@ function LnurlAuthModal() { origin={origin ?? ''} urlSecurityInfo={urlSecurityInfo} > - {isSendFlow ? ( - - ) : ( - - )} + {renderRequestPermissions()} diff --git a/packages/kit/src/views/LightningNetwork/pages/Send/LnurlPayRequestModal.tsx b/packages/kit/src/views/LightningNetwork/pages/Send/LnurlPayRequestModal.tsx index 40e501abe7a..8cffa1d9d0a 100644 --- a/packages/kit/src/views/LightningNetwork/pages/Send/LnurlPayRequestModal.tsx +++ b/packages/kit/src/views/LightningNetwork/pages/Send/LnurlPayRequestModal.tsx @@ -21,10 +21,7 @@ import type { import { EDAppModalPageStatus } from '@onekeyhq/shared/types/dappConnection'; import type { ILNURLPaymentInfo } from '@onekeyhq/shared/types/lightning'; -import { - DAppAccountListStandAloneItem, - DAppAccountListStandAloneItemForHomeScene, -} from '../../../DAppConnection/components/DAppAccountList'; +import { StaticDAppConnectionInfoAloneItem } from '../../../DAppConnection/components/DAppAccountList'; import { DAppRequestFooter, DAppRequestLayout, @@ -218,11 +215,10 @@ function LnurlPayRequestModal() { origin={origin ?? ''} urlSecurityInfo={urlSecurityInfo} > - {routeParams.isSendFlow ? ( - - ) : ( - - )} + - {isSendFlow ? ( - - ) : ( - - )} +