Repository navigation
feat(connectivity): know whether the device is online in the listing form - #388
Merged
Merged
Conversation
A point within 600 m of the EPFL or UNIL centre is named \"EPFL campus\" or \"UNIL campus\", the nearer one winning.
The picker opens on the chosen or saved location, else the lender's approximate location, else EPFL. A campus name is dropped when the pin moves off campus, and a blank name blocks saving. Wire FusedLocationRepository into both listing forms.
Add ConnectivityRepository and its Android version, which follows the default network and counts it as online only once validated. Part of #364. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The form state exposes isOnline, followed live and never saved, so the location picker can be disabled offline. One ConnectivityRepository per process is passed through AppNavHost to both forms. Part of #364. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the conflicts where the location repository is passed to AppNavHost, next to the photo-message chat repository and the booking repository from main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… device The LocationRepository KDoc and the ACCESS_COARSE_LOCATION comment said the location is never stored, but the listing form now keeps it in its saved state to reopen the map picker there after the app is killed. It is still never sent to the backend. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Like the price and refund, showLocationNameError now waits for leaveLocationNameField(), so picking a point off campus no longer shows an error before the lender can type a name. Saving stays blocked while the name is blank. clearLocation() resets the flag, and it survives the app being killed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add ConnectivityRepository and its Android version, which follows the default network and counts it as online only once validated. Part of #364. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The form state exposes isOnline, followed live and never saved, so the location picker can be disabled offline. One ConnectivityRepository per process is passed through AppNavHost to both forms. Part of #364. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adrimikh
requested changes
Nov 19, 2026
adrimikh
left a comment
Contributor
There was a problem hiding this comment.
The repository cleanly isolates Android connectivity behind a StateFlow, and the form observes it live without saving it into the draft. Requiring a validated network is a reasonable way to avoid treating a captive portal as online.
I just requested a change and everything will be good.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
During a Wi-Fi/mobile handoff, the old network's onLost can arrive after the new one became the default. The repository now remembers the current default network and only reports offline when that one is lost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.



Summary
Part of #365. The listing form now knows whether the device is online, so the map picker in #369 can be disabled offline. Split out of #366 after review, since it isn't part of #364. Builds on #366 (review that first); #369 builds on this one.
What
ConnectivityRepository: an interface exposingisOnlineas aStateFlow<Boolean>.AndroidConnectivityRepositoryfollows the default network and counts it as online only once it is validated.ACCESS_NETWORK_STATEin the manifest.ListingFormViewModel: takes aConnectivityRepository(interface only) and exposesisOnlinein the form state. It is followed live and never saved.AndroidConnectivityRepositoryfor the whole process, created inMainActivityand passed throughAppNavHostto both listing forms. It is never released, because the forms' ViewModels outlive a rotated activity and its network callback should be registered only once.FakeConnectivityRepositoryis added insharedTest.Why
Choosing a location on the map needs map tiles, so the picker should be disabled offline with a hint, while the rest of the form keeps working. It was first in #366, but the review pointed out that nothing there reads
isOnline, so it moves next to the UI that uses it.Validation
./gradlew ktfmtCheck check: passes, lint included (run on feat(listing): choose the pickup location or meeting place on a map #369 rebased on top of this branch).AndroidConnectivityRepositoryTestchecks that it starts offline without a validated internet network and then follows the default network.ListingFormViewModelTestchecks thatisOnlinefollows the repository and is kept when the edited listing loads and when the form resets after saving.AI use
Claude Code (Claude Opus 5.5) wrote the repository and the wiring with me and tested them. After the #366 review, it moved these commits into this PR and resolved the conflicts with
main. I reviewed the diff.