Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

PWA share target implementation #129

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

RoboMagus
Copy link
Contributor

@RoboMagus RoboMagus commented Oct 5, 2023

This is an intitial step towards the implementation of a share_target for PWA, as requested in go-vikunja/vikunja#117.

The intended workings of it are to register a share_target for the PWA to accept text, which would then be used to create a new task with the provided text as Title & Description of this task, and then to open the task view for the user to further edit.

Registration of the handler, receiving the provided data, and forwarding to a task view upon success are working as expected. However use of the TaskStore and AuthStore cause pnpm run build to error out with seemingly useless parsing errors.

I'm no frontend dev and quite unfamiliar with anything JS. Hopefully someone with more experience is able to further aid the implementation of this feature.

Resolves go-vikunja/vikunja#117

src/sw.ts Outdated Show resolved Hide resolved
vite.config.ts Outdated
@@ -202,6 +202,15 @@ export default defineConfig(({mode}) => {
url: '/teams',
},
],
share_target: {
action: '/_share-target',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's a route, why not use the vue routing system?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit is required for the PWA manifest to register the app as a share-target

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kolaente, I did change the share_target to use the GET method, and now with the processing added to index.ts everthing seems to work as I intended :)

I'll remove the draft status as its ready for review.

@RoboMagus RoboMagus marked this pull request as ready for review October 6, 2023 19:09
{
path: '/tasks/create',
name: 'task.create',
beforeEnter: async (to, from, next) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put this logic in a new component.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how that would work, as there is no view for this. The intention is to show the newly created task (resulting in a TaskDetailView) and thus the logic is implemented in the beforeEnter handling instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you create a new view which does nothing but contains the logic you have here and then redirects (maybe show a loading spinner etc. while we're at it)? This kind of logic should not go into a beforeEnter handler.

src/router/index.ts Outdated Show resolved Hide resolved
src/router/index.ts Outdated Show resolved Hide resolved
vite.config.ts Show resolved Hide resolved
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FR] Add capabilities to receive 'share' intents
2 participants