Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications Refresh (Phase 1) #20072

Merged
merged 233 commits into from
Feb 28, 2024
Merged
Changes from 6 commits
Commits
Show all changes
233 commits
Select commit Hold shift + click to select a range
a484e36
Removes notification utils and related resources
Jan 29, 2024
d03c9e8
Replaces BadgeImageView with a simple ImageView
Jan 29, 2024
487f92d
Removes unused dimension resources
Jan 29, 2024
3e36513
Merge pull request #20068 from wordpress-mobile/issue/20022-remove-av…
Jan 30, 2024
b1814dc
Update the heading style
Jan 30, 2024
e84df5f
Update the colors
Jan 30, 2024
d04fdcf
Merge pull request #20073 from wordpress-mobile/issue/20020-notificat…
Jan 30, 2024
948bd1d
Update the rule of max lines
Jan 30, 2024
6a99d2f
Remove the bold style from the title text of the notification
Jan 30, 2024
17978c6
Remove the dividers from the item of notification
Jan 30, 2024
50928f4
Remove the unused variable in the view holder
Jan 30, 2024
f83dd45
Extract a function to fix a lint issue
Jan 30, 2024
e7983e9
Merge pull request #20076 from wordpress-mobile/issue/20021-update-no…
Jan 30, 2024
8ec8dae
Merge branch 'trunk' into feature/notifications_refresh_p1
Jan 30, 2024
6d4bfb7
Adds green dot to indicate unread notification status
Jan 30, 2024
bd45fe7
Fixes RTL unread dot alignement
Jan 30, 2024
0ead1d9
Merge pull request #20079 from wordpress-mobile/issue/20023-unread-notif
jarvislin Jan 31, 2024
931d6ba
Refactor the notifications item with ConstraintLayout for better perf…
Jan 31, 2024
3034da5
Extract dimens
Jan 31, 2024
31e0698
Add an action icon
Jan 31, 2024
60f764d
Handle the margin for the header of notifications item programmatically
Jan 31, 2024
f8390d0
Fix the margins of notification
Jan 31, 2024
d007b0b
Optimise vector resource path
Jan 31, 2024
c9d6fac
Merge pull request #20085 from wordpress-mobile/issue/20024-like-inli…
Jan 31, 2024
28a5826
Merge branch 'feature/notifications_refresh_p1' into issue/20024-like…
Feb 1, 2024
8ce1152
Merge branch 'trunk' into feature/notifications_refresh_p1
Feb 1, 2024
14ad09a
Handle the visibility of action icon
Feb 1, 2024
25fd354
Merge branch 'feature/notifications_refresh_p1' into issue/20024-like…
Feb 2, 2024
0c319da
Add a popup for the notification actions
Feb 5, 2024
e0d8cf8
Remove unused methods
mkevins Feb 6, 2024
778919c
Add events
Feb 6, 2024
f1d7c56
Fix a lint issue
Feb 6, 2024
aac6553
Fix a lint issue
Feb 6, 2024
42f6414
Add nullability annotations
mkevins Feb 6, 2024
d2ec7a6
Use List sort in addAll
mkevins Feb 6, 2024
8be4ca2
Remove more dead code from notes adapter
mkevins Feb 6, 2024
8319f2f
Apply automatic Kotlin conversion to NotesAdapter
mkevins Feb 6, 2024
2a37563
Fix addAll sort after Kotlin conversion
mkevins Feb 6, 2024
bb2d84a
Add missing else clause to when
mkevins Feb 6, 2024
fe0d2db
Simplify null checks in viewholder init
mkevins Feb 6, 2024
818a70b
Remove else from exhaustive when
mkevins Feb 6, 2024
b365498
Mark notes adapter as deprecated at the file level
mkevins Feb 6, 2024
a48cc3b
Fix reference to buildFilteredNotesList
mkevins Feb 6, 2024
f240059
Suppress lint issues in notes adapter
mkevins Feb 6, 2024
7903409
Fix a lint issue
Feb 6, 2024
6964d59
Merge pull request #20124 from wordpress-mobile/issue/20065-overflow-…
jarvislin Feb 6, 2024
3c02ee2
Rename notes adapter members
mkevins Feb 6, 2024
3416208
Move a function to ViewModel
Feb 6, 2024
1a729ca
Update Kotlin code to clean up else ifs
mkevins Feb 6, 2024
d2c57d3
Simplify isUnread logic for note visibility
mkevins Feb 6, 2024
3704986
Merge pull request #20129 from wordpress-mobile/feature/notifications…
mkevins Feb 6, 2024
3dab4a4
Parses extra notification avatars
Feb 6, 2024
94a46ef
Adds layouts for multiple avatars
Feb 6, 2024
504e7d3
Loads multiple avatars for new followers and post/comment likes
Feb 6, 2024
baa1d4c
Handle view models
Feb 7, 2024
8bfcb50
Merge branch 'feature/notifications_refresh_p1' into issue/20066-add-…
Feb 7, 2024
9bebd86
Implement Mark all as read
Feb 7, 2024
fa83b6f
Merge branch 'trunk' into feature/notifications_refresh_p1
mkevins Feb 7, 2024
acfa864
Make refactors
Feb 7, 2024
ac8c93e
Make a refactor
Feb 7, 2024
833decf
Add nonnull annotattion for getTimeGroupForTimestamp
mkevins Feb 7, 2024
0de0b3a
Refactor injected members as lateinit vars
mkevins Feb 7, 2024
699fa03
Extract timegroup header logic
mkevins Feb 7, 2024
ac7d04c
Merge branch 'feature/notifications_refresh_p1' into issue/20024-like…
Feb 7, 2024
5f85a20
Verify that the icon is not null or empty
Feb 7, 2024
9c67637
Extract multiple avatar views in separate files
Feb 7, 2024
405e0b3
Merge branch 'feature/notifications_refresh_p1' into issue/20039-noti…
Feb 7, 2024
216c1bd
Extract avatar loading function
Feb 7, 2024
7a63be5
Ignoring linter suggestion since the FrameLayout is not redundant in …
Feb 7, 2024
1f17263
Merge pull request #20136 from wordpress-mobile/issue/20066-add-Mark-…
Feb 7, 2024
7d29468
Makes dual avatars larger and fixes alignment
Feb 7, 2024
cf22b77
Merge pull request #20133 from wordpress-mobile/issue/20039-notif-mul…
mkevins Feb 8, 2024
b0f1746
Merge branch 'feature/notifications_refresh_p1' into issue/20040-noti…
mkevins Feb 8, 2024
b9fc8fc
Refactor note type methods to indicate that the type is a raw string
mkevins Feb 8, 2024
452a0bc
Add nonnull annotations for note type checking methods
mkevins Feb 8, 2024
d47f7b6
Shows full comment for push notifications
Feb 8, 2024
a5dcc12
Updates the comment title in the PN aligning with iOS
Feb 8, 2024
dee3237
Removes unused code
Feb 8, 2024
5323e99
Adds tests for the notification title and message
Feb 8, 2024
0bb0840
Aligns code correctly
Feb 8, 2024
b0fe89d
Remove unnecessary save call on imageManager
mkevins Feb 9, 2024
33e188d
Add note type extension getter
mkevins Feb 9, 2024
7929dac
Fixes typo in constant name
Feb 9, 2024
ed967fd
Merge pull request #20153 from wordpress-mobile/issue/20099-comment-pn
Feb 9, 2024
4c53c96
Use static map for raw type to note type conversion
mkevins Feb 9, 2024
3447f07
Merge branch 'feature/notifications_refresh_p1' into issue/20024-like…
Feb 12, 2024
93b45f6
Use indexing for note type map getter
mkevins Feb 12, 2024
5975b1a
Declare a sealed class for Notfications
mkevins Feb 12, 2024
fe0a9d4
Add stubs to notes adapter to bind action icon to handlers
mkevins Feb 12, 2024
1146fe9
Suppress TODO warning
mkevins Feb 12, 2024
4786b5e
Merge pull request #20172 from wordpress-mobile/issue/20040-notificat…
Feb 12, 2024
a5efec7
Merge branch 'trunk' into feature/notifications_refresh_p1
Feb 12, 2024
1237e0f
Handle the like action
Feb 12, 2024
5211952
Merge branch 'feature/notifications_refresh_p1' into issue/20024-like…
Feb 12, 2024
515b11f
Merge branch 'trunk' into feature/notifications_refresh_p1
mkevins Feb 13, 2024
600ec67
Import block_share icon from Figma designs
mkevins Feb 13, 2024
7c635c4
Fix broken vector path after import
mkevins Feb 13, 2024
ed9e6ed
Use share icon from the Figma design
mkevins Feb 13, 2024
7bb2105
Update notification model to include more types
mkevins Feb 13, 2024
ca97951
Implement inline action event in notification view model
mkevins Feb 13, 2024
acf4686
Add flow for inline action events
mkevins Feb 13, 2024
d458cc2
Move inline action bind function to inner class
mkevins Feb 13, 2024
4ae77e5
Wire up notification inline actions in fragment page
mkevins Feb 13, 2024
e73b37c
Eliminate code duplication in ReaderActivityLauncher
mkevins Feb 13, 2024
5b5fc31
Removes unused import
Feb 13, 2024
69a3392
Fix inline action share icon in dark mode
mkevins Feb 13, 2024
a9a0972
Merge pull request #20178 from wordpress-mobile/issue/20040-notificat…
mkevins Feb 13, 2024
8fce194
Merge branch 'feature/notifications_refresh_p1' into issue/20024-like…
Feb 14, 2024
781dd16
Add tracking event for notifications inline actions
mkevins Feb 14, 2024
70bb7ba
Track inline action events for notifications
mkevins Feb 14, 2024
853cf63
Implement the inline action of Like Comment
Feb 14, 2024
8c83377
Open comments that cannot be moderated in the reader
Feb 14, 2024
9d9584b
Move functions to view model
Feb 15, 2024
d9279f4
Fix lint issues
Feb 15, 2024
b260d02
Make refactors
Feb 15, 2024
587ffbe
Remove an event
Feb 15, 2024
1bce49a
Make refactors
Feb 15, 2024
b81d996
Fix an issue related to RTL
Feb 15, 2024
2532ec2
Moves logic in the viewModel
Feb 15, 2024
4b0d3a6
Optimise function parameter list
Feb 15, 2024
b75ec32
Replaces static function calls with wrapped objects for testability
Feb 15, 2024
d29cf50
Adds test cases
Feb 15, 2024
d5d06cb
Implement Like Post
Feb 15, 2024
8a68798
Update color settings
Feb 15, 2024
47720af
Changed mocked action handler to interface to avoid unneeded code
Feb 15, 2024
050cc68
Update the coroutine dispatcher settings
Feb 15, 2024
2b40d4c
Make the coroutine block cover the entire function
Feb 15, 2024
9ca2497
Update WordPress/src/main/java/org/wordpress/android/ui/notifications…
Feb 15, 2024
6c0ef89
Merge pull request #20187 from wordpress-mobile/issue/20024-like-inli…
Feb 15, 2024
1e4cbe0
Merge branch 'feature/notifications_refresh_p1' into issue/20040-noti…
Feb 15, 2024
4131e88
Merge pull request #20182 from wordpress-mobile/issue/20040-notificat…
Feb 15, 2024
62acf1a
Merge branch 'trunk' into feature/notifications_refresh_p1
Feb 15, 2024
8352b36
Merge branch 'feature/notifications_refresh_p1' of github.com:wordpre…
Feb 15, 2024
7ef7435
Merge branch 'feature/notifications_refresh_p1' into issue/20096-open…
Feb 15, 2024
0c3601e
Fixes broken tests after merge from trunk and feature branch
Feb 15, 2024
128dbe6
Merge branch 'feature/notifications_refresh_p1' into issue/20024-like…
Feb 16, 2024
4769b6b
Make refactors
Feb 16, 2024
98ceab2
Fix lint issues
Feb 16, 2024
78df4d7
Format code
Feb 16, 2024
c7ae275
Sync post from server
Feb 16, 2024
e6d1456
Remove redundant imports
Feb 16, 2024
b2d02dd
Adds log in the case of post retrieval failure
Feb 16, 2024
25ccee3
Fix the thread issue by using DiffUtil
Feb 16, 2024
d089b05
Opens push notification comment that cannot be moderated directly in …
Feb 16, 2024
fdd373b
Merge pull request #20195 from wordpress-mobile/issue/20024-like-post
Feb 16, 2024
339f887
Merge branch 'feature/notifications_refresh_p1' into issue/20096-open…
Feb 16, 2024
ea7ee3b
Updates broken tests after merge
Feb 16, 2024
e69e8e7
Reduce API requests
Feb 16, 2024
2e18cfa
Refactor the deprecated AsyncTask
Feb 16, 2024
ea63c86
Merge branch 'feature/notifications_refresh_p1' into issue/20196-main…
Feb 16, 2024
cc3dfe1
Refactor with Coroutine
Feb 16, 2024
81c4155
Make refactors
Feb 16, 2024
055a34a
Use the background thread for calculating the diff
Feb 16, 2024
75b431d
Remove a redundant context swicher
Feb 16, 2024
e302eb7
Merge pull request #20186 from wordpress-mobile/issue/20096-openComme…
Feb 16, 2024
0c81a3b
Merge pull request #20197 from wordpress-mobile/issue/20196-main-thre…
Feb 16, 2024
12987f7
Merge branch 'trunk' into feature/notifications_refresh_p1
Feb 16, 2024
021b8e9
Initial semiautomatic conversion
Feb 16, 2024
ee93617
Removes unused methods
Feb 16, 2024
e4b0888
Uses visual data to compare adapter items
Feb 16, 2024
2ee9f6a
Minor style improvements and lint fixes
Feb 16, 2024
445fbf6
Remove a redundant API request
Feb 19, 2024
1841f49
Refactor with ViewBinding
Feb 19, 2024
6f9cf5e
Use sans-serif in comment detail fragment
mkevins Feb 19, 2024
42435ea
Refactor position-related functions in adapter
Feb 19, 2024
5468fd1
Use sans-serif font in note block and comment user note block
mkevins Feb 19, 2024
789a519
Merge pull request #20202 from wordpress-mobile/issue/20201-use-sans-…
mkevins Feb 19, 2024
c827854
Merge branch 'trunk' into feature/notifications_refresh_p1
Feb 19, 2024
2c75c2a
Merge branch 'feature/notifications_refresh_p1' into task/notes-to-ko…
Feb 19, 2024
6d8aaa7
Remove OnNoteClickListener
Feb 19, 2024
d2126fb
Make refactors
Feb 19, 2024
ba1274f
Extract inner classes
Feb 19, 2024
0faf034
Removes magic numbers
Feb 19, 2024
84e87ff
Convert multiple ifelse to when clause
Feb 19, 2024
025720d
Reverts comparison change since it has side effects
Feb 19, 2024
73ec67c
Removes shallowed exception warnings
Feb 19, 2024
e53287c
Adds Max PN length constant
Feb 19, 2024
4fc3f47
Fixes nested block depth warning
Feb 19, 2024
3d84336
Extract NoteViewHolder from NoteAdapter
Feb 19, 2024
728a6cd
Fix a DI issue
Feb 19, 2024
fc51e29
Extracts common json parsing code and fixes lint exceptions
Feb 19, 2024
4d1bc9b
Removes warning suppression annotations
Feb 19, 2024
b83c0b6
Fix the IndexOutOfBoundException
Feb 19, 2024
3e48382
Add a comment
Feb 19, 2024
1f716c6
Fix a lint issue
Feb 19, 2024
e8099cf
Replaces getters with lazy initialisation to limit json queries
Feb 19, 2024
143e92d
Simplifies raw type expression
Feb 19, 2024
062d088
Removes duplicate field for localStatus
Feb 19, 2024
12717f8
Fix the IndexOutOfBoundsException
Feb 19, 2024
edac734
Fix a lint issue
Feb 19, 2024
48b4506
Tidies up code file by grouping into sections
Feb 19, 2024
693efee
Removes mActions variable
Feb 19, 2024
6ecfa6d
Fix a nullable context
jarvislin Feb 20, 2024
77b6277
Remove a workaround and use a simple solution
Feb 20, 2024
4e91555
Add the workaround back
Feb 20, 2024
7e8f3ef
Add a comment
Feb 20, 2024
2819f48
Merge pull request #20203 from wordpress-mobile/issue/notifications-r…
jarvislin Feb 20, 2024
688940e
Merge branch 'trunk' into feature/notifications_refresh_p1
Feb 20, 2024
14c493d
Merge branch 'feature/notifications_refresh_p1' into task/notes-to-ko…
Feb 20, 2024
3b5886a
Adds release note
Feb 20, 2024
391ef87
Merge pull request #20200 from wordpress-mobile/task/notes-to-kotlin
Feb 20, 2024
cad9236
Merge pull request #20209 from wordpress-mobile/issue/20101-releasenote
jarvislin Feb 20, 2024
1aaecf7
Adds accessibility descriptions on the action icons
Feb 20, 2024
8f74900
Merge pull request #20214 from wordpress-mobile/issue/20212-action-ac…
Feb 21, 2024
495ab1e
Replaces static calls with wrappers for testability
Feb 21, 2024
cf5a905
Adds mark notes as read tests
Feb 21, 2024
0ef4df9
Adds like comment tests
Feb 21, 2024
5dac66a
Adds test for post like action
Feb 21, 2024
bf1a29c
Fetch latest notifications when onResume()
Feb 22, 2024
63ce974
Like comment by using view model
Feb 22, 2024
f8098cd
Add back the DiffUtil for better UX
Feb 22, 2024
711a65e
Use event for handling the like state
Feb 22, 2024
b957aef
Sync UI state with each tab
Feb 22, 2024
8343191
Remove a redundant import
Feb 22, 2024
f910976
Merge pull request #20223 from wordpress-mobile/task/notif-list-tests
Feb 22, 2024
ccde5ca
Sync Like state of posts
Feb 22, 2024
abbfb83
Merge branch 'feature/notifications_refresh_p1' into issue/20211-like…
Feb 22, 2024
8e5dab4
Update tests
Feb 22, 2024
bae97b0
Merge pull request #20243 from wordpress-mobile/issue/20211-like-state
Feb 22, 2024
1b9f91e
Merge branch 'trunk' into feature/notifications_refresh_p1
Feb 22, 2024
6e3cfb0
Removes deprecated reblog notification type
Feb 22, 2024
6d68a12
Flatten Notification sealed class
mkevins Feb 23, 2024
b0653b1
Rename Like to PostLike to more clearly distinguish from CommentLike
mkevins Feb 23, 2024
228ea88
Merge pull request #20251 from wordpress-mobile/issue/20250-deprecate…
Feb 23, 2024
ccf7b69
Merge branch 'trunk' into feature/notifications_refresh_p1
Feb 23, 2024
11fd3a7
Removes extra call to comment like status setter
Feb 23, 2024
b5af7bd
Merge pull request #20263 from wordpress-mobile/fix/20248-commentlike…
Feb 26, 2024
a01c8c2
Merge branch 'trunk' into feature/notifications_refresh_p1
Feb 26, 2024
55dc65c
Refresh the entire list because the differ doesn't handle correctly
Feb 28, 2024
ec12b06
Remove a unused import
Feb 28, 2024
d6788d0
Use notifyDataSetChanged() for preventing scroll to the top when we b…
Feb 28, 2024
4dfa9cb
Merge pull request #20310 from wordpress-mobile/issue/20308-The-list-…
Feb 28, 2024
7921f85
Merge branch 'trunk' into feature/notifications_refresh_p1
Feb 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
@@ -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) {
@@ -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 {
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)
}
}
Original file line number Diff line number Diff line change
@@ -6,8 +6,7 @@ import androidx.lifecycle.MutableLiveData
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.flow.MutableSharedFlow
import org.greenrobot.eventbus.EventBus
import org.wordpress.android.datasets.NotificationsTable
import org.wordpress.android.datasets.wrappers.NotificationsTableWrapper
import org.wordpress.android.datasets.wrappers.ReaderPostTableWrapper
import org.wordpress.android.fluxc.model.SiteModel
import org.wordpress.android.fluxc.store.AccountStore
@@ -22,12 +21,13 @@ import org.wordpress.android.ui.jetpackoverlay.JetpackFeatureRemovalOverlayUtil
import org.wordpress.android.ui.jetpackoverlay.JetpackOverlayConnectedFeature.NOTIFICATIONS
import org.wordpress.android.ui.notifications.NotificationEvents.NotificationsChanged
import org.wordpress.android.ui.notifications.NotificationEvents.OnNoteCommentLikeChanged
import org.wordpress.android.ui.notifications.utils.NotificationsActions
import org.wordpress.android.ui.notifications.utils.NotificationsActionsWrapper
import org.wordpress.android.ui.notifications.utils.NotificationsUtilsWrapper
import org.wordpress.android.ui.prefs.AppPrefsWrapper
import org.wordpress.android.ui.reader.actions.ReaderActions
import org.wordpress.android.ui.reader.actions.ReaderPostActionsWrapper
import org.wordpress.android.util.AppLog
import org.wordpress.android.util.EventBusWrapper
import org.wordpress.android.viewmodel.Event
import org.wordpress.android.viewmodel.ScopedViewModel
import javax.inject.Inject
@@ -45,6 +45,9 @@ class NotificationsListViewModel @Inject constructor(
private val commentStore: CommentsStore,
private val readerPostTableWrapper: ReaderPostTableWrapper,
private val readerPostActionsWrapper: ReaderPostActionsWrapper,
private val notificationsTableWrapper: NotificationsTableWrapper,
private val notificationsActionsWrapper: NotificationsActionsWrapper,
private val eventBusWrapper: EventBusWrapper,
private val accountStore: AccountStore
) : ScopedViewModel(bgDispatcher) {
private val _showJetpackPoweredBottomSheet = MutableLiveData<Event<Boolean>>()
@@ -82,12 +85,12 @@ class NotificationsListViewModel @Inject constructor(
notes.filter { it.isUnread }
.map {
gcmMessageHandler.removeNotificationWithNoteIdFromSystemBar(context, it.id)
NotificationsActions.markNoteAsRead(it)
notificationsActionsWrapper.markNoteAsRead(it)
it.setRead()
it
}.takeIf { it.isNotEmpty() }?.let {
NotificationsTable.saveNotes(it, false)
EventBus.getDefault().post(NotificationsChanged())
notificationsTableWrapper.saveNotes(it, false)
eventBusWrapper.post(NotificationsChanged())
}
}

@@ -99,10 +102,10 @@ class NotificationsListViewModel @Inject constructor(
note.setLikedComment(liked)
_updatedNote.postValue(note)
// for updating the UI in other tabs
EventBus.getDefault().postSticky(OnNoteCommentLikeChanged(note, liked))
eventBusWrapper.postSticky(OnNoteCommentLikeChanged(note, liked))
val result = commentStore.likeComment(site, note.commentId, null, liked)
if (result.isError.not()) {
NotificationsTable.saveNote(note)
notificationsTableWrapper.saveNote(note)
}
}

@@ -140,7 +143,7 @@ class NotificationsListViewModel @Inject constructor(
note.setLikedPost(liked)
_updatedNote.postValue(note)
// for updating the UI in other tabs
EventBus.getDefault().postSticky(NotificationEvents.OnNotePostLikeChanged(note, liked))
eventBusWrapper.postSticky(NotificationEvents.OnNotePostLikeChanged(note, liked))
val post = readerPostTableWrapper.getBlogPost(note.siteId.toLong(), note.postId.toLong(), true)
readerPostActionsWrapper.performLikeActionRemote(
post = post,
@@ -150,7 +153,7 @@ class NotificationsListViewModel @Inject constructor(
wpComUserId = accountStore.account.userId
) { success ->
if (success) {
NotificationsTable.saveNote(note)
notificationsTableWrapper.saveNote(note)
if (post == null) {
// sync post from server
readerPostActionsWrapper.requestBlogPost(note.siteId.toLong(), note.postId.toLong(), null)
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.wordpress.android.ui.notifications.utils;

import androidx.annotation.Nullable;

import com.android.volley.VolleyError;
import com.wordpress.rest.RestRequest;

@@ -58,7 +60,7 @@ public static List<Note> parseNotes(JSONObject response) throws JSONException {
return notes;
}

public static void markNoteAsRead(final Note note) {
public static void markNoteAsRead(@Nullable final Note note) {
if (note == null) {
return;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.wordpress.android.ui.notifications.utils

import dagger.Reusable
import org.wordpress.android.models.Note
import javax.inject.Inject
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
@@ -14,4 +15,8 @@ class NotificationsActionsWrapper @Inject constructor() {
{ continuation.resume(true) },
{ continuation.resume(true) })
}

fun markNoteAsRead(note: Note?) {
NotificationsActions.markNoteAsRead(note)
}
}
Loading
Loading