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

feat(native-app): log confirm actions of subpoena to backend #16862

Merged
merged 5 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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: 7 additions & 0 deletions apps/native/app/src/graphql/queries/inbox.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,10 @@ mutation PostMailActionMutation($input: DocumentsV2MailActionInput!) {
success
}
}

query DocumentConfirmActions($input: DocumentConfirmActionsInput!) {
documentV2ConfirmActions(input: $input) {
id
confirmed
}
}
22 changes: 20 additions & 2 deletions apps/native/app/src/screens/document-detail/document-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
DocumentV2Action,
ListDocumentFragmentDoc,
useGetDocumentQuery,
useDocumentConfirmActionsLazyQuery,
} from '../../graphql/types/schema'
import { createNavigationOptionHooks } from '../../hooks/create-navigation-option-hooks'
import { useConnectivityIndicator } from '../../hooks/use-connectivity-indicator'
Expand Down Expand Up @@ -248,6 +249,17 @@ export const DocumentDetailScreen: NavigationFunctionComponent<{
const [pdfUrl, setPdfUrl] = useState('')
const [refetching, setRefetching] = useState(false)

const [logConfirmedAction] = useDocumentConfirmActionsLazyQuery({
fetchPolicy: 'no-cache',
})

const confirmAction = (confirmed: boolean | null) => {
// Adding a suffix '_app' to the id since the backend is currently not distinguishing between the app and the web
logConfirmedAction({
variables: { input: { id: `${docId}_app`, confirmed: confirmed } },
})
}

const refetchDocumentContent = async () => {
setRefetching(true)
try {
Expand All @@ -268,11 +280,17 @@ export const DocumentDetailScreen: NavigationFunctionComponent<{
{
text: intl.formatMessage({ id: 'inbox.markAllAsReadPromptCancel' }),
style: 'cancel',
onPress: () => Navigation.pop(componentId),
onPress: () => {
confirmAction(false)
Navigation.pop(componentId)
},
},
{
text: intl.formatMessage({ id: 'inbox.openDocument' }),
onPress: refetchDocumentContent,
onPress: () => {
confirmAction(true)
refetchDocumentContent()
},
},
])
}
Expand Down
Loading