From 54419043f7880f71bcc9701772f19c9ee0cf0250 Mon Sep 17 00:00:00 2001 From: Crash-- Date: Mon, 6 Nov 2023 09:40:07 +0100 Subject: [PATCH] feat: Add VIEW INTENT The idea is to be able to display an account from every where. This intent is not directly used in production, but it's useful to test the end (aka the display of harvest) of the intent create io.cozy.accounts. I used it to debug the "open in Drive" feature, since the link was not working. --- manifest.webapp | 6 ++++++ src/containers/IntentService.jsx | 19 ++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/manifest.webapp b/manifest.webapp index e3e16191da..83c73cd635 100644 --- a/manifest.webapp +++ b/manifest.webapp @@ -116,6 +116,12 @@ "href": "/intents", "data": ["slug"] }, + { + "action": "VIEW", + "type": ["io.cozy.accounts"], + "href": "/intents", + "data": ["slug", "accountId"] + }, { "action": "REDIRECT", "type": ["io.cozy.accounts"], diff --git a/src/containers/IntentService.jsx b/src/containers/IntentService.jsx index c3499ec06d..4a8d2037a4 100644 --- a/src/containers/IntentService.jsx +++ b/src/containers/IntentService.jsx @@ -36,14 +36,19 @@ const IntentService = ({ data, service }) => { } } else { if (service) { - service.hideCross() + const intent = service.getIntent() + if (service.hideCross) { + service.hideCross() + } + if ( + intent.attributes.action === 'VIEW' && + intent.attributes.type === 'io.cozy.accounts' + ) { + navigate(`/${service.getData().slug}/accounts/${data.accountId}`) + } else { + navigate(`/${service.getData().slug}/new`) + } } - // setKonnectorData(konnectorReq.data) - - // setTimeout(() => { - // console.log('will navigate ?') - navigate(`/${service.getData().slug}/new`) - // }, 500) } } }