Conversation
|
This looks good, will test it out today. |
There was a problem hiding this comment.
This method is created twice. In order to prevent DRY how about you move it to one of the utility classes? Maybe DeviceUtils?
There was a problem hiding this comment.
Yeah, I also thought about that and looked through utility classes. None looked to fit.
DeviceUtils was the first choice, but it appears to be for wider range: Android vs BB vs Kindle...
If you think puting this to DeviceUtils is fine, then I can do it.
Please confirm.
There was a problem hiding this comment.
Yeah, I think it's the best place for it even though it is currently used for higher level stuff. Go ahead and put it there. Thanks for your hard work! I've tested it out on 2.2, 2.3 and 4.1 devices and it works fine.
|
Closing this one, will open new pull-request. |
|
Sorry, it is the first time I am doing a pull-request in GitHub :) |
|
Fixed as of 1e71461 |
c611f1e 1.9.0 version bump 28f8cd3 Merge pull request #4 from wordpress-mobile/sync-wpandroid db6e3fc Removed unused StringUtils.getLanguageString method 1857d7e Added ShortcodeUtils with methods for converting VideoPress ids to shortcodes and vice versa 920ea46 Merge develop into site-settings-review a731d83 1.8.0 version bump 73af369 Merge commit '355e34b84ad8c79589065dafb7cf19b619eb957c' into develop c21f969 Add utility methods to check if a URL is wpcom. Add utility methods that check if it's safe to add the Authentication token to the request. 821c32c kill StringUtils.getHost function bec2b0b s/getDomainFromUri/getHost/ 355e34b 1.7.0 version bump 261e48b Moved setupUrlConnection() to the utils library aa8a1d3 Merge branch 'develop' into feature/visual-editor 29087c9 4.9-rc-2 / 228 version bump 5f7cdf8 fix #3521: use the simplest UnderlineSpan subclass 5d281f1 Merge branch 'develop' into feature/site-settings-review ae44dd4 Allow photon to resize GIFs e4b151f Merge branch 'develop' into feature/visual-editor 151c4b5 Merge commit '7c21964c64da28781fbb63fa9ea22509d320bb0f' into develop 7c21964 remove old reference to a non existing screenshot 8c562ca Merge branch 'develop' into feature/site-settings-review d037515 Merge branch 'develop' into feature/visual-editor 0ea8c37 added @code blocks to comments 4c4594c fix #3372:Resource Leak in SqlUtils.java 736bd30 Changedcomment lines so JavaDoc generation doesnt complain 8ce1ae7 fixed conflicts 0ae36de Changed comments that caused errors when generating the JavaDoc ee9a14b Merge remote-tracking branch 'origin/master' into develop a25e017 added javadoc generation to build file 480fcb3 Moved the check for video to within ImageUtils 4171cfd Merge branch 'develop' into feature/visual-editor 0a7732e Merge branch 'develop' into feature/site-settings-review 19786e0 suppress lint on missing permission 8f5dba9 Updating gradle plugin to 1.5.0 and support/build tools to latest for sub projects d84f13a Add log line that could help us in case of errors in the JSON parsing with queryJSON. c600314 Merge branch 'develop' into feature/site-settings-review 7506241 Better solution: Fix the url within PhotonUtils. Hattip @nbradbury b7cf042 Revert "Fixes issue where private blog images wouldn't load." aaa16e5 Revert "Killing whitespace." e214408 Killing whitespace. bee8b4d Fixes issue where private blog images wouldn't load. 4750b89 Merge branch 'release/4.7' into feature/site-settings-review cf71309 Merge branch 'develop' into feature/visual-editor-sync 7eabf5a Moved permission check and request to PermissionUtils 6ac29ba Checking media permission when attempting to add media to post 826a711 Merge branch 'release/4.6' into issue/3115-runtime-permissions dab25aa first step for runtime location request 62266e2 Obey maximum image width (from blog settings) when uploading images from visual editor c1e2716 Merge branch 'develop' into feature/site-settings-review 5bc77ff Merge branch 'hotfix/4.5.2' into release/4.6 plus bump version for beta release 679e90e test queryJSON calls with null params f0da5e5 Check null query string 79839e0 check null source in JSONUtils.queryJSON() 6fcdac2 Merge branch 'develop' into feature/site-settings-review 15e8684 update ProfilingUtils usage 2411844 Merge branch 'develop' into feature/site-settings-review 43eac0e Add two new functions to Utils that remove the traling slash in a string, and remove the scheme from URL string. 8447eea Use homeURL instead of hostName to show the blog address. WordPress can be installed in a sub-directory, and so the host name will be the same for two subdir installations on the same host. b465a2e URL Utils test fix 53c3a16 Merge branch 'develop' into feature/site-settings-review 2c0b2d5 generic approach to add parameters to a URL 79b9497 new UrlUtils method: appendPreviewURLParameter e0237c1 Updating build tools to 23.0.1 24e47d5 Merge branch 'develop' into feature/site-settings-review 41a6352 set targetSdkVersion to 23 and clean up lib dependencies 1147f17 migrate from mavenCentral to jcenter (which is now the default for Android Studio) 1e21a88 fix lint errors 53d9465 update to gradle plugin 1.3.1 and gradle 2.6 a3b4ece upgrade to gradle 2.5 and gradle plugin 1.3.0 2ebe23b Merge branch 'develop' into feature/update-to-gradle-2.4 99d239b Merge branch 'develop' into feature/update-to-gradle-2.4 bc27690 Updating ActionBar title. Save button is now Undo. 8632009 Merge branch 'hotfix/4.1.1' into release/4.2 17c4c41 Merge pull request #2878 from wordpress-mobile/issue/2860-npe-post-settings-update 349ced2 Updating EditTextUtils.getText method instead of creating new one. 2ee9d3e limit text to 524288 characters which is always < 2Mb with UTF-8 324f061 Merge branch 'hotfix/4.1.1' into release/4.2 e6d8067 fix #2855: delete big comments and truncate new inserted comments 9720b45 Coding Styles 5426142 Make sure the context passed to checkConnection is not null b8ef02a Updated support library and build tools 1ec8f40 update to gradle android plugin 1.2.3 00c8e7d update support lib to 22 4f3c8ee update to android-gradle plugin 1.1.3 and build tools 22.0.1 b00745e Introduce our version of MarkView 090e027 bump version number to 1.6.0 bbed10b Fixed notifications fragment for self-hosted 12646dc Merge branch 'release/4.0' into develop f782492 Removing potential race condition with WP image loading threads. 9fd8ee1 Returning to the post editor won't crash if Activity was destroyed. b259e6c Add more audio formats 79c326c Handle audio files in media browser 7614498 Merge branch 'release/4.0' into develop e7656bd Merge branch 'hotfix/3.9.1' into release/4.0 4347d57 Catching other unknown URL exception. 5864710 Making sure Cursor is closed if exception gets thrown. 003f846 Catching unknown URL exceptions. 4ddfb8b javadocs bbfb8e3 If string is empty return empty string instead of null ca69d4e Merge branch 'develop' of https://github.com/wordpress-mobile/WordPress-Android into feature/viewpager-main-activity d692f39 javadocs eb06e80 Merge branch 'develop' of https://github.com/wordpress-mobile/WordPress-Android into feature/viewpager-main-activity f917e18 If string is empty return empty string instead of null 5851c3d Updated ViewSiteActivity and WebViewActivity to use support toolbar w/o drawer 6c7c91c 1.5.0 version bump 37f1009 Merge branch 'develop' into feature/modularize-editor 2879710 Added support for `WPWebViewClient` to pass the token for image requests. 7d96a03 Merge branch 'hotfix/3.8.1' into release/3.9 88e501b fix #2437: clear uploading posts state if the PostUploadService is not running during PostList creation b3a848e Merge branch 'develop' into feature/modularize-editor 8373246 fix #2328: sort blogs with an empty title by their hostname 53329df Merge branch '1628-mediapicker' into feature/modularize-editor 61abebc Merge branch 'develop' of github.com:wordpress-mobile/WordPress-Android into feature/modularize-editor f132045 comment CustomSwipeRefreshLayout.onTouchEvent f34c956 new CustomSwipeRefreshLayout with a workaround to catch onTouchEvent IllegalArgumentException a2c4b16 Merge branch 'develop' into feature/modularize-editor 3f8bedb Merge pull request #2365 from wordpress-mobile/issue/1827-post-stuck-in-uploading-state e3f237e Merge branch 'develop' into feature/modularize-editor 36a3c9d fix typo in a comment adb0889 delay the refreshing anim by 50ms to workaround https://code.google.com/p/android/issues/detail?id=77712 c8374fe styling update 153aa40 Merge branch 'release/3.7' into develop 0f47623 Merge branch 'develop' into feature/modularize-editor 9aa990c fix #2336: check for null text entry, replace them with a string f25f93e split MediaUtils in MediaUtils and WordPressMediaUtils - remove references to WordPress.java in MediaUtils 3bde544 move WPUnderlineSpan.java and MediaGalleryImageSpan.java to WPUtils 8015176 Merge branch 'develop' into feature/modularize-editor 34aab4c Merge branch 'develop' of https://github.com/wordpress-mobile/WordPress-Android into issue/2306-reader-feed-preview 9046278 All gravatar requests now default to 404. 5a0da37 Added DEFAULT_BLAVATAR constant 8436629 WPNetworkImageView now accepts a default error image resource, also forcing size when showing blavatars in ReaderBlogAdapter 06e9f21 Moved fixAvatar routine to GravatarUtils d132f67 Added DefaultImage enum to GravatarUtils d7d1b96 move WPImageSpan and MediaFile to WPUtils - also create a WPEditImageSpan class 01379c8 Removed blogUrl param from showBlogPreview(), added new routines for following/unfollowing blogs & feeds 4a532c0 remove extraneous static field 3fa0af6 Merge branch 'develop' into feature/modularize-editor 71fec7a move WPEditText to WordPressUtils and reorganize WordPressUtils 9657f22 First step at extracting the old editor (moving Media related method to the EditPostActivity, they should end up in their own class/lib) 9c1c94c Blavatar defaults to 404 8b1a9a9 Added blavatars to ManageBlogsActivity e9aa0ff Merge branch 'develop' of github.com:wordpress-mobile/WordPress-Android into develop 9aef78d Merge branch 'release/3.7' into develop 9b74d4e comment addUrlSchemeIfNeeded and why removeLeadingDoubleSlash is used there 93ddd8b Add strip=all to all Photon requests 02c361f fix #2293: remove leading double slash in URLs returned by wporg servers git-subtree-dir: libs/utils git-subtree-split: c611f1e
- 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>
* 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>
Successfully tested with with API level 8 (virtual device, see the screenshot) and API level 17 (Nexus 7).
Please ignore white space changes, my editor has automatically removed them....