From 8d29e521cc0c49498be21436064cb50f3022e18f Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Sun, 9 Jul 2023 22:00:04 +0700 Subject: [PATCH] update useStronghold hook --- src/app/chat/index.tsx | 8 ++++++-- src/app/settings/account.tsx | 6 +++++- src/app/space/components/addImage.tsx | 19 +++++-------------- src/utils/hooks/usePublish.tsx | 13 +++++++++---- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/app/chat/index.tsx b/src/app/chat/index.tsx index 0c36e1ea..7036bc37 100644 --- a/src/app/chat/index.tsx +++ b/src/app/chat/index.tsx @@ -11,6 +11,8 @@ import { ChatSidebar } from '@app/chat/components/sidebar'; import { useNDK } from '@libs/ndk/provider'; import { createChat, getChatMessages } from '@libs/storage'; +import { useStronghold } from '@stores/stronghold'; + import { useAccount } from '@utils/hooks/useAccount'; export function ChatScreen() { @@ -30,13 +32,15 @@ export function ChatScreen() { } ); + const userPrivkey = useStronghold((state) => state.privkey); + const itemContent: any = useCallback( (index: string | number) => { return ( ); }, @@ -131,7 +135,7 @@ export function ChatScreen() { diff --git a/src/app/settings/account.tsx b/src/app/settings/account.tsx index c06663a5..a2b82b63 100644 --- a/src/app/settings/account.tsx +++ b/src/app/settings/account.tsx @@ -2,12 +2,16 @@ import { useState } from 'react'; import { EyeOffIcon, EyeOnIcon } from '@shared/icons'; +import { useStronghold } from '@stores/stronghold'; + import { useAccount } from '@utils/hooks/useAccount'; export function AccountSettingsScreen() { const { status, account } = useAccount(); const [type, setType] = useState('password'); + const privkey = useStronghold((state) => state.privkey); + const showPrivateKey = () => { if (type === 'password') { setType('text'); @@ -56,7 +60,7 @@ export function AccountSettingsScreen() {