Skip to content

Commit

Permalink
feat: Add VIEW INTENT
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Crash-- committed Nov 14, 2023
1 parent 711b8c7 commit 5441904
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
6 changes: 6 additions & 0 deletions manifest.webapp
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
19 changes: 12 additions & 7 deletions src/containers/IntentService.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down

0 comments on commit 5441904

Please sign in to comment.