Skip to content

Commit

Permalink
Merge pull request #20072 from wordpress-mobile/feature/notifications…
Browse files Browse the repository at this point in the history
…_refresh_p1

Notifications Refresh (Phase 1)
  • Loading branch information
Antonis Lilis authored Feb 28, 2024
2 parents 14b6aae + 7921f85 commit ff47667
Show file tree
Hide file tree
Showing 63 changed files with 2,391 additions and 1,713 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

24.4
-----
[***] [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]

24.3
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 @@ -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
@@ -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 ff47667

Please sign in to comment.