Skip to content

Commit 3c1b0d6

Browse files
authored
Merge branch 'trunk' into cmm-2174-background-anr
2 parents c88a98e + c068b42 commit 3c1b0d6

11 files changed

Lines changed: 322 additions & 155 deletions

File tree

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ gem 'fastlane', '~> 2.238'
99

1010
gem 'fastlane-plugin-firebase_app_distribution', '~> 1.0'
1111
gem 'fastlane-plugin-sentry'
12-
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 14.11.3'
12+
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 15.0.0'
1313
# gem 'fastlane-plugin-wpmreleasetoolkit', path: '../../release-toolkit'
1414
# gem 'fastlane-plugin-wpmreleasetoolkit', git: 'https://github.com/wordpress-mobile/release-toolkit', branch: ''
1515

Gemfile.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ GEM
99
ast (2.4.3)
1010
atomos (0.1.3)
1111
aws-eventstream (1.4.0)
12-
aws-partitions (1.1281.0)
12+
aws-partitions (1.1283.0)
1313
aws-sdk-core (3.254.1)
1414
aws-eventstream (~> 1, >= 1.3.0)
1515
aws-partitions (~> 1, >= 1.992.0)
@@ -74,12 +74,12 @@ GEM
7474
diffy (3.4.4)
7575
digest-crc (0.7.0)
7676
rake (>= 12.0.0, < 14.0.0)
77-
domain_name (0.6.20240107)
77+
domain_name (0.6.20260902)
7878
dotenv (2.8.1)
7979
emoji_regex (3.2.3)
8080
erb (6.0.7)
8181
erubi (1.13.1)
82-
excon (1.7.0)
82+
excon (1.7.1)
8383
logger
8484
faraday (2.14.3)
8585
faraday-net_http (>= 2.0, < 3.5)
@@ -159,7 +159,7 @@ GEM
159159
google-apis-firebaseappdistribution_v1alpha (>= 0.12.0)
160160
fastlane-plugin-sentry (1.29.0)
161161
os (~> 1.1, >= 1.1.4)
162-
fastlane-plugin-wpmreleasetoolkit (14.11.3)
162+
fastlane-plugin-wpmreleasetoolkit (15.0.0)
163163
buildkit (~> 1.5)
164164
chroma (= 0.2.0)
165165
diffy (~> 3.3)
@@ -190,7 +190,7 @@ GEM
190190
git (1.19.1)
191191
addressable (~> 2.8)
192192
rchardet (~> 1.8)
193-
google-apis-androidpublisher_v3 (0.106.0)
193+
google-apis-androidpublisher_v3 (0.107.0)
194194
google-apis-core (>= 0.15.0, < 2.a)
195195
google-apis-core (1.2.5)
196196
addressable (~> 2.9)
@@ -228,7 +228,7 @@ GEM
228228
googleauth (~> 1.9)
229229
mini_mime (~> 1.0)
230230
google-logging-utils (0.2.0)
231-
googleauth (1.17.3)
231+
googleauth (1.17.4)
232232
faraday (>= 1.0, < 3.a)
233233
google-cloud-env (~> 2.2)
234234
google-logging-utils (~> 0.1)
@@ -306,7 +306,7 @@ GEM
306306
rake (13.4.2)
307307
rake-compiler (1.3.1)
308308
rake
309-
rbs (4.1.3)
309+
rbs (4.2.0)
310310
logger
311311
prism (>= 1.6.0)
312312
tsort
@@ -325,7 +325,7 @@ GEM
325325
uber (< 0.2.0)
326326
retriable (4.2.0)
327327
rexml (3.4.4)
328-
rmagick (7.1.1)
328+
rmagick (7.1.3)
329329
observer (~> 0.1)
330330
pkg-config (~> 1.4)
331331
rouge (3.28.0)
@@ -395,7 +395,7 @@ DEPENDENCIES
395395
fastlane (~> 2.238)
396396
fastlane-plugin-firebase_app_distribution (~> 1.0)
397397
fastlane-plugin-sentry
398-
fastlane-plugin-wpmreleasetoolkit (~> 14.11.3)
398+
fastlane-plugin-wpmreleasetoolkit (~> 15.0.0)
399399
rmagick (~> 7.1)
400400

401401
BUNDLED WITH

WordPress/src/main/java/org/wordpress/android/ui/mediapicker/loader/MediaLoader.kt

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ data class MediaLoader(
3636
}
3737

3838
if (currentAction !is NextPage) {
39-
state = updateState(state.copy(isLoading = true, emptyState = null))
39+
// Apply the new filter together with the loading state. Otherwise the first search
40+
// enters the loading state still carrying the previous (empty) filter, which makes
41+
// the picker hide the loading spinner instead of showing it (see CMM-2382).
42+
val loadingState = state.applyFilterFor(currentAction)
43+
state = updateState(loadingState.copy(isLoading = true, emptyState = null))
4044
}
4145
val updatedState = loadState(currentAction, state)
4246
if (state != updatedState) {
@@ -56,10 +60,8 @@ data class MediaLoader(
5660
return when (loadAction) {
5761
is Start -> {
5862
if (state.domainItems.isEmpty()) {
59-
buildDomainModel(
60-
mediaSource.load(filter = loadAction.filter),
61-
state.copy(filter = loadAction.filter)
62-
)
63+
val filteredState = state.applyFilterFor(loadAction)
64+
buildDomainModel(mediaSource.load(filter = filteredState.filter), filteredState)
6365
} else {
6466
state
6567
}
@@ -81,19 +83,30 @@ data class MediaLoader(
8183
buildDomainModel(load, state)
8284
}
8385
is Filter -> {
84-
val load = mediaSource.load(filter = loadAction.filter)
85-
buildDomainModel(load, state.copy(filter = loadAction.filter))
86+
val filteredState = state.applyFilterFor(loadAction)
87+
buildDomainModel(mediaSource.load(filter = filteredState.filter), filteredState)
8688
}
8789
is ClearFilter -> {
88-
val load = mediaSource.load(filter = null)
89-
buildDomainModel(load, state.copy(filter = null))
90+
val filteredState = state.applyFilterFor(loadAction)
91+
buildDomainModel(mediaSource.load(filter = filteredState.filter), filteredState)
9092
}
9193
is Retry -> {
9294
buildDomainModel(mediaSource.load(filter = state.filter), state)
9395
}
9496
}
9597
}
9698

99+
// Single source of truth for the filter an action implies, so the loading state and the loaded
100+
// state stay in sync. Any action carrying a filter must be handled here (see CMM-2382).
101+
private fun DomainModel.applyFilterFor(loadAction: LoadAction): DomainModel {
102+
return when (loadAction) {
103+
is Start -> copy(filter = loadAction.filter)
104+
is Filter -> copy(filter = loadAction.filter)
105+
is ClearFilter -> copy(filter = null)
106+
else -> this
107+
}
108+
}
109+
97110
private suspend fun FlowCollector<DomainModel>.updateState(
98111
updatedState: DomainModel
99112
): DomainModel {

WordPress/src/main/java/org/wordpress/android/ui/posts/prepublishing/home/compose/PrepublishingHomeSocialNoConnectionsItem.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ fun PrepublishingHomeSocialNoConnectionsItem(
4141
Column(
4242
modifier = Modifier
4343
.background(backgroundColor)
44-
.then(modifier),
44+
.then(modifier)
45+
.padding(Margin.ExtraLarge.value),
4546
) {
4647
TrainOfIcons(
4748
iconModels = connectionIconModels,

WordPress/src/main/java/org/wordpress/android/ui/posts/social/compose/PostSocialSharingItem.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ fun PostSocialSharingItem(
4141
iconCount = model.iconModels.size,
4242
modifier = Modifier
4343
.background(backgroundColor)
44-
.then(modifier),
44+
.then(modifier)
45+
.padding(Margin.ExtraLarge.value),
4546
) { textColumnModifier ->
4647
Column(modifier = textColumnModifier) {
4748
Text(

WordPress/src/main/java/org/wordpress/android/ui/postsrs/terms/TermSelectionActivity.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ class TermSelectionActivity : BaseAppCompatActivity() {
5353
viewModel::onTermToggled,
5454
onSearchQueryChanged =
5555
viewModel::onSearchQueryChanged,
56-
onLoadMore =
57-
viewModel::onLoadMore,
5856
onAddTermClicked =
5957
viewModel::onAddTermClicked,
6058
onAddDialogDismissed =

WordPress/src/main/java/org/wordpress/android/ui/postsrs/terms/TermSelectionModels.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ data class SelectableTerm(
1010
data class TermSelectionUiState(
1111
val isLoading: Boolean = true,
1212
val isSearching: Boolean = false,
13-
val isLoadingMore: Boolean = false,
14-
val canLoadMore: Boolean = false,
1513
val error: String? = null,
1614
val terms: List<SelectableTerm> = emptyList(),
1715
val searchQuery: String = "",

WordPress/src/main/java/org/wordpress/android/ui/postsrs/terms/TermSelectionScreen.kt

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Box
66
import androidx.compose.foundation.layout.Column
77
import androidx.compose.foundation.layout.Row
88
import androidx.compose.foundation.layout.fillMaxSize
9-
import androidx.compose.foundation.layout.size
109
import androidx.compose.foundation.layout.fillMaxWidth
1110
import androidx.compose.foundation.layout.padding
1211
import androidx.compose.foundation.lazy.LazyColumn
@@ -57,7 +56,6 @@ fun TermSelectionScreen(
5756
onSaveClicked: () -> Unit,
5857
onTermToggled: (Long) -> Unit,
5958
onSearchQueryChanged: (String) -> Unit,
60-
onLoadMore: () -> Unit,
6159
onAddTermClicked: () -> Unit,
6260
onAddDialogDismissed: () -> Unit,
6361
onAddTermConfirmed: (String, Long?) -> Unit,
@@ -141,13 +139,9 @@ fun TermSelectionScreen(
141139
terms = uiState.terms,
142140
searchQuery = uiState.searchQuery,
143141
isSearching = uiState.isSearching,
144-
canLoadMore = uiState.canLoadMore,
145-
isLoadingMore =
146-
uiState.isLoadingMore,
147142
onSearchQueryChanged =
148143
onSearchQueryChanged,
149144
onTermToggled = onTermToggled,
150-
onLoadMore = onLoadMore,
151145
)
152146
}
153147
}
@@ -194,11 +188,8 @@ private fun TermListContent(
194188
terms: List<SelectableTerm>,
195189
searchQuery: String,
196190
isSearching: Boolean,
197-
canLoadMore: Boolean,
198-
isLoadingMore: Boolean,
199191
onSearchQueryChanged: (String) -> Unit,
200192
onTermToggled: (Long) -> Unit,
201-
onLoadMore: () -> Unit,
202193
) {
203194
Column(modifier = Modifier.fillMaxSize()) {
204195
OutlinedTextField(
@@ -268,52 +259,11 @@ private fun TermListContent(
268259
}
269260
)
270261
}
271-
if (canLoadMore) {
272-
item(key = "load_more") {
273-
LoadMoreItem(
274-
isLoading =
275-
isLoadingMore,
276-
onLoadMore = onLoadMore,
277-
)
278-
}
279-
}
280262
}
281263
}
282264
}
283265
}
284266

285-
@Composable
286-
private fun LoadMoreItem(
287-
isLoading: Boolean,
288-
onLoadMore: () -> Unit,
289-
) {
290-
Box(
291-
modifier = Modifier
292-
.fillMaxWidth()
293-
.clickable(
294-
enabled = !isLoading,
295-
onClick = onLoadMore
296-
)
297-
.padding(16.dp),
298-
contentAlignment = Alignment.Center,
299-
) {
300-
if (isLoading) {
301-
CircularProgressIndicator(
302-
modifier = Modifier.size(24.dp),
303-
strokeWidth = 2.dp,
304-
)
305-
} else {
306-
Text(
307-
text = stringResource(
308-
R.string.post_rs_settings_load_more
309-
),
310-
style = MaterialTheme.typography.bodyMedium,
311-
color = MaterialTheme.colorScheme.primary,
312-
)
313-
}
314-
}
315-
}
316-
317267
@Composable
318268
private fun TermRow(
319269
term: SelectableTerm,

0 commit comments

Comments
 (0)