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

Dashboard Cards: Store Dashboard Cards #2197

Merged
merged 21 commits into from
Dec 2, 2021
Merged

Conversation

ParaskP7
Copy link
Contributor

@ParaskP7 ParaskP7 commented Nov 26, 2021

Parent: WordPress-Android#15498

This PR:

  • Updates the post card response (based on the newly agreed structure).
  • Updates the post card model.
  • Adds the cards database access object (dao).
  • Adds cards dao to database and Increments version.
  • Stores dashboard cards into the database.
  • Retrieves dashboard cards from the database.

To test:

  • There is actually nothing to test in this PR, just review again the updated CardsRestClient and CardsStore classes and make sure that the accompanying tests are working as expected.
  • When WordPress-Android#15497 will get deployed and then the ReleaseStack_CardsTest test suite gets implemented, then triggering this connected test suite will be another way of verifying that this solution works as expected.

To manual test:

  • If you really want to test the solution:
    • I can provide you with a patch that connects the dashboard cards store with its source. Let me know!
    • Or, you can wait for the accompanying WordPress-Android PR to be created, which will implement the connection between the dashboard cards store and its source.
  • However, mind the fact that in both the above cases you would need to:

Merge instructions:

  • Wait for the new API endpoint to be deployed (see D69742).
  • Wait for the accompanying WordPress-Android#15637 PR to be reviewed (and possibly approved).
  • Remove the [DO NOT MERGE] from the title.
  • Remove the [PR] Not Ready For Merge label.
  • Merge the PR.

The current 'CardsModel' structure doesn't fit the agreed database
structure, where every card type will be inserted in its own row. As
such, the structure is now changing to the new 'CardModel' sealed class
structure, where every inner data class to become the a card model with
a specific type, ultimately converting the 'cards' from a single data
class, that holds in it all the individual cards, to a list of cards.
The current gson adapter cannot parse this specific date format on the
post response as it doesn't contain the timezone information required.
As such the post modified string date need to be manually converted
through the new 'CardsUtils' to a date.
This is done in order to make the date a bit more timezone agnostic.
This 'post_date_gmt' value from the post response is actually the value
that is going to be needed on the UI layer to at least show for when a
scheduled post is due. As such, this is the main date that is going to
be needed.

However, in addition to that 'post_date_gmt', I decided to keep the
'post_modified_gmt' as well, use the 'modified' post model field for it,
since it might end up being needed after all. But, mind the fact that it
is not needed on the UI atm, the 'post_date_gmt' is enough as it is the
only date to be used, and that will only applicable to scheduled posts.
This is done in order to keep the content grouped together.
After a discussion, it was decided that the previously added
'post_date_gmt' value from the post response is actually enough and as
such keeping the 'post_modified_gmt' is not required.
After a discussion, it was decided that the post response needs to be
updated with the newly agreed structure (a more compact post response).

You will also notice that the 'title' and 'content' are now not-null.
When there exist no title or content for a post the post response will
return an empty string (instead of a null). This effectively make
'featured_image' the only nullable property for a post card.

PS: The API endpoint has been already updated to adhere with the new
requirements, which is to return a more compact list of posts, for more
details see D69742.
This cards database access object (dao) will be used to store and
retrieve the list of cards, from the database, for a specific site.

Also, as part of this update, the 'CardsSqlUtils' is deleted as it will
not be required at all.
These tests will fail as the implementation is not ready yet. The next
commit will make the tests pass (TDD).
This commit makes the previous failing test pass (TDD).
These test will fail as the implementation is not ready yet. The next
commit will make the tests pass (TDD).
This commit makes the previous failing test pass (TDD).
1) Convert to expression body.
2) Remove explicit type specification.
This includes upgrading both var 'type' and 'message' fields into val.
Those constants are actually used by the
'WPAndroidDatabaseMigrationTest' suite. Instead, this commit will
suppress that with 'MemberVisibilityCanBePrivate' so that to get rid of
this false positive IDE warning.
@ParaskP7 ParaskP7 changed the title Dashboard Cards: Store Dashboard Cards [DO NOT MERGE] [DO NOT MERGE] Dashboard Cards: Store Dashboard Cards Nov 29, 2021
@zwarm zwarm self-assigned this Nov 29, 2021
Copy link
Contributor

@zwarm zwarm left a comment

Choose a reason for hiding this comment

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

Looking good @ParaskP7 . Walking us through your plan-of-attack (last week), was a big help while doing this review. 🙏 I left a couple of questions, but nothing that stops me from giving this the thumbs up, but I do want you to have the opportunity to think about the ❓ .

I would love to test this all the way through, but I always get stumped on applying the differential in my sandbox and then proxying my device. And I'm not sure if we really have time for your suggestion.

Let me know if you need any help with that!

Let us see what tomorrow brings. Other than that, 🙇 nice job!

@ParaskP7
Copy link
Contributor Author

👋 @zwarm !

Looking good @ParaskP7 . Walking us through your plan-of-attack (last week), was a big help while doing this review.

Thanks so much for going through the review! 🥇

🙏 I left a couple of questions, but nothing that stops me from giving this the thumbs up, but I do want you to have the opportunity to think about the ❓ .

Thank you for sharing your thoughts, I have answered them to the best of my abilities. Let me know and we can definitely fine-tune all that as we arrive into an agreement. 🙇

I would love to test this all the way through, but I always get stumped on applying the differential in my sandbox and then proxying my device. And I'm not sure if we really have time for your suggestion.

Please do let me know and we can sit together to setup the sandbox and proxy for you. It really is not that big of a deal, I was also very afraid of that, but now that I am using it every day I know that it is just a matter of few minutes. And then, when this gets configured, it is a matter of few seconds to switch on the sandbox and connect the proxy. 💯 PS: I also think that this is a superpower, thus, the quicker you get it working for you, the better!

@zwarm zwarm changed the title [DO NOT MERGE] Dashboard Cards: Store Dashboard Cards Dashboard Cards: Store Dashboard Cards Dec 2, 2021
@zwarm zwarm merged commit 6b043a1 into develop Dec 2, 2021
@zwarm zwarm deleted the issue/dashboard-cards-db branch December 2, 2021 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants