Repository navigation
feat(offline): show a hint on a first launch without internet - #87
Merged
Merged
Conversation
dargmuesli
force-pushed
the
feat/offline/first-launch
branch
from
November 22, 2026 16:48
4d17b75 to
8750697
Compare
dargmuesli
marked this pull request as ready for review
November 22, 2026 17:59
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))
|
🎉 This PR is included in version 0.8.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.