Skip to content

Commit 2e4fee0

Browse files
committed
Merge remote-tracking branch 'origin/trunk' into merge/24.3-final-to-trunk
2 parents 5efed33 + 4dfebc9 commit 2e4fee0

File tree

182 files changed

+4901
-2302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+4901
-2302
lines changed

RELEASE-NOTES.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
24.4
44
-----
5-
5+
[***] [Jetpack-only] Stats: Introducing Traffic tab, delivering improved graphs, and combining Days/Weeks/Months/Years tabs into one, behind a feature flag. [https://github.com/wordpress-mobile/WordPress-Android/pull/19942]
6+
[***] [Jetpack-only] Improved Notifications experience with richer UI elements and interactions [https://github.com/wordpress-mobile/WordPress-Android/pull/20072]
7+
* [**] [Jetpack-only] Block editor: Introduce VideoPress v5 support, to fix issues using video block with dotcom and Jetpack sites [https://github.com/wordpress-mobile/gutenberg-mobile/pull/6634]
8+
* [*] Block editor: Prevent crash when autoscrolling to blocks [https://github.com/WordPress/gutenberg/pull/59110]
9+
* [*] Block editor: Remove opacity change when images are being uploaded [https://github.com/WordPress/gutenberg/pull/59264]
10+
* [*] Block editor: Media & Text blocks correctly show an error message when the attached video upload fails [https://github.com/WordPress/gutenberg/pull/59288]
611

712
24.3
813
-----

WordPress/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,12 +640,16 @@ tasks.register("dependencyTreeDiffCommentToGitHub", ViolationCommentsToGitHubTas
640640
commentOnlyChangedFiles = false
641641
minSeverity = SEVERITY.INFO
642642
commentTemplate = """
643-
### The PR caused the following dependency changes:
643+
<details><summary>The PR caused some dependency changes (expand to see details)</summary>
644+
<p>
644645
645646
```diff
646647
{{{violation.message}}}
647648
```
648649
650+
</p>
651+
</details>
652+
649653
*Please review and act accordingly*
650654
"""
651655
violations = [

WordPress/src/androidTest/java/org/wordpress/android/e2e/StatsTests.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import dagger.hilt.android.testing.HiltAndroidTest
66
import org.junit.After
77
import org.junit.Assume.assumeTrue
88
import org.junit.Before
9-
import org.junit.Ignore
109
import org.junit.Test
1110
import org.wordpress.android.BuildConfig
1211
import org.wordpress.android.R
@@ -22,9 +21,7 @@ import org.wordpress.android.util.StatsVisitsData
2221
class StatsTests : BaseTest() {
2322
@Before
2423
fun setUp() {
25-
// We're not running Stats tests for JP.
26-
// See https://github.com/wordpress-mobile/WordPress-Android/issues/18065
27-
assumeTrue(!BuildConfig.IS_JETPACK_APP)
24+
assumeTrue(BuildConfig.IS_JETPACK_APP)
2825
ComposeEspressoLink().unregister()
2926
logoutIfNecessary()
3027
wpLogin()
@@ -38,8 +35,7 @@ class StatsTests : BaseTest() {
3835
Espresso.pressBack()
3936
}
4037
}
41-
42-
@Ignore("Will be taken care of in a future PR - scrollToPosts is not working")
38+
4339
@Test
4440
fun e2eAllDayStatsLoad() {
4541
val todayVisits = StatsVisitsData("97", "28", "14", "11")

WordPress/src/androidTest/java/org/wordpress/android/e2e/pages/MySitesPage.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class MySitesPage {
149149
val statsButton = Espresso.onView(
150150
Matchers.allOf(
151151
ViewMatchers.withText(R.string.stats),
152-
ViewMatchers.withId(R.id.my_site_item_primary_text)
152+
ViewMatchers.withId(R.id.quick_link_item)
153153
)
154154
)
155155
WPSupportUtils.clickOn(statsButton)
@@ -158,7 +158,7 @@ class MySitesPage {
158158
WPSupportUtils.waitForElementToBeDisplayedWithoutFailure(R.id.tabLayout)
159159

160160
// Wait for the stats to load
161-
WPSupportUtils.idleFor(8000)
161+
WPSupportUtils.idleFor(4000)
162162
return StatsPage()
163163
}
164164

WordPress/src/androidTest/java/org/wordpress/android/e2e/pages/StatsPage.kt

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package org.wordpress.android.e2e.pages
22

3+
import androidx.recyclerview.widget.RecyclerView.ViewHolder
34
import androidx.test.espresso.Espresso
45
import androidx.test.espresso.action.ViewActions
56
import androidx.test.espresso.assertion.ViewAssertions
7+
import androidx.test.espresso.contrib.RecyclerViewActions
68
import androidx.test.espresso.matcher.ViewMatchers
79
import org.hamcrest.Matchers
810
import org.wordpress.android.R
911
import org.wordpress.android.support.WPSupportUtils
12+
import org.wordpress.android.ui.stats.refresh.lists.StatsListViewModel
1013
import org.wordpress.android.util.StatsKeyValueData
1114
import org.wordpress.android.util.StatsVisitsData
1215

@@ -31,37 +34,37 @@ class StatsPage {
3134
}
3235

3336
fun scrollToPosts(): StatsPage {
34-
scrollToCard("Posts and Pages")
37+
scrollToCard(1, StatsListViewModel.StatsSection.DAYS)
3538
return this
3639
}
3740

3841
fun scrollToReferrers(): StatsPage {
39-
scrollToCard("Referrers")
42+
scrollToCard(2, StatsListViewModel.StatsSection.DAYS)
4043
return this
4144
}
4245

4346
fun scrollToClicks(): StatsPage {
44-
scrollToCard("Clicks")
47+
scrollToCard(3, StatsListViewModel.StatsSection.DAYS)
4548
return this
4649
}
4750

4851
fun scrollToAuthors(): StatsPage {
49-
scrollToCard("Authors")
52+
scrollToCard(4, StatsListViewModel.StatsSection.DAYS)
5053
return this
5154
}
5255

5356
fun scrollToCountries(): StatsPage {
54-
scrollToCard("Countries")
57+
scrollToCard(5, StatsListViewModel.StatsSection.DAYS)
5558
return this
5659
}
5760

5861
fun scrollToVideos(): StatsPage {
59-
scrollToCard("Videos")
62+
scrollToCard(7, StatsListViewModel.StatsSection.DAYS)
6063
return this
6164
}
6265

6366
fun scrollToFileDownloads(): StatsPage {
64-
scrollToCard("File downloads")
67+
scrollToCard(8, StatsListViewModel.StatsSection.DAYS)
6568
return this
6669
}
6770

@@ -96,7 +99,7 @@ class StatsPage {
9699
)
97100
)
98101
)
99-
cardStructure.check(ViewAssertions.matches(ViewMatchers.isCompletelyDisplayed()))
102+
cardStructure.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
100103
return this
101104
}
102105

@@ -121,7 +124,7 @@ class StatsPage {
121124
)
122125
)
123126
)
124-
cardStructure.check(ViewAssertions.matches(ViewMatchers.isCompletelyDisplayed()))
127+
cardStructure.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
125128
}
126129
}
127130

@@ -160,15 +163,14 @@ class StatsPage {
160163
return this
161164
}
162165

163-
private fun scrollToCard(cardHeader: String) {
164-
val card = Espresso.onView(
165-
Matchers.allOf(
166-
ViewMatchers.isDescendantOfA(visibleCoordinatorLayout),
167-
ViewMatchers.withId(R.id.stats_block_list),
168-
ViewMatchers.hasDescendant(ViewMatchers.withText(cardHeader))
169-
)
166+
private fun scrollToCard(viewholderPosition: Int, section: StatsListViewModel.StatsSection) {
167+
WPSupportUtils.idleFor(2000)
168+
Espresso.onView(Matchers.allOf(
169+
ViewMatchers.withTagValue(Matchers.`is`(section.name))
170+
)).perform(
171+
RecyclerViewActions.scrollToPosition<ViewHolder>(viewholderPosition)
170172
)
171-
WPSupportUtils.scrollIntoView(R.id.statsPager, card, 0.5.toFloat())
173+
WPSupportUtils.idleFor(2000)
172174
}
173175

174176
companion object {

WordPress/src/jetpack/res/drawable/bg_note_avatar_badge.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

WordPress/src/main/java/org/wordpress/android/datasets/NotificationsTable.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import android.database.sqlite.SQLiteDatabase;
77
import android.text.TextUtils;
88

9+
import androidx.annotation.NonNull;
910
import androidx.annotation.Nullable;
1011

1112
import org.json.JSONException;
@@ -77,10 +78,10 @@ public static ArrayList<Note> getLatestNotes(int limit) {
7778
}
7879

7980
private static boolean putNote(Note note, boolean checkBeforeInsert) {
80-
String rawNote = prepareNote(note.getId(), note.getJSON().toString());
81+
String rawNote = prepareNote(note.getId(), note.getJson().toString());
8182

8283
ContentValues values = new ContentValues();
83-
values.put("type", note.getType());
84+
values.put("type", note.getRawType());
8485
values.put("timestamp", note.getTimestamp());
8586
values.put("raw_note_data", rawNote);
8687

@@ -124,7 +125,7 @@ private static String prepareNote(String noteId, String noteSrc) {
124125
return noteSrc;
125126
}
126127

127-
public static void saveNotes(List<Note> notes, boolean clearBeforeSaving) {
128+
public static void saveNotes(@NonNull List<Note> notes, boolean clearBeforeSaving) {
128129
getDb().beginTransaction();
129130
try {
130131
if (clearBeforeSaving) {
@@ -142,7 +143,7 @@ public static void saveNotes(List<Note> notes, boolean clearBeforeSaving) {
142143
}
143144
}
144145

145-
public static boolean saveNote(Note note) {
146+
public static boolean saveNote(@NonNull Note note) {
146147
getDb().beginTransaction();
147148
boolean saved = false;
148149
try {

WordPress/src/main/java/org/wordpress/android/datasets/PublicizeTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public static void setConnectionsForSite(long siteId, PublicizeConnectionList co
233233
db.delete(CONNECTIONS_TABLE, "site_id=?", new String[]{Long.toString(siteId)});
234234

235235
stmt = db.compileStatement(
236-
"INSERT INTO " + CONNECTIONS_TABLE
236+
"INSERT OR REPLACE INTO " + CONNECTIONS_TABLE
237237
+ " (id," // 1
238238
+ " site_id," // 2
239239
+ " user_id," // 3

WordPress/src/main/java/org/wordpress/android/datasets/ReaderLikeTable.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,18 @@ public static void setCurrentUserLikesPost(ReaderPost post, boolean isLiked, lon
7777
if (post == null) {
7878
return;
7979
}
80+
setCurrentUserLikesPost(post.postId, post.blogId, isLiked, wpComUserId);
81+
}
82+
83+
public static void setCurrentUserLikesPost(long postId, long blogId, boolean isLiked, long wpComUserId) {
8084
if (isLiked) {
8185
ContentValues values = new ContentValues();
82-
values.put("blog_id", post.blogId);
83-
values.put("post_id", post.postId);
86+
values.put("blog_id", blogId);
87+
values.put("post_id", postId);
8488
values.put("user_id", wpComUserId);
8589
ReaderDatabase.getWritableDb().insert("tbl_post_likes", null, values);
8690
} else {
87-
String[] args = {Long.toString(post.blogId), Long.toString(post.postId), Long.toString(wpComUserId)};
91+
String[] args = {Long.toString(blogId), Long.toString(postId), Long.toString(wpComUserId)};
8892
ReaderDatabase.getWritableDb().delete("tbl_post_likes", "blog_id=? AND post_id=? AND user_id=?", args);
8993
}
9094
}

WordPress/src/main/java/org/wordpress/android/datasets/ReaderTagTable.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ public static ReaderTagList getBookmarkTags() {
232232
return getTagsOfType(ReaderTagType.BOOKMARKED);
233233
}
234234

235+
public static ReaderTagList getDiscoverPostCardsTags() {
236+
return getTagsOfType(ReaderTagType.DISCOVER_POST_CARDS);
237+
}
238+
235239
private static ReaderTagList getTagsOfType(ReaderTagType tagType) {
236240
String[] args = {Integer.toString(tagType.toInt())};
237241
Cursor c = ReaderDatabase.getReadableDb()

0 commit comments

Comments
 (0)