Skip to content

Commit

Permalink
Merge branch 'main' into feat-human-readable-predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
wadeking98 authored Oct 17, 2023
2 parents 5edeb3e + 2f80d8f commit 824f099
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/legacy/core/App/navigators/RootStack.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { useAgent } from '@aries-framework/react-hooks'
import { ProofState } from '@aries-framework/core'
import { useAgent, useProofByState } from '@aries-framework/react-hooks'
import { useNavigation } from '@react-navigation/core'
import { createStackNavigator, StackCardStyleInterpolator, StackNavigationProp } from '@react-navigation/stack'
import { parseUrl } from 'query-string'
import React, { useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { AppState, DeviceEventEmitter } from 'react-native'

import { ProofCustomMetadata, ProofMetadata } from '../../verifier'
import HeaderButton, { ButtonLocation } from '../components/buttons/HeaderButton'
import { EventTypes, walletTimeout } from '../constants'
import { useAuth } from '../contexts/auth'
Expand Down Expand Up @@ -51,6 +53,18 @@ const RootStack: React.FC = () => {
const { pages, terms, splash, useBiometry, developer } = useConfiguration()
useDeepLinks()

// remove connection on mobile verifier proofs if proof is rejected regardless of if it has been opened
const declinedProofs = useProofByState([ProofState.Declined, ProofState.Abandoned])
useEffect(() => {
declinedProofs.forEach((proof) => {
const meta = proof?.metadata?.get(ProofMetadata.customMetadata) as ProofCustomMetadata
if (meta?.delete_conn_after_seen) {
agent?.connections.deleteById(proof?.connectionId ?? '').catch(() => {})
proof?.metadata.set(ProofMetadata.customMetadata, { ...meta, delete_conn_after_seen: false })
}
})
}, [declinedProofs, state.preferences.useDataRetention])

const lockoutUser = async () => {
if (agent && state.authentication.didAuthenticate) {
// make sure agent is shutdown so wallet isn't still open
Expand Down

0 comments on commit 824f099

Please sign in to comment.