Skip to content

feat(offline): show a hint on a first launch without internet - #87

Merged
dargmuesli merged 4 commits into
mainfrom
feat/offline/first-launch
Nov 22, 2026
Merged

dargmuesli merged 4 commits into
mainfrom
feat/offline/first-launch

Conversation

@dargmuesli

@dargmuesli dargmuesli commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

The web app's service worker serves an offline page, but it only exists after the app has loaded once online. A first launch without a connection therefore opened the browser onto its own error page. The launcher now checks connectivity until a page has loaded once and, while offline, shows a native hint with a retry button instead, following the androidbrowserhelper twa-offline-first demo. Later launches go straight to the Trusted Web Activity as before.

Unlike the demo, the app only remembers the first launch once the browser reports a finished page load through the session callback, which still wraps the library's quality enforcer, so a first launch interrupted before loading shows the hint again next time. A share or link arriving while the hint shows starts a new launcher instance, which now closes the earlier hint instead of stacking on top of it.

The connectivity check ignores VPN networks. An always-on VPN becomes the active network and reports internet access even when no network sits underneath it, which made the launcher skip the hint, so the app only counts itself online when a non-VPN network offers internet. The hint pads its text away from the screen edges and styles the retry button in the web app's primary action color.

Tested on an Android phone with an always-on VPN: the hint shows on an offline first launch, retry stays on the hint while offline and opens the web app once online, and a later offline launch opens the web app's own offline view.

@dargmuesli
dargmuesli force-pushed the feat/offline/first-launch branch from 4d17b75 to 8750697 Compare November 22, 2026 16:48
@dargmuesli
dargmuesli marked this pull request as ready for review November 22, 2026 17:59
@dargmuesli
dargmuesli merged commit 7f8c7db into main Nov 22, 2026
11 checks passed
@dargmuesli
dargmuesli deleted the feat/offline/first-launch branch November 22, 2026 18:03
maevsi-bot pushed a commit that referenced this pull request Nov 23, 2026
## [0.8.0](0.7.0...0.8.0) (2026-11-23)

### Features

* **offline:** show a hint on a first launch without internet ([#87](#87)) ([7f8c7db](7f8c7db))
@maevsi-bot

Copy link
Copy Markdown

🎉 This PR is included in version 0.8.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants