Skip to content

feat: Offline support / service worker tuning for native#81

Merged
brianorwhatever merged 2 commits intomainfrom
feat/offline-native-support
Feb 8, 2026
Merged

feat: Offline support / service worker tuning for native#81
brianorwhatever merged 2 commits intomainfrom
feat/offline-native-support

Conversation

@krusty-agent
Copy link
Copy Markdown
Collaborator

Offline Support for Capacitor Native

Phase 2 item: Offline support / service worker tuning for native.

Changes

Capacitor Network Plugin (@capacitor/network)

  • Replaces unreliable navigator.onLine on native platforms
  • Accurate connection type detection (wifi/cellular/none)
  • Auto-syncs queued mutations when connectivity returns

Service Worker Improvements

  • Pre-caches critical app shell assets (/, manifest, icons) on install
  • Now caches hashed JS/CSS bundles (cache-first since they're immutable by hash) — enables full offline app shell
  • Bumped cache version to v4
  • Always registers SW on Capacitor native (even in dev mode)

Enhanced Offline UI

  • OfflineIndicator shows pending change count when offline
  • Shows syncing spinner with count when reconnecting
  • Safe area inset support for native status bar

Capacitor Config

  • Set androidScheme: 'https' for service worker compatibility in Android WebView

Existing Infrastructure (unchanged)

  • IndexedDB offline storage for lists & items ✅
  • Mutation queue with retry + conflict detection ✅
  • SyncManager with exponential backoff ✅
  • Optimistic item updates with offline queueing ✅

Krusty added 2 commits February 8, 2026 07:43
- Add @capacitor/network plugin for reliable native network detection
- Pre-cache critical app shell assets (/, manifest, icons) in service worker
- Cache hashed JS/CSS assets for offline access (previously skipped)
- Bump service worker cache version to v4
- Enhanced OfflineIndicator: shows pending change count + syncing state
- Capacitor config: set androidScheme to https for SW compatibility
- SW registration: always register on Capacitor native platform
- Safe area support for native offline banner
@brianorwhatever brianorwhatever merged commit fec0d48 into main Feb 8, 2026
2 of 3 checks passed
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