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

NT-1907:UI for Comment Card #1255

Merged
merged 11 commits into from May 24, 2021
Merged

NT-1907:UI for Comment Card #1255

merged 11 commits into from May 24, 2021

Conversation

hadia
Copy link
Contributor

@hadia hadia commented May 21, 2021

📲 What

A reusable component has been created to render a single comment

🤔 Why

Build new comment UI

🛠 How

  1. Creat card view for comments with test
  2. Create view holder and adapter with unit test
  3. Bind to Recycler view with a call from the server

👀 See

image

device-2021-05-21-203700.mp4

📋 QA

open comment list from any project

Story 📖

https://kickstarter.atlassian.net/browse/NT-1907

@codecov
Copy link

codecov bot commented May 21, 2021

Codecov Report

Merging #1255 (735a394) into master (a38f215) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1255   +/-   ##
=========================================
  Coverage     74.50%   74.50%           
  Complexity      739      739           
=========================================
  Files           221      221           
  Lines          6632     6632           
  Branches        404      404           
=========================================
  Hits           4941     4941           
  Misses         1555     1555           
  Partials        136      136           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a38f215...735a394. Read the comment docs.


fun takeData(comments: List<Comment>) {
sections().clear()
addSection(Observable.from(comments).toList().toBlocking().single())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not fan of blocking observables,
usually on the adapter for creating a section we do that on the init Block, take a look here

insertSection(SECTION_LOGGED_IN_EMPTY_VIEW, emptyList<Any>())

or here
insertSection(SECTION_EMPTY_VIEW, emptyList<Any>())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove part of handling empty state as app crash in case loggout user and it will be handle in different ticket
image


fun setAvatarUrl(url: String?) {
url?.let {
Picasso.get().load(it)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a picky comment for the future, I would like to not speak directly to a dependency, this comment is more meant for future tech debt as I know this concrete case with picasso is quite extended throwout the app so no need to act on it.
But we should create or a utils class or a client to inject on the UI layer that will isolate us from calling any third party directly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can also create an extension layer or Custom Imageview using through app

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

totally agree

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
image

import com.kickstarter.ui.extensions.parseHtmlTag
import com.squareup.picasso.Picasso

class CommentCard @JvmOverloads constructor(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💘

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☺️☺️🎉

@@ -25,18 +28,22 @@ interface CommentsViewModel {
fun currentUserAvatar(): Observable<String?>
fun enableCommentComposer(): Observable<Boolean>
fun showCommentComposer(): Observable<Void>
fun commentsList(): Observable<List<Comment>?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it needs to be optional? in case of no comments we could have an empty list so no null allowed on this Observable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

android:focusable="true"
android:orientation="vertical">

<com.kickstarter.ui.views.CommentCard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☺️☺️🎉

import org.junit.Before
import org.junit.Test

class CommentCardTest : KSRobolectricTestCase() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWESOME!!! 💞

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☺️☺️🎉

Copy link
Contributor

@Arkariang Arkariang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a minor comment on the CommentsAdapter. Apart from that you've done an exceptional work here @hadia , Love it!

@Arkariang
Copy link
Contributor

Tested it on my environment
Screen Shot 2021-05-21 at 4 01 04 PM

@hadia hadia requested a review from jgsamudio May 24, 2021 18:50
@hadia
Copy link
Contributor Author

hadia commented May 24, 2021

@Arkariang @leighdouglas @sunday-okpoluaefe @jgsamudio

Remove part of handling empty state as app crash in case logout user and it will be handle in different ticket
image
https://kickstarter.atlassian.net/browse/NT-1943

@hadia hadia merged commit 4bb11b5 into master May 24, 2021
@hadia hadia deleted the comment_card branch May 24, 2021 19:05
hadia added a commit that referenced this pull request May 24, 2021
@hadia hadia restored the comment_card branch May 24, 2021 19:46
@hadia hadia deleted the comment_card branch May 24, 2021 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants