Skip to content

chore(android): remove unreachable Saved Peers screen and other dead code - #1123

Merged
torlando-tech merged 4 commits into
mainfrom
chore/remove-dead-saved-peers
Sep 4, 2026
Merged

chore(android): remove unreachable Saved Peers screen and other dead code#1123
torlando-tech merged 4 commits into
mainfrom
chore/remove-dead-saved-peers

Conversation

@torlando-tech

Copy link
Copy Markdown
Owner

What this removes

Dead code found by tracing the 'Saved Peers' notification-settings bug. Two commits, each independently safe.

Commit 1: Unreachable Saved Peers screen + orphan cascade

The Saved Peers screen was never wired into navigation (no AppDestination entry, no nav-graph reference). It and its exclusive dependencies:

  • SavedPeersScreen.kt, SavedPeersViewModel.kt + test (deleted)
  • AnnounceDao: getFavoriteAnnounces, searchFavoriteAnnounces, getFavoriteCount, getEnrichedFavoriteAnnounces, searchEnrichedFavoriteAnnounces
  • AnnounceRepository: getFavoriteAnnounces, searchFavoriteAnnounces, toggleFavorite, getFavoriteCount
  • PeerCard.showFavoriteToggle param - only the deleted screen set it false; star state is now simply announce.isFavorite

Kept (still live): setFavorite/updateFavoriteStatus (Announce Stream star writes both the contacts table and the announce flag in sync), the announces.isFavorite column + stale-announce cleanup protection, getAnnounceFlow.

Commit 2: Dead MainScreen demo + unwired LocationSharingViewModel

  • MainScreen + MainViewModel + UiState: the original 'Hello, Reticulum!' demo scaffold. MainActivity renders the NavHost and never references it; no destination, nav entry, or injection site (all 38 registered destinations verified reachable).
  • LocationSharingViewModel: extracted from MessagingViewModel in a refactor but never attached to any screen (full-history git log -S confirms zero references in any commit). The live location-sharing feature is intact - it runs through LocationSharingManager directly from MessagingViewModel / MapViewModel / SettingsViewModel.

Verification (both commits, on head ff77b8a)

  • Compile: :app + :data
  • Full unit suites: 6510 tests, 0 failures, 0 errors (includes LocationSharingCardTest, MessagingViewModelTest, SettingsViewModelTest, MapViewModelTest, AnnounceDaoTest, AnnounceRepositoryTest, PeerCardTest)
  • :app + :data detekt + ktlint clean

Net: 13 files, +4 / -1891 lines. No behavioral change to any reachable feature.

Known non-issues

  • detekt-baseline-debug.xml retains one stale ID for the deleted MainViewModel.kt. Inert (stale baseline entries are ignored); not hand-edited per generated-file convention.

The Saved Peers screen was never wired into navigation (no AppDestination
entry, no nav-graph reference), leaving it dead code. Removing it cascades
to the only other references to the favorites listing surface:

- Delete SavedPeersScreen, SavedPeersViewModel, SavedPeersViewModelTest
- AnnounceDao: drop getFavoriteAnnounces, searchFavoriteAnnounces,
  getFavoriteCount, getEnrichedFavoriteAnnounces,
  searchEnrichedFavoriteAnnounces (no remaining callers)
- AnnounceRepository: drop getFavoriteAnnounces, searchFavoriteAnnounces,
  toggleFavorite, getFavoriteCount
- PeerCard: drop the showFavoriteToggle param, only the deleted screen set
  it to false; star state is now simply announce.isFavorite
- PeerCardTest: remove the saved-screen case and param references
- AnnounceStreamViewModel: fix stale comment referencing toggleFavorite

Kept: setFavorite/updateFavoriteStatus (Announce Stream star sync),
isFavorite column + stale-cleanup protection, getAnnounceFlow.
Two more unreachable code clusters found while tracing the Saved Peers
removal:

- MainScreen + MainViewModel + UiState: the original 'Hello, Reticulum!'
  demo scaffold. MainActivity renders the NavHost and never references
  MainScreen; no AppDestination, nav-graph, or injection site exists.
  Remove the screen, its viewmodel, the UiState sealed class, and
  MainViewModelTest.
- LocationSharingViewModel: extracted from MessagingViewModel for single
  responsibility but never wired into any screen (MessagingViewModel and
  MapViewModel handle location sharing inline via LocationSharingManager).
  Only its own test referenced it. Remove it and LocationSharingViewModelTest.

Both removals orphan no shared code: LocationSharingManager,
LocationSharingState, SharingDuration, ContactRepository, and RnsCore all
remain in use by live screens and viewmodels.
@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR removes unreachable Android screens, unused view models, their orphaned favorite-peer data APIs, and associated tests while retaining the live contact and location-sharing paths.

  • Simplifies PeerCard to render the persisted favorite state directly.
  • Removes the unwired Saved Peers and demo Main screen implementations.
  • Removes the unused LocationSharingViewModel.
  • Deletes favorite-query repository and DAO methods used only by the removed screen.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
app/src/main/java/network/columba/app/ui/components/PeerCard.kt Removes the Saved Peers-only display override; the remaining Announce Stream caller continues to render announce.isFavorite.
app/src/main/java/network/columba/app/ui/screens/SavedPeersScreen.kt Deletes a screen absent from the application destination registry and navigation graph.
app/src/main/java/network/columba/app/viewmodel/LocationSharingViewModel.kt Deletes an unwired view model while live location-sharing consumers continue using LocationSharingManager.
data/src/main/java/network/columba/app/data/db/dao/AnnounceDao.kt Removes favorite-list queries and counts associated with the deleted Saved Peers feature while retaining favorite-status updates.
data/src/main/java/network/columba/app/data/repository/AnnounceRepository.kt Removes orphaned favorite-peer repository methods without changing the retained announce and contact synchronization path.

Reviews (3): Last reviewed commit: "test(contacts): make retryIdentityResolu..." | Re-trigger Greptile

@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Fix a pre-existing flake that failed CI on this PR's first run (Kotlin
Tests Shard 1/4) in NomadNetBrowserViewModelTest.'identifyToNode does
nothing when already identified'.

identifyToNode() dispatches its work onto the real Dispatchers.IO, but
this test only replaces Dispatchers.Main with a TestDispatcher, so
advanceUntilIdle() cannot observe the IO coroutine's completion. The
coVerify(exactly=1) then raced the IO thread; under CI load the mock
call was not yet recorded ('was not called').

Poll for the isIdentified flag the IO coroutine sets (bounded at 2s)
before asserting, instead of relying on advanceUntilIdle alone. The
production guard (_identifyInProgress) was already correct.

Verified: 10/10 consecutive runs green + detekt/ktlint clean.
Fix the second pre-existing flake hit on this PR (Kotlin Tests Shard 2/4):
ContactsViewModelTest.'retryIdentityResolution - resets contact with fresh
timestamp'.

retryIdentityResolution() launches on the real Dispatchers.IO, but the
test only replaces Dispatchers.Main, so the bare coVerify/verify raced
the IO thread ('was not called' under CI load). The two sibling tests in
the same group already use verify(timeout=1000) for exactly this reason;
apply the same pattern here.

Verified: 10/10 consecutive runs green + detekt/ktlint clean.
@torlando-tech
torlando-tech merged commit 7a81861 into main Sep 4, 2026
13 checks passed
@torlando-tech
torlando-tech deleted the chore/remove-dead-saved-peers branch September 4, 2026 18:14
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.

1 participant