Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/trunk' into merge/24.3-final-to-…
Browse files Browse the repository at this point in the history
…trunk
  • Loading branch information
oguzkocer committed Mar 2, 2024
2 parents 5efed33 + 4dfebc9 commit 2e4fee0
Show file tree
Hide file tree
Showing 182 changed files with 4,901 additions and 2,302 deletions.
7 changes: 6 additions & 1 deletion RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

24.4
-----

[***] [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]
[***] [Jetpack-only] Improved Notifications experience with richer UI elements and interactions [https://github.com/wordpress-mobile/WordPress-Android/pull/20072]
* [**] [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]
* [*] Block editor: Prevent crash when autoscrolling to blocks [https://github.com/WordPress/gutenberg/pull/59110]
* [*] Block editor: Remove opacity change when images are being uploaded [https://github.com/WordPress/gutenberg/pull/59264]
* [*] Block editor: Media & Text blocks correctly show an error message when the attached video upload fails [https://github.com/WordPress/gutenberg/pull/59288]

24.3
-----
Expand Down
6 changes: 5 additions & 1 deletion WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -640,12 +640,16 @@ tasks.register("dependencyTreeDiffCommentToGitHub", ViolationCommentsToGitHubTas
commentOnlyChangedFiles = false
minSeverity = SEVERITY.INFO
commentTemplate = """
### The PR caused the following dependency changes:
<details><summary>The PR caused some dependency changes (expand to see details)</summary>
<p>
```diff
{{{violation.message}}}
```
</p>
</details>
*Please review and act accordingly*
"""
violations = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.After
import org.junit.Assume.assumeTrue
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import org.wordpress.android.BuildConfig
import org.wordpress.android.R
Expand All @@ -22,9 +21,7 @@ import org.wordpress.android.util.StatsVisitsData
class StatsTests : BaseTest() {
@Before
fun setUp() {
// We're not running Stats tests for JP.
// See https://github.com/wordpress-mobile/WordPress-Android/issues/18065
assumeTrue(!BuildConfig.IS_JETPACK_APP)
assumeTrue(BuildConfig.IS_JETPACK_APP)
ComposeEspressoLink().unregister()
logoutIfNecessary()
wpLogin()
Expand All @@ -38,8 +35,7 @@ class StatsTests : BaseTest() {
Espresso.pressBack()
}
}

@Ignore("Will be taken care of in a future PR - scrollToPosts is not working")

@Test
fun e2eAllDayStatsLoad() {
val todayVisits = StatsVisitsData("97", "28", "14", "11")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class MySitesPage {
val statsButton = Espresso.onView(
Matchers.allOf(
ViewMatchers.withText(R.string.stats),
ViewMatchers.withId(R.id.my_site_item_primary_text)
ViewMatchers.withId(R.id.quick_link_item)
)
)
WPSupportUtils.clickOn(statsButton)
Expand All @@ -158,7 +158,7 @@ class MySitesPage {
WPSupportUtils.waitForElementToBeDisplayedWithoutFailure(R.id.tabLayout)

// Wait for the stats to load
WPSupportUtils.idleFor(8000)
WPSupportUtils.idleFor(4000)
return StatsPage()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package org.wordpress.android.e2e.pages

import androidx.recyclerview.widget.RecyclerView.ViewHolder
import androidx.test.espresso.Espresso
import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.assertion.ViewAssertions
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.matcher.ViewMatchers
import org.hamcrest.Matchers
import org.wordpress.android.R
import org.wordpress.android.support.WPSupportUtils
import org.wordpress.android.ui.stats.refresh.lists.StatsListViewModel
import org.wordpress.android.util.StatsKeyValueData
import org.wordpress.android.util.StatsVisitsData

Expand All @@ -31,37 +34,37 @@ class StatsPage {
}

fun scrollToPosts(): StatsPage {
scrollToCard("Posts and Pages")
scrollToCard(1, StatsListViewModel.StatsSection.DAYS)
return this
}

fun scrollToReferrers(): StatsPage {
scrollToCard("Referrers")
scrollToCard(2, StatsListViewModel.StatsSection.DAYS)
return this
}

fun scrollToClicks(): StatsPage {
scrollToCard("Clicks")
scrollToCard(3, StatsListViewModel.StatsSection.DAYS)
return this
}

fun scrollToAuthors(): StatsPage {
scrollToCard("Authors")
scrollToCard(4, StatsListViewModel.StatsSection.DAYS)
return this
}

fun scrollToCountries(): StatsPage {
scrollToCard("Countries")
scrollToCard(5, StatsListViewModel.StatsSection.DAYS)
return this
}

fun scrollToVideos(): StatsPage {
scrollToCard("Videos")
scrollToCard(7, StatsListViewModel.StatsSection.DAYS)
return this
}

fun scrollToFileDownloads(): StatsPage {
scrollToCard("File downloads")
scrollToCard(8, StatsListViewModel.StatsSection.DAYS)
return this
}

Expand Down Expand Up @@ -96,7 +99,7 @@ class StatsPage {
)
)
)
cardStructure.check(ViewAssertions.matches(ViewMatchers.isCompletelyDisplayed()))
cardStructure.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
return this
}

Expand All @@ -121,7 +124,7 @@ class StatsPage {
)
)
)
cardStructure.check(ViewAssertions.matches(ViewMatchers.isCompletelyDisplayed()))
cardStructure.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
}
}

Expand Down Expand Up @@ -160,15 +163,14 @@ class StatsPage {
return this
}

private fun scrollToCard(cardHeader: String) {
val card = Espresso.onView(
Matchers.allOf(
ViewMatchers.isDescendantOfA(visibleCoordinatorLayout),
ViewMatchers.withId(R.id.stats_block_list),
ViewMatchers.hasDescendant(ViewMatchers.withText(cardHeader))
)
private fun scrollToCard(viewholderPosition: Int, section: StatsListViewModel.StatsSection) {
WPSupportUtils.idleFor(2000)
Espresso.onView(Matchers.allOf(
ViewMatchers.withTagValue(Matchers.`is`(section.name))
)).perform(
RecyclerViewActions.scrollToPosition<ViewHolder>(viewholderPosition)
)
WPSupportUtils.scrollIntoView(R.id.statsPager, card, 0.5.toFloat())
WPSupportUtils.idleFor(2000)
}

companion object {
Expand Down
6 changes: 0 additions & 6 deletions WordPress/src/jetpack/res/drawable/bg_note_avatar_badge.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.database.sqlite.SQLiteDatabase;
import android.text.TextUtils;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

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

private static boolean putNote(Note note, boolean checkBeforeInsert) {
String rawNote = prepareNote(note.getId(), note.getJSON().toString());
String rawNote = prepareNote(note.getId(), note.getJson().toString());

ContentValues values = new ContentValues();
values.put("type", note.getType());
values.put("type", note.getRawType());
values.put("timestamp", note.getTimestamp());
values.put("raw_note_data", rawNote);

Expand Down Expand Up @@ -124,7 +125,7 @@ private static String prepareNote(String noteId, String noteSrc) {
return noteSrc;
}

public static void saveNotes(List<Note> notes, boolean clearBeforeSaving) {
public static void saveNotes(@NonNull List<Note> notes, boolean clearBeforeSaving) {
getDb().beginTransaction();
try {
if (clearBeforeSaving) {
Expand All @@ -142,7 +143,7 @@ public static void saveNotes(List<Note> notes, boolean clearBeforeSaving) {
}
}

public static boolean saveNote(Note note) {
public static boolean saveNote(@NonNull Note note) {
getDb().beginTransaction();
boolean saved = false;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public static void setConnectionsForSite(long siteId, PublicizeConnectionList co
db.delete(CONNECTIONS_TABLE, "site_id=?", new String[]{Long.toString(siteId)});

stmt = db.compileStatement(
"INSERT INTO " + CONNECTIONS_TABLE
"INSERT OR REPLACE INTO " + CONNECTIONS_TABLE
+ " (id," // 1
+ " site_id," // 2
+ " user_id," // 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,18 @@ public static void setCurrentUserLikesPost(ReaderPost post, boolean isLiked, lon
if (post == null) {
return;
}
setCurrentUserLikesPost(post.postId, post.blogId, isLiked, wpComUserId);
}

public static void setCurrentUserLikesPost(long postId, long blogId, boolean isLiked, long wpComUserId) {
if (isLiked) {
ContentValues values = new ContentValues();
values.put("blog_id", post.blogId);
values.put("post_id", post.postId);
values.put("blog_id", blogId);
values.put("post_id", postId);
values.put("user_id", wpComUserId);
ReaderDatabase.getWritableDb().insert("tbl_post_likes", null, values);
} else {
String[] args = {Long.toString(post.blogId), Long.toString(post.postId), Long.toString(wpComUserId)};
String[] args = {Long.toString(blogId), Long.toString(postId), Long.toString(wpComUserId)};
ReaderDatabase.getWritableDb().delete("tbl_post_likes", "blog_id=? AND post_id=? AND user_id=?", args);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ public static ReaderTagList getBookmarkTags() {
return getTagsOfType(ReaderTagType.BOOKMARKED);
}

public static ReaderTagList getDiscoverPostCardsTags() {
return getTagsOfType(ReaderTagType.DISCOVER_POST_CARDS);
}

private static ReaderTagList getTagsOfType(ReaderTagType tagType) {
String[] args = {Integer.toString(tagType.toInt())};
Cursor c = ReaderDatabase.getReadableDb()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.wordpress.android.datasets.wrappers

import dagger.Reusable
import org.wordpress.android.datasets.NotificationsTable
import org.wordpress.android.models.Note
import javax.inject.Inject

@Reusable
class NotificationsTableWrapper @Inject constructor() {
fun saveNote(note: Note): Boolean = NotificationsTable.saveNote(note)

fun saveNotes(notes: List<Note>, clearBeforeSaving: Boolean) {
NotificationsTable.saveNotes(notes, clearBeforeSaving)
}
}
Loading

0 comments on commit 2e4fee0

Please sign in to comment.