Skip to content

feat(pwa): PWA + service worker for offline-friendly demo#44

Open
playmaker410 wants to merge 1 commit into
wraith-protocol:developfrom
playmaker410:feat/pwa-service-worker
Open

feat(pwa): PWA + service worker for offline-friendly demo#44
playmaker410 wants to merge 1 commit into
wraith-protocol:developfrom
playmaker410:feat/pwa-service-worker

Conversation

@playmaker410
Copy link
Copy Markdown

Summary

Implements #19 — PWA conversion using vite-plugin-pwa.

Changes

Manifest (vite.config.ts)

  • name, short_name, description, start_url: /, display: standalone
  • Icons: 192×192 and 512×512 maskable (existing android-chrome-*.png)
  • Theme color: #0e0e0e (Wraith dark palette)

Service worker (Workbox generateSW)

  • Precaches full app shell (HTML/CSS/JS/fonts) — 180 entries
  • Cache size cap: 20 MB (maximumFileSizeToCacheInBytes)
  • Stellar RPC balance lookups — NetworkFirst, 30 s TTL
  • Stellar announcements/transactions — NetworkFirst, 5 min TTL
  • EVM/Horizen RPC — NetworkFirst, 30 s TTL
  • Google Fonts — CacheFirst, 1 year TTL
  • registerType: 'prompt' — new SW waits for user confirmation before activating
  • Stealth keys, viewing keys, and signed transactions are never cached (no matching URL patterns; only RPC responses are cached)

Components

  • OfflineShell — wraps the app; renders a friendly offline page when navigator.onLine is false with a Retry button
  • UpdateToast — "A new version is ready. Click to reload." toast, dismissible
  • InstallPrompt — "Install Wraith / Add to home screen" button, fires on beforeinstallprompt

Testing

  • tsc --noEmit passes clean
  • vite build succeeds; dist/sw.js + dist/workbox-*.js generated
  • Offline behavior: toggle DevTools → Network → Offline; app renders OfflineShell instead of blank screen
  • Update flow: serve old build, deploy new build, SW detects update and shows toast

Closes #19

- Configure vite-plugin-pwa with generateSW strategy
- Manifest: name, short_name, description, start_url, standalone display,
  192x192 and 512x512 maskable icons, theme #0e0e0e
- Workbox: precache app shell (HTML/CSS/JS/fonts), 20 MB cap
- Runtime cache: Stellar RPC balance (network-first, 30 s TTL),
  announcements (network-first, 5 min TTL), EVM/Horizen RPC (network-first)
- Google Fonts: cache-first, 1 year TTL
- registerType: prompt — shows update toast before activating new SW
- OfflineShell: friendly offline page with retry button
- UpdateToast: 'A new version is ready. Click to reload.'
- InstallPrompt: 'Install Wraith' button on beforeinstallprompt

Closes wraith-protocol#19
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@playmaker410 is attempting to deploy a commit to the truthixify's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@playmaker410 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@truthixify truthixify changed the base branch from main to develop June 1, 2026 15:49
@truthixify
Copy link
Copy Markdown
Contributor

PWA components (InstallPrompt, OfflineShell, UpdateToast), Vite PWA plugin config (vite.config.ts +96), and the App-level mount are right for #19. Rebase needed, branch is pre-develop and diff would revert recent merges in StellarSend/Receive.

git fetch origin
git rebase origin/develop
git push --force-with-lease

Drop reverts to StellarSend/Receive during the rebase. Thanks @playmaker410.

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.

PWA + service worker for offline-friendly demo

2 participants