Skip to content

WordPress.com Notifications in Android#3

Merged
roundhill merged 184 commits intomasterfrom
notifications
Jun 7, 2013
Merged

WordPress.com Notifications in Android#3
roundhill merged 184 commits intomasterfrom
notifications

Conversation

@beaucollins
Copy link
Copy Markdown
Contributor

Using the WordPress.com REST API to provide notifications to WordPress for Android.

Robert Collins and others added 30 commits April 11, 2013 13:41
- If the selected menu item is gone after a blog switch, select the first available menu item
  - For example the ReaderActivity and NotificationsActivity are only available for dotcom blogs
- Move activity restoration to WPActionBarActivity and re-use the MenuDrawerItem objects to correctly launch the necessary activity
 * Credentials are stored in Preferences and uses the existing
encryption methods for the password.
 * Incremented db version and added migration script that attempt to
migrate the WP.com credentials from the first matching WP.com blog.
 * Added basic GCM setup. App ID needs to be added to the
config.properties in res/raw as gcm.id
 * Added WordPress.com section to preferences, and added capability for
!AddAccountActivity to be used as a WordPress.com authenticator of
sorts.
Having this in WPActionBarActivity would cause any new activity to close itself if it wasn't a menu item activity.
…ge server side, the user is prompted to update their password. Also renamed a few of the account classes to make a bit more sense contextually.
- needs to be backed by a db to prevent dups
- needs to determine that there are no more notes available remotely and stop loading more
 * Added support for Async XML-RPC calls to the XMLRPCClient.
 * Created WPComXMLRPCApi tp manage WP.com specific calls
 * Added support for getting/setting notification settings.
 * Enhanced the notifications a bit with gravatars. These still need
more work, including hooking them up properly to the notifications
views.
Merging in android.git.wordpress.org master branch into notifications development branch
…ion to onRegistered() in GCMIntentService since it is an Async call. Also made call to check device registration after adding blogs from either first app run or when adding blogs from settings.
maxme pushed a commit that referenced this pull request Jul 25, 2014
@maxme maxme mentioned this pull request Jun 7, 2016
mufela added a commit to mufela/WordPress-Android that referenced this pull request Dec 5, 2016
kwonye added a commit that referenced this pull request Dec 20, 2018
AliSoftware added a commit to AliSoftware/WordPress-Android that referenced this pull request Aug 27, 2020
After fixing the strange failure on Pixel2-28-in for image wordpress-mobile#3
planarvoid pushed a commit that referenced this pull request Oct 12, 2020
mokagio pushed a commit that referenced this pull request Feb 13, 2026
…de-to-use-retrofit

Fix #3: Replace image upload code to use retrofit
@claude claude bot mentioned this pull request Feb 23, 2026
4 tasks
adalpari added a commit that referenced this pull request Feb 27, 2026
- Bug #1: Add error state with retry to detail Activities (blank screen on error)
- Bug #2: Cancel previous load job on tab switch to prevent race conditions
- Bug #3: Reset isLoadedSuccessfully in refresh() to allow data reload
- Bug #4: Add duplicate guard in addCard() to prevent duplicate cards
- Bug #9: Use resource string instead of raw e.message for error display
- Thread safety #7: Use AtomicBoolean for isInitialLoad in SubscribersTabViewModel
- Performance #11: Pre-compute formatted dates in ViewModel, memoize in card composable
- Update all tests to match new error handling and API signatures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
adalpari added a commit that referenced this pull request Mar 17, 2026
* Add All-time Subscribers stats card for new stats Subscribers tab

Introduces the shared infrastructure for the Subscribers tab including
the wordpress-rs dependency update, data layer (3 new API endpoints),
repository methods, card configuration with persistence, and the
All-time Subscribers card showing current, 30-day, 60-day, and 90-day
subscriber counts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add Subscribers Graph placeholder card for stats Subscribers tab

Adds an empty placeholder card for the Subscribers Graph that will be
populated with chart data in a future iteration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add Subscribers List card for stats Subscribers tab

Displays a list of subscribers with their subscription dates. Includes
a Show All CTA that opens a detail screen with the full subscriber list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add Emails card and wire Subscribers tab in new stats screen

Adds the Emails card showing latest emails with opens and clicks counts,
including a detail screen. Wires all 4 cards into the Subscribers tab
with the tab ViewModel, content composable, add-card bottom sheet,
and manifest registrations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add unit tests for Subscribers tab cards

Adds 5 test files covering the new Subscribers tab functionality:
- AllTimeSubscribersViewModelTest (12 tests)
- SubscribersListViewModelTest (13 tests)
- EmailsCardViewModelTest (13 tests)
- StatsRepositorySubscribersTest (12 tests)
- SubscribersCardsConfigurationRepositoryTest (14 tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add tests for SubscribersTabViewModel and SubscribersGraphViewModel

- SubscribersTabViewModelTest (21 tests): config loading, card
  management (add/remove/move), flow observation, network status
- SubscribersGraphViewModelTest (6 tests): placeholder state behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Improve All-time Subscribers card UI and fix API calls

- Redesign card with highlighted Current sub-card and 3 smaller
  sub-cards for 30/60/90 days ago
- Fix subscribers API: use DAY unit instead of MONTH
- Pass correct date parameter (today, -30d, -60d, -90d) for each call
- Hide period selector when Subscribers tab is selected
- Update tests for new date parameter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Improve Emails card alignment and formatting

- Center-align opens/clicks columns in headers and rows
- Add divider between column headers and items
- Show "-" instead of "0" for zero opens/clicks values
- Use lighter color for zero values to de-emphasize
- Add proper spacing between title and numeric columns
- Remove "Top N" truncation label from detail screen

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Implement Subscribers Graph card with line chart and period tabs

Replace the placeholder graph card with a Vico line chart showing
subscriber counts over time. Add segmented button tabs for switching
between Days (30d), Weeks (12w), Months (6m), and Years (3y) periods.
Data is sorted chronologically (older to newer).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add tests for Subscribers Graph and repository graph method

Add 10 new ViewModel tests covering tab switching params, chronological
sorting, empty data, auth errors, and edge cases. Add 4 repository tests
for fetchSubscribersGraph covering success, empty, error, and auth error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update wordpress-rs dependency and fix subscriber date formatting

Update wordpress-rs to b17d6e02dde5ea55773d527c1cb6ad2f889fc90e, handle
nullable dateSubscribed, format subscriber dates as relative time
(e.g. "30 days", "1 year, 45 days") instead of raw date strings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Address code review issues for Subscribers tab

- Extract BaseSubscribersCardViewModel to eliminate ViewModel duplication
- Replace hardcoded error strings with string resources
- Use Android plural resources for formatSubscriberDate localization
- Fix refresh() to call statsRepository.init() before fetching
- Use AtomicBoolean for thread-safe isLoading/isLoadedSuccessfully flags
- Lazy load detail items (fetch 5 for card, 100 on demand)
- Prevent cardsToLoad from re-triggering on every config change
- Extract shared formatEmailStat to StatsFormatter utility
- Add FormatSubscriberDateTest with 12 tests covering all branches
- Update existing ViewModel tests for base class refactor

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add pagination to Subscribers and Emails detail pages

Detail pages now fetch data via their own ViewModels with infinite scroll
instead of receiving all items through Intent extras. Subscribers uses
page-based pagination; Emails uses increasing quantity. Both use mutex-
guarded loading with scroll-to-end detection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix bugs, thread safety issues, and performance in Subscribers tab

- Bug #1: Add error state with retry to detail Activities (blank screen on error)
- Bug #2: Cancel previous load job on tab switch to prevent race conditions
- Bug #3: Reset isLoadedSuccessfully in refresh() to allow data reload
- Bug #4: Add duplicate guard in addCard() to prevent duplicate cards
- Bug #9: Use resource string instead of raw e.message for error display
- Thread safety #7: Use AtomicBoolean for isInitialLoad in SubscribersTabViewModel
- Performance #11: Pre-compute formatted dates in ViewModel, memoize in card composable
- Update all tests to match new error handling and API signatures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Address code review: fix critical bugs, races, and warnings

- Replace Resources with ContextProvider in SubscribersListDetailViewModel
  to avoid passing Activity resources into ViewModel (MVVM violation)
- Fix refresh() race condition by canceling loadJob in BaseSubscribersCardViewModel
- Add Mutex synchronization to SubscribersCardsConfigurationRepository
- Fix isValidConfiguration no-op (filterIsInstance on typed list)
- Expose PAGE_SIZE constants for test use instead of duplicating
- Replace SimpleDateFormat with DateTimeFormatter in StatsDataSourceImpl
- Log exceptions in fetchSubscribersGraph instead of swallowing silently
- Use Period.between() for leap-year-accurate date formatting
- Remove duplicate selectedTab from SubscribersGraphUiState.Loaded
- Auto-load newly added cards in SubscribersTabContent
- Add statsRepository.init() verification tests to all card ViewModels

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix detekt issues: refactor long methods, remove unused imports, add suppressions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix race condition, security alert, and add base ViewModel tests

- Add @synchronized to StatsDataSourceImpl.getOrCreateClient()
  to prevent race condition during parallel API calls
- Move date formatting from SubscribersListCard composable to
  SubscribersListViewModel to avoid stale resources capture
- Make saveConfiguration private in ConfigurationRepository
- Add comment documenting emails pagination API limitation
- Add BaseSubscribersCardViewModelTest with 12 tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix critical coroutine safety, unsafe casts, and pagination bugs

- Rethrow CancellationException in all catch blocks to preserve
  structured concurrency (BaseSubscribersCardViewModel, detail VMs,
  StatsRepository)
- Use safe cast in extractSubscriberCount to prevent runtime crash
- Add try-catch to fetchSubscribersList and fetchEmailsSummary
- Add mutex to getConfiguration() to fix TOCTOU race
- Fix refresh() bypassing isLoading guard
- Remove emails pagination (API limitation) and use static list
- Fix premature loadMore trigger by initializing canLoadMore to false
- Add !isLoading guard to shouldLoadMore derived state

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Simplify subscribers tab: extract shared composable, consolidate helpers

- Extract NoConnectionContent into shared composable used by both NewStatsActivity and SubscribersTabContent
- Consolidate 4 card movement methods in SubscribersCardsConfigurationRepository via moveCard() helper
- Consolidate 6 card action methods in SubscribersTabViewModel via cardAction() helper
- Extract CardActions data class in SubscribersTabContent to reduce callback repetition

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update wordpress-rs to 3a23a7389b and adapt SortOrder rename

- Update wordpress-rs library to commit 3a23a7389b3931e6241986a168b73a95d99151e0
- Adapt StatsEmailsSummarySortOrder -> WpApiParamOrder rename

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Updating worpdress-rs

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants