Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
10be172
Move UiHelpers.kt and WPSwitch.kt to `:libs:core-ui`
jkmassel Apr 2, 2026
9035f6d
Extract `:libs:core-ui` module from `:WordPress`
jkmassel Apr 2, 2026
cc084fc
Move canonical string ownership to `:libs:core-ui`
jkmassel Apr 2, 2026
f0c2e75
Move color palette to `:libs:core-ui`
jkmassel Apr 2, 2026
6a74bd3
Extract `:libs:utils` module with 81 pure utility files
jkmassel Apr 2, 2026
a4aad4d
Move unit tests for extracted utils to `:libs:utils`
jkmassel Apr 2, 2026
aae1bf3
Extract `:libs:core-test` module with shared test infrastructure
jkmassel Apr 2, 2026
07ee35c
Move WizardManagerTest to `:libs:utils`
jkmassel Apr 2, 2026
6bcf7f6
Convert AutolinkUtilsTest to JVM unit test in `:libs:utils`
jkmassel Apr 2, 2026
2fcb947
Remove unnecessary Hilt annotations from UrlUtilsTest and WPUrlUtilsTest
jkmassel Apr 2, 2026
a5a14a5
Move 13 self-contained widget classes to `:libs:core-ui`
jkmassel Apr 2, 2026
6540047
Move DateProvider and SiteAccessibilityInfo to `:libs:utils`
jkmassel Apr 2, 2026
001a932
Move Organization enum to `:libs:core-ui`
jkmassel Apr 2, 2026
dd0a528
Extract `:libs:reader-models` module from `:WordPress`
jkmassel Apr 2, 2026
6a21e83
Extract `:libs:reader` module with 19 clean Reader source files
jkmassel Apr 2, 2026
d8bf70c
Move 9 more UI state and adapter files to `:libs:reader`
jkmassel Apr 2, 2026
43b049d
Extract ReaderTracker interface to `:libs:reader`
jkmassel Apr 2, 2026
1964c48
Move 8 more use cases and view models to `:libs:reader`
jkmassel Apr 2, 2026
0d5a326
Move SnackbarMessageHolder to core-ui, add NetworkAvailability interface
jkmassel Apr 2, 2026
a700212
Move 260 reader string resources to `:libs:reader`
jkmassel Apr 2, 2026
024eff9
Move reader color resources to `:libs:reader`
jkmassel Apr 2, 2026
d6a7674
Move reader dimension resources to `:libs:reader`
jkmassel Apr 2, 2026
f2d77be
Extract ReaderPostCardActionType and ReaderInterfaces to `:libs:reader`
jkmassel Apr 2, 2026
0eb5b2c
Add ReaderPreferences interface to decouple reader from AppPrefsWrapper
jkmassel Apr 2, 2026
68d4ddd
Move 5 more files to `:libs:reader`
jkmassel Apr 2, 2026
73d319e
Fix lint, detekt, and checkstyle issues from reader modularization
jkmassel Apr 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ dependencies {
}
}
implementation project(":libs:posttypes")
implementation project(":libs:core-ui")
implementation project(":libs:utils")
implementation project(":libs:reader-models")
implementation project(":libs:reader")
implementation("$gradle.ext.aboutAutomatticBinaryPath:${libs.versions.automattic.about.get()}")

implementation("$gradle.ext.gutenbergKitBinaryPath:${libs.versions.gutenberg.kit.get()}")
Expand Down Expand Up @@ -452,6 +456,7 @@ dependencies {

implementation(libs.wordpress.rs.android)

testImplementation project(":libs:core-test")
testImplementation(libs.androidx.arch.core.testing) {
exclude group: 'com.android.support', module: 'support-compat'
exclude group: 'com.android.support', module: 'support-annotations'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

import org.junit.Test;

import dagger.hilt.android.testing.HiltAndroidTest;

import static junit.framework.TestCase.assertEquals;

@HiltAndroidTest
public class UrlUtilsTest {
@Test
public void testGetHost1() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
import java.net.URISyntaxException;
import java.net.URL;

import dagger.hilt.android.testing.HiltAndroidTest;

import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertTrue;

@HiltAndroidTest
public class WPUrlUtilsTest {
private static final String WPCOM_ADDRESS_1 = "http://wordpress.com/xmlrpc.php";
private static final String WPCOM_ADDRESS_2 = "http://wordpress.com#.b.com/test";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ class AppInitializer @Inject constructor(

WordPress.versionName = PackageUtils.getVersionName(application)
initWpDb()
ReaderDatabase.init(application)
context?.let { enableHttpResponseCache(it) }

AppReviewManager.init(application)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
import kotlinx.coroutines.CoroutineScope;
import rs.wordpress.api.kotlin.WpLoginClient;

import static org.wordpress.android.modules.ThreadModuleKt.APPLICATION_SCOPE;
import static org.wordpress.android.modules.CoroutineDispatchersKt.APPLICATION_SCOPE;

@InstallIn(SingletonComponent.class)
@Module(includes = AndroidInjectionModule.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.wordpress.android.modules

import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import org.wordpress.android.ui.prefs.AppPrefsWrapper
import org.wordpress.android.ui.reader.preferences.ReaderPreferences
import org.wordpress.android.ui.reader.tracker.ReaderTracker
import org.wordpress.android.ui.reader.tracker.ReaderTrackerImpl
import org.wordpress.android.util.NetworkAvailability
import org.wordpress.android.util.NetworkUtilsWrapper

@InstallIn(SingletonComponent::class)
@Module
interface ReaderModule {
@Binds
fun bindReaderTracker(impl: ReaderTrackerImpl): ReaderTracker

@Binds
fun bindNetworkAvailability(
impl: NetworkUtilsWrapper
): NetworkAvailability

@Binds
fun bindReaderPreferences(
impl: AppPrefsWrapper
): ReaderPreferences
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ import kotlinx.coroutines.Dispatchers
import org.wordpress.android.util.helpers.Debouncer
import javax.inject.Named

const val APPLICATION_SCOPE = "APPLICATION_SCOPE"

const val UI_THREAD = "UI_THREAD"
const val BG_THREAD = "BG_THREAD"
const val IO_THREAD = "IO_THREAD"

@InstallIn(SingletonComponent::class)
@Module
class ThreadModule {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.wordpress.android.reader.savedposts.resolver

import org.wordpress.android.R
import org.wordpress.android.reader.R as ReaderR
import org.wordpress.android.datasets.wrappers.ReaderDatabaseWrapper
import org.wordpress.android.datasets.wrappers.ReaderPostTableWrapper
import org.wordpress.android.datasets.wrappers.ReaderTagTableWrapper
Expand Down Expand Up @@ -48,8 +48,8 @@ class ReaderSavedPostsHelper @Inject constructor(
readerTagTableWrapper.addOrUpdateTag(
ReaderTag(
"",
contextProvider.getContext().getString(R.string.reader_save_for_later_display_name),
contextProvider.getContext().getString(R.string.reader_save_for_later_title),
contextProvider.getContext().getString(ReaderR.string.reader_save_for_later_display_name),
contextProvider.getContext().getString(ReaderR.string.reader_save_for_later_title),
"",
BOOKMARKED
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ class BloggingPromptsOnboardingDialogFragment : FeatureIntroductionDialogFragmen
textRes = holder.message,
duration = Snackbar.LENGTH_LONG
),
holder.buttonTitle?.let {
holder.buttonTitle?.let { buttonTitle ->
Action(
textRes = holder.buttonTitle,
textRes = buttonTitle,
clickListener = { holder.buttonAction() }
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ class UnifiedCommentListFragment : Fragment(R.layout.unified_comment_list_fragme
textRes = snackbarMessage.message,
duration = Snackbar.LENGTH_LONG
),
snackbarMessage.buttonTitle?.let {
snackbarMessage.buttonTitle?.let { buttonTitle ->
Action(
textRes = snackbarMessage.buttonTitle,
textRes = buttonTitle,
clickListener = { snackbarMessage.buttonAction() }
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ class UnifiedCommentsEditFragment : Fragment(R.layout.unified_comments_edit_frag
textRes = holder.message,
duration = Snackbar.LENGTH_LONG
),
holder.buttonTitle?.let {
holder.buttonTitle?.let { buttonTitle ->
Action(
textRes = holder.buttonTitle,
textRes = buttonTitle,
clickListener = { holder.buttonAction() }
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ class EngagedPeopleListFragment : Fragment() {
textRes = holder.message,
duration = Snackbar.LENGTH_LONG
),
holder.buttonTitle?.let {
holder.buttonTitle?.let { buttonTitle ->
Action(
textRes = holder.buttonTitle,
textRes = buttonTitle,
clickListener = { holder.buttonAction() }
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,12 @@ class BackupDownloadFragment : Fragment(R.layout.jetpack_backup_restore_fragment
uiHelpers.getTextOfUiString(requireContext(), this.message),
Snackbar.LENGTH_LONG
)
if (this.buttonTitle != null) {
val buttonTitle = this.buttonTitle
if (buttonTitle != null) {
snackbar.setAction(
uiHelpers.getTextOfUiString(
requireContext(),
this.buttonTitle
buttonTitle
)
) {
this.buttonAction.invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ class RestoreFragment : Fragment(R.layout.jetpack_backup_restore_fragment) {
uiHelpers.getTextOfUiString(requireContext(), this.message),
Snackbar.LENGTH_LONG
)
if (this.buttonTitle != null) {
val buttonTitle = this.buttonTitle
if (buttonTitle != null) {
snackbar.setAction(
uiHelpers.getTextOfUiString(
requireContext(),
this.buttonTitle
buttonTitle
)
) {
this.buttonAction.invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

import kotlinx.coroutines.CoroutineScope;

import static org.wordpress.android.modules.ThreadModuleKt.APPLICATION_SCOPE;
import static org.wordpress.android.modules.CoroutineDispatchersKt.APPLICATION_SCOPE;

/**
* An adapter for the media gallery grid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,9 @@ class MediaPickerFragment : Fragment(), MenuProvider {
textRes = holder.message,
duration = Snackbar.LENGTH_LONG
),
holder.buttonTitle?.let {
holder.buttonTitle?.let { buttonTitle ->
Action(
textRes = holder.buttonTitle,
textRes = buttonTitle,
clickListener = { holder.buttonAction() }
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.wordpress.android.ui.layoutpicker.LayoutPickerViewModel.DesignPreview
import org.wordpress.android.ui.layoutpicker.LayoutPickerViewModel.DesignPreviewAction.Show
import org.wordpress.android.ui.mlp.BlockLayoutPreviewFragment.Companion.BLOCK_LAYOUT_PREVIEW_TAG
import org.wordpress.android.ui.utils.UiHelpers
import org.wordpress.android.ui.utils.fadeInfadeOutViews
import org.wordpress.android.util.DisplayUtils
import org.wordpress.android.util.extensions.setVisible
import org.wordpress.android.viewmodel.mlp.ModalLayoutPickerViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,9 @@ class MySiteFragment : Fragment(R.layout.my_site_fragment),
duration = holder.duration,
isImportant = holder.isImportant
),
action = holder.buttonTitle?.let {
action = holder.buttonTitle?.let { buttonTitle ->
SnackbarItem.Action(
textRes = holder.buttonTitle,
textRes = buttonTitle,
clickListener = { holder.buttonAction() }
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ class MenuActivity : BaseAppCompatActivity() {
duration = holder.duration,
isImportant = holder.isImportant
),
action = holder.buttonTitle?.let {
action = holder.buttonTitle?.let { buttonTitle ->
SnackbarItem.Action(
textRes = holder.buttonTitle,
textRes = buttonTitle,
clickListener = { holder.buttonAction() }
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,8 @@ class PagesFragment : Fragment(R.layout.pages_fragment), ScrollableViewInitializ
) {
val parent = activity.findViewById<View>(R.id.coordinatorLayout)
if (holder != null && parent != null) {
if (holder.buttonTitle == null) {
val buttonTitle = holder.buttonTitle
if (buttonTitle == null) {
WPSnackbar.make(
parent,
uiHelpers.getTextOfUiString(requireContext(), holder.message),
Expand All @@ -463,7 +464,7 @@ class PagesFragment : Fragment(R.layout.pages_fragment), ScrollableViewInitializ
snackbar.setAction(
uiHelpers.getTextOfUiString(
requireContext(),
holder.buttonTitle
buttonTitle
)
) {
holder.buttonAction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import org.wordpress.android.R
import org.wordpress.android.reader.R as ReaderR
import org.wordpress.android.WordPress
import org.wordpress.android.fluxc.model.SiteModel
import org.wordpress.android.ui.ActionableEmptyView
Expand Down Expand Up @@ -122,7 +123,7 @@ class PostListFragment : ViewPagerFragment() {
postListViewModelConnector,
mainViewModel.authorSelectionUpdated.value!!,
photonWidth = displayWidth - contentSpacing * 2,
photonHeight = nonNullActivity.resources.getDimensionPixelSize(R.dimen.reader_featured_image_height)
photonHeight = nonNullActivity.resources.getDimensionPixelSize(ReaderR.dimen.reader_featured_image_height)
)

initObservers()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,9 @@ class PostsListActivity : BaseAppCompatActivity(),
textRes = holder.message,
duration = Snackbar.LENGTH_LONG
),
holder.buttonTitle?.let {
holder.buttonTitle?.let { buttonTitle ->
SnackbarItem.Action(
textRes = holder.buttonTitle,
textRes = buttonTitle,
clickListener = { holder.buttonAction() }
)
},
Expand Down
Loading
Loading