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

Basic PWA support #4989

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

Conversation

oracularhades
Copy link
Contributor

Bluesky post from @blowdart.me 'I really wish the [bsky.app](https://bsky.app/) site was an actual PWA so I could get notifications on my iPad, as I’ve totally given up on iPad support in the app now.'

blowdart.me: https://bsky.app/profile/blowdart.me/post/3l2ifc6t2bp2f

This was done by vaguely following: https://docs.expo.dev/guides/progressive-web-apps/

This PR adds a basic PWA setup. This isn't everything I wanted, I also wanted PWA notifications but I couldn't figure how to get Expo notifications working for PWAs, I'm not even sure Expo notifications support PWAs. I'm happy to add Expo notifications to Bsky PWA's, but I'll need guidance from bsky team on doing that, I don't want to make a mess.

What's in this PR:

  • Adds /web/pwa, which includes a copy of logo.png renamed to pwa-icon.png. Assets must be in web/ to get added to the path tree (from what I can tell, I may be wrong).
  • Adds pwa-load-sw, which loads the pwa service worker generated by workbox. This script will only load the pwa service worker if the page is running 'standalone' display, we don't want to effect the regular web users.
  • Adds workbox-config to web/, this is because Expo requires workbox for PWA service workers in their pwa documentation.
  • Adds PWA manifest and pwa-load-sw.js

Bugs:

  • The navigation bar (home, search, notifications, etc) at the bottom of the app screen doesn't appear and disappear smoothly when scrolling your feed. You have to scroll up really far for it to transition properly, but anything before that it just sort of fades. This won't be an issue for iPad users (barry will be free).

Notes:

  • For your mobile browser to accept a service worker, you need to run your development server as 'expo start --web --https'

It would be good to have a second pair of eyes ensure PWA caching is working correctly and I haven't generally messed up. I haven't done PWAs via expo before. I've tried to keep everything as clean and minimal as possible, but totally possible I've done something wrong. This commit is intended to help get a start on PWAs if the team is interested, Mastodon also supports PWAs.

output.mp4

(My login credentials and 2FA code are cut from that video, which is why it looks like the loading icon came up immediately, I have not performed any session handoff magic.).

Thanks,
Josh 🦋

@mary-ext
Copy link
Contributor

iirc bluesky uses gorush for push notifications and that doesn't have support for web push notifs

@oracularhades
Copy link
Contributor Author

iirc bluesky uses gorush for push notifications and that doesn't have support for web push notifs

well, all is not lost. Barry can use the native app on his iPad via this PWA setup at least.

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.

2 participants