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

add webmanifest's shortcuts support #378

Merged
merged 3 commits into from
Feb 4, 2022
Merged

Conversation

chrmoritz
Copy link
Contributor

@chrmoritz chrmoritz commented Feb 2, 2022

This PR adds support for webmanifest's shortcuts. For more information see:

https://developer.mozilla.org/en-US/docs/Web/Manifest/shortcuts
https://web.dev/app-shortcuts/
https://w3c.github.io/manifest/#shortcuts-member

Example usage:

const result = await favicons(logo_png, {
  shortcuts: [
    {
      name: "View your Inbox",
      short_name: "inbox",
      description: "View your inbox messages",
      url: "/inbox",
      icon: ["test/shortcut1.png", "test/shortcut1-small.png"],
    },
    {
      name: "Picture Gallery",
      short_name: "pictures",
      description: "View your own Picture Gallery",
      url: "/pictures",
      icon: "test/shortcut2.svg"
    },
  ],
});

See also the added test and readme changes for usage of this new feature.

@chrmoritz chrmoritz changed the title Shortcuts add webmanifest's shortcuts support Feb 2, 2022
@chrmoritz chrmoritz changed the title add webmanifest's shortcuts support add webmanifest's shortcuts support Feb 2, 2022
Copy link
Collaborator

@andy128k andy128k left a comment

Choose a reason for hiding this comment

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

I think this feature should respect option output: { images: false }.

src/config/defaults.ts Outdated Show resolved Hide resolved
src/config/defaults.ts Outdated Show resolved Hide resolved
src/platforms/android.ts Outdated Show resolved Hide resolved
src/platforms/android.ts Outdated Show resolved Hide resolved
@chrmoritz
Copy link
Contributor Author

chrmoritz commented Feb 3, 2022

Thank you for the fast review, I've addressed all your comments and fixed another typo from me, which broke short_name.

Also rebased on the current master to resolve the small conflict with 9632b9d.

I think this feature should respect option output: { images: false }.

I'll look at it tomorrow, but if I read the code correctly then the maskable icons doesn't respect it either?

readme.md Show resolved Hide resolved
src/config/defaults.ts Outdated Show resolved Hide resolved
src/platforms/android.ts Show resolved Hide resolved
@andy128k
Copy link
Collaborator

andy128k commented Feb 3, 2022

It looks like both maskable and shortcuts respect output: { images: false }.

src/platforms/android.ts Outdated Show resolved Hide resolved
src/platforms/android.ts Outdated Show resolved Hide resolved
@andy128k andy128k merged commit 16e1131 into itgalaxy:master Feb 4, 2022
@andy128k
Copy link
Collaborator

andy128k commented Feb 4, 2022

@chrmoritz Thanks!

@chrmoritz chrmoritz deleted the shortcuts branch February 4, 2022 23:10
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

Successfully merging this pull request may close these issues.

None yet

2 participants