-
Notifications
You must be signed in to change notification settings - Fork 992
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
NT-1968:UX β Add comment composer to thread #1291
Conversation
@@ -217,9 +225,10 @@ class CommentsActivity : | |||
* // TODO: Once the viewReplies UI is completed call this method with openKeyboard = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove now the TODO's :)
@@ -193,7 +201,7 @@ class CommentsActivity : | |||
} | |||
|
|||
override fun onReplyButtonClicked(comment: Comment) { | |||
startThreadActivity(comment, true) | |||
viewModel.inputs.onReplayClicked(comment, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "replay" should be "reply"
@@ -204,7 +212,7 @@ class CommentsActivity : | |||
} | |||
|
|||
override fun onCommentRepliesClicked(comment: Comment) { | |||
startThreadActivity(comment, false) | |||
viewModel.inputs.onReplayClicked(comment, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: same as comment above.
} | ||
|
||
private fun getCommentComposerStatus(projectAndUser: Pair<Project, User?>) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can abstract this logic into something separate since this is being reused in a couple places? Just a thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just a small thing, I made a comment about the spelling of replay that should be corrected to reply -> I noticed that most instances of this word are spelled incorrectly. Could you take a sec to look through and make sure they're all spelled correctly? Otherwise great job! π π
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! as soon as the linter is fixed is good to go π
Codecov Report
@@ Coverage Diff @@
## master #1291 +/- ##
=========================================
Coverage 74.34% 74.34%
Complexity 739 739
=========================================
Files 221 221
Lines 6646 6646
Branches 405 405
=========================================
Hits 4941 4941
Misses 1569 1569
Partials 136 136 Continue to review full report at Codecov.
|
@@ -68,6 +70,7 @@ interface CommentsViewModel { | |||
private val refresh = PublishSubject.create<Void>() | |||
private val nextPage = PublishSubject.create<Void>() | |||
private val onShowGuideLinesLinkClicked = PublishSubject.create<Void>() | |||
private val onReplayClicked = PublishSubject.create<Pair<Comment, Boolean>>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be corrected to onReplyClicked
@@ -342,6 +353,9 @@ interface CommentsViewModel { | |||
override fun isRefreshing(): Observable<Boolean> = isRefreshing | |||
override fun insertNewCommentToList(comment: String, createdAt: DateTime) = insertNewCommentToList.onNext(Pair(comment, createdAt)) | |||
|
|||
override fun onReplyClicked(comment: Comment, openKeyboard: Boolean) = onReplayClicked.onNext(Pair(comment, openKeyboard)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise, this should be onReplyClicked
@@ -22,6 +28,10 @@ interface ThreadViewModel { | |||
|
|||
/** Will tell to the compose view if should open the keyboard */ | |||
fun shouldFocusOnCompose(): Observable<Boolean> | |||
|
|||
fun currentUserAvatar(): Observable<String?> | |||
fun replayComposerStatus(): Observable<CommentComposerStatus> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: replyComposerStatus()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -30,6 +40,9 @@ interface ThreadViewModel { | |||
|
|||
private val rootComment = BehaviorSubject.create<Comment>() | |||
private val focusOnCompose = BehaviorSubject.create<Boolean>() | |||
private val currentUserAvatar = BehaviorSubject.create<String?>() | |||
private val replayComposerStatus = BehaviorSubject.create<CommentComposerStatus>() | |||
private val showReplayComposer = BehaviorSubject.create<Boolean>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: change to replyComposerStatus
and showReplyComposer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
private fun getCommentFromIntent() = intent() | ||
.map { it.getParcelableExtra(IntentKey.COMMENT) as Comment? } | ||
.ofType(Comment::class.java) | ||
|
||
override fun getRootComment(): Observable<Comment> = this.rootComment | ||
override fun shouldFocusOnCompose(): Observable<Boolean> = this.focusOnCompose | ||
override fun currentUserAvatar(): Observable<String?> = currentUserAvatar | ||
override fun replayComposerStatus(): Observable<CommentComposerStatus> = replayComposerStatus | ||
override fun showReplayComposer(): Observable<Boolean> = showReplayComposer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: change to replyComposerStatus()
and showReplyComposer()
@@ -16,6 +20,9 @@ class ThreadViewModelTest : KSRobolectricTestCase() { | |||
private val getComment = TestSubscriber<Comment>() | |||
private val focusCompose = TestSubscriber<Boolean>() | |||
|
|||
private val replayComposerStatus = TestSubscriber<CommentComposerStatus>() | |||
private val showReplayComposer = TestSubscriber<Boolean>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: change to replyComposerStatus
and showReplyComposer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
# Conflicts: # app/src/main/java/com/kickstarter/viewmodels/CommentsViewModel.kt
# Conflicts: # app/src/test/java/com/kickstarter/viewmodels/CommentsViewModelTest.kt
π² What
Add comment composer to thread Activity
π€ Why
π How
1- pass project from comment activity to thread activity
2- add the same logic to check when to show comment composer
π See
device-2021-06-15-163912.mp4
device-2021-06-15-161330.mp4
π QA
Same As Comment Composer
Make sure you have a project that you are not backing, a project that you are backing, and a project that you created, and all projects must have comments. Test going to the comments directly from the project page, as well as from the updates page. Then test the different states listed below.
π΄ = no comment composer
π‘ = comment composer disabled
π’ = comment composer enabled
These are the different states to test:
Logged out = π΄
Logged in and not backing = π‘
Logged in and backing = π’
Logged in and creator = π’
-QA
Showing keyboard at the start when pressing replay
and keyboard is hidden in case pressing view replies
Story π
https://kickstarter.atlassian.net/browse/NT-1968