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

[Feature Request]: PWA support #75

Open
geromegrignon opened this issue Nov 26, 2023 · 3 comments
Open

[Feature Request]: PWA support #75

geromegrignon opened this issue Nov 26, 2023 · 3 comments
Assignees

Comments

@geromegrignon
Copy link
Contributor

Relevant Scope

angular application

Description

Add PWA support so users can use the application offline and install it.

Describe the solution you'd like

Use @angular/pwapackage

  • run npm install @angular/pwa firstly as it's a nx workspace
  • run npx nx g @angular/pwa:ng-add --project=angular-hub to run the schematic

Update created icons

You can use this image here as a starter
There are multiples web app to generate different icons based one it, like PWA Builder

Add update mechanism

Add some logic to reload the application on updates, for example:

router.events
      .pipe(
        filter((event) => event instanceof NavigationEnd),
        switchMap(() => this.swUpdate.versionUpdates),
        filter((evt): evt is VersionReadyEvent => evt.type === 'VERSION_READY')
      )
      .subscribe(() => {
        document.location.reload();
      });
      ```

### Describe alternatives you've considered

_No response_
@geromegrignon
Copy link
Contributor Author

@ahmedhmf Do you want to work on it?

I made a quick attempt: Besides the explanation provided, it might need some extra configuration as the ngsw.json(and the generated ngsw-worker.js) were not part of the dist folder by building the application.

@ahmedhmf
Copy link
Contributor

Sure I'll start on it 😃

@geromegrignon
Copy link
Contributor Author

@ahmedhmf I added an experimental version of it.

Installation works but by opening it it first fails as it's trying to query the angular-hub.com/assets URl for some unknown reason. By refreshing, the installed app works as expected (but it means it can't be used offline for the moment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants