Skip to content

Commit

Permalink
Rename Like to PostLike to more clearly distinguish from CommentLike
Browse files Browse the repository at this point in the history
  • Loading branch information
mkevins committed Feb 23, 2024
1 parent 6d68a12 commit b0653b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ val Note.type
get() = NoteType.from(rawType)

sealed class Notification {
data class Like(val url: String, val title: String): Notification()
data class PostLike(val url: String, val title: String): Notification()
data object NewPost: Notification()
data object Comment: Notification()
data object Unknown: Notification()

companion object {
fun from(rawNote: Note) = when(rawNote.type) {
NoteType.Like -> Like(url = rawNote.url, title = rawNote.title)
NoteType.PostLike -> PostLike(url = rawNote.url, title = rawNote.title)
NoteType.NewPost -> NewPost
NoteType.Comment -> Comment
else -> Unknown
Expand All @@ -21,7 +21,7 @@ sealed class Notification {
}
enum class NoteType(val rawType: String) {
Follow(Note.NOTE_FOLLOW_TYPE),
Like(Note.NOTE_LIKE_TYPE),
PostLike(Note.NOTE_LIKE_TYPE),
Comment(Note.NOTE_COMMENT_TYPE),
Matcher(Note.NOTE_MATCHER_TYPE),
CommentLike(Note.NOTE_COMMENT_LIKE_TYPE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.wordpress.android.fluxc.store.CommentsStore
import org.wordpress.android.fluxc.store.SiteStore
import org.wordpress.android.fluxc.utils.AppLogWrapper
import org.wordpress.android.models.Note
import org.wordpress.android.models.Notification
import org.wordpress.android.models.Notification.PostLike
import org.wordpress.android.modules.BG_THREAD
import org.wordpress.android.push.GCMMessageHandler
import org.wordpress.android.ui.jetpackoverlay.JetpackFeatureRemovalOverlayUtil
Expand Down Expand Up @@ -163,7 +163,7 @@ class NotificationsListViewModel @Inject constructor(
}

sealed class InlineActionEvent {
data class SharePostButtonTapped(val notification: Notification.Like) : InlineActionEvent()
data class SharePostButtonTapped(val notification: PostLike) : InlineActionEvent()
class LikeCommentButtonTapped(val note: Note, val liked: Boolean) : InlineActionEvent()
class LikePostButtonTapped(val note: Note, val liked: Boolean) : InlineActionEvent()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ class NoteViewHolder(
when (notification) {
Notification.Comment -> bindLikeCommentAction(note)
is Notification.NewPost -> bindLikePostAction(note)
is Notification.Like -> bindShareAction(notification)
is Notification.PostLike -> bindShareAction(notification)
is Notification.Unknown -> {
binding.action.isVisible = false
}
}
}

private fun bindShareAction(notification: Notification.Like) {
private fun bindShareAction(notification: Notification.PostLike) {
binding.action.setImageResource(R.drawable.block_share)
val color = binding.root.context.getColorFromAttribute(R.attr.wpColorOnSurfaceMedium)
ImageViewCompat.setImageTintList(binding.action, ColorStateList.valueOf(color))
Expand Down

0 comments on commit b0653b1

Please sign in to comment.