Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check next id verified #6242

Merged
merged 1 commit into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/mask/src/components/DataSource/useNextID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ export function useNextIDConnectStatus() {
const lastRecognized = useLastRecognizedIdentity()
const [username] = useState(lastState.username || lastRecognized.identifier?.userId || '')

const { value: VerificationStatus = NextIDVerificationStatus.Other, retry } = useAsyncRetry(async () => {
const {
value: VerificationStatus = NextIDVerificationStatus.Other,
retry,
loading,
} = useAsyncRetry(async () => {
// Whether in connect to {platform} process
if (lastState.status === SetupGuideStep.FindUsername) return NextIDVerificationStatus.WaitingLocalConnect

Expand Down Expand Up @@ -118,6 +122,7 @@ export function useNextIDConnectStatus() {
return {
isVerified: VerificationStatus === NextIDVerificationStatus.Verified,
status: VerificationStatus,
loading,
reset: () => {
isOpenedVerifyDialog = false
isOpenedFromButton = true
Expand Down
6 changes: 5 additions & 1 deletion packages/mask/src/components/shared/ApplicationBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ function RenderEntryComponent({ application }: { application: Application }) {

if (application.entry.nextIdRequired) {
return Boolean(
ApplicationEntryStatus.isNextIDVerify === undefined ||
ApplicationEntryStatus.isLoading ||
ApplicationEntryStatus.isNextIDVerify === undefined ||
(!ApplicationEntryStatus.isSNSConnectToCurrentPersona && ApplicationEntryStatus.isPersonaConnected),
)
} else {
Expand Down Expand Up @@ -268,6 +269,7 @@ interface ApplicationEntryStatusContextProps {
currentPersonaPublicKey: string | undefined
currentSNSConnectedPersonaPublicKey: string | undefined
personaConnectAction: (() => void) | undefined
isLoading: boolean
}

const ApplicationEntryStatusContext = createContext<ApplicationEntryStatusContextProps>({
Expand All @@ -280,6 +282,7 @@ const ApplicationEntryStatusContext = createContext<ApplicationEntryStatusContex
currentPersonaPublicKey: undefined,
currentSNSConnectedPersonaPublicKey: undefined,
personaConnectAction: undefined,
isLoading: false,
})

function ApplicationEntryStatusProvider(props: PropsWithChildren<{}>) {
Expand Down Expand Up @@ -308,6 +311,7 @@ function ApplicationEntryStatusProvider(props: PropsWithChildren<{}>) {
shouldVerifyNextId: Boolean(!nextIDConnectStatus.isVerified && ApplicationCurrentStatus),
currentPersonaPublicKey,
currentSNSConnectedPersonaPublicKey,
isLoading: nextIDConnectStatus.loading,
}}>
{props.children}
</ApplicationEntryStatusContext.Provider>
Expand Down