CMM-2133: Self-fetch the remaining Stats detail screens (clicks, search, video, downloads, authors)#23067
Draft
adalpari wants to merge 9 commits into
Draft
CMM-2133: Self-fetch the remaining Stats detail screens (clicks, search, video, downloads, authors)#23067adalpari wants to merge 9 commits into
adalpari wants to merge 9 commits into
Conversation
Referrer groups can contain child referrers (e.g. "Search Engines"), but the new stats Referrers card discarded them and rendered a flat list. Thread a children list (name, url, views) from the datasource through the repository, UI state and ViewModel, and render referrer groups with children as expand/collapse rows in both the card and the detail screen, following the UTM card pattern. Tapping a child opens its URL in a Chrome Custom Tab. CMM-2133 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Remove the decorative right arrow from Most Viewed rows (shared by posts, referrers, clicks, search terms, video plays and file downloads) since it did not navigate anywhere. Move the expand/collapse dropdown arrow before the views count on referrer groups with children, and show a right arrow only on clickable URL child rows to signal they open a link. CMM-2133 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Expanded child rows sat flush against their parent row in the referrers and UTM cards and detail screens. Add a small top margin so children are visually separated when a group is expanded. CMM-2133 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
When a group had more than one child, the child rows were rendered flush against each other. Space them evenly in the referrers and UTM cards and detail screens. CMM-2133 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The referrers endpoint returns only 10 items when max is unset. Send an explicit max=0 (which the server treats as unlimited) so it returns the full referrer list, matching how Posts & Pages behaves: the card still shows the first CARD_MAX_ITEMS entries while the detail screen shows all of them. CMM-2133 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extract the duplicated chevron, child row and expandable-children block from MostViewedCard and MostViewedDetailActivity into a shared MostViewedCommonComposables file, reusing StatsListRowContainer for the child row bar. Inject ActivityNavigator into NewStatsActivity and thread the child-click callback down instead of constructing the navigator in a composable and casting the context to Activity. Compute maxChildViews only when a group is expanded, and document the referrers max=0 semantics. CMM-2133 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The detail screen renders rows in a LazyColumn, so the per-row expanded state held in a plain remember was discarded when a row scrolled off screen and reset to collapsed when it returned. Use rememberSaveable and key the list by item id so an expanded group stays expanded across scrolling. CMM-2133 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The referrers card fetched the full (max=0) list and passed it to the detail screen through the launching Intent, and the detail LazyColumn was keyed by item.id (derived from name.hashCode()). On sites with many referrers this risked a TransactionTooLargeException, and empty/duplicate referrer names could collide into duplicate keys and crash the list. Bound the card request to REFERRERS_CARD_MAX and add fetchReferrersDetail (max=0) so the detail screen self-fetches its own unbounded list via a new MostViewedDetailViewModel (Loading/Error/Loaded), passing only the period through the Intent. Key the detail list by index instead of item.id. CMM-2133 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
These cards fetched the full unbounded list (max=0) and passed the whole list to their detail Activity through the launching Intent, risking a TransactionTooLargeException on sites with many entries — the same issue already fixed for referrers. Generalize the referrers self-fetch: add MostViewedDetailSource and MostViewedDetailFetcher, turn MostViewedDetailViewModel into a generic load(source, period), and replace startReferrers with startSelfFetch so Clicks, Search Terms, Video Plays and File Downloads re-fetch their own full list when the detail screen opens. Add AuthorsDetailViewModel and make AuthorsDetailActivity self-fetch the same way (with loading/error states). Only the selected period crosses the Intent now. CMM-2133 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Generated by 🚫 Danger |
Contributor
|
|
Contributor
|
|
Base automatically changed from
feature/cmm-2133-stats-referrer-children
to
trunk
July 3, 2026 15:47
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.


Description
Stacked on top of #23066 (
feature/cmm-2133-stats-referrer-children) — please review/merge that one first.#23066 fixed the referrers detail screen so it self-fetches its full list instead of passing it through the launching Intent (which risked
TransactionTooLargeException). This PR applies the same fix to the other Stats cards that had the identical pattern: they fetch the full, unbounded list (max = 0) and hand the entire list to the detailActivityvia an Intent extra.Affected cards: Clicks, Search Terms, Video Plays, File Downloads (all share
MostViewedDetailActivity) and Authors (its ownAuthorsDetailActivity). Posts & Pages and Locations pass their list via the Intent too but are bounded (max = 10), so they are left as-is.Changes
MostViewedDetailSource+MostViewedDetailFetcher: given a source, it fetches the full (unbounded) list and maps it to the commonStatsCardFetchResultshape. The per-item mapping mirrors the corresponding card ViewModels.MostViewedDetailViewModel(added in CMM-2133: Expandable referrers with children in new Stats #23066 for referrers) fromloadReferrers(period)toload(source, period), so Referrers, Clicks, Search Terms, Video Plays and File Downloads all self-fetch through one path.MostViewedDetailActivity: replacedstartReferrers(period)withstartSelfFetch(cardType, source, period, valueHeaderResId); the four clicks-family "Show all" handlers now launch self-fetch instead of passing the full item list.AuthorsDetailViewModel(self-fetchesmax = 0, exposes Loading/Loaded/Error), andAuthorsDetailActivitynow self-fetches viastartSelfFetch(period)with a loading/error/retry state. Extracted the sharedTopAuthorItemData.toAuthorUiItem()mapper so the card and detail agree.getCurrentPeriod()toBaseStatsCardViewModelandAuthorsViewModelso "Show all" can pass the selected period.Notes
max = 0and display the first N). TheirgetDetailData()is now unused by production but retained (still unit-tested); it can be removed in a later cleanup.LazyColumnkey) does not apply here: the clicks-family detail ids are the list index, and Authors keys by index.Testing instructions
For each of Clicks, Search Terms, Video Plays, File Downloads, Authors: