Giter Club home page Giter Club logo

quotable-android-app's People

Contributors

slowikj avatar

Stargazers

 avatar

Watchers

 avatar

quotable-android-app's Issues

Consider moving lastUpdated field to origin

It is worth considering putting lastUpdated field (that is present in both AuthorsDao and QuotesDao) into the origin entity rather than the remote key entity.

Why?
Some of the origins are not related to remote keys such as those that are present in the dashboard.
Currently, in order to handle the aforementioned case, a fake key is put into the database.
It must be emphasized that such an approach is error-prone, as a programmer can easily forget to write this extra line of code.

Replace `Result.runCatching` with `resultOf`

Result.runCatching has two major flaws:

  1. It consumes all Throwables (also Errors, such as OutOfMemoryException).
  2. It doesn't work well with coroutines. More precisely, it doesn't rethrow CancellationException.

The following article shows how to avert the above problems:
https://proandroiddev.com/resilient-use-cases-with-kotlin-result-coroutines-and-annotations-511df10e2e16

In short, it recommends to use own, specialized implementation that replaces runCatching.

Improve the implementation of Dashboard UI layer

Possible paths to consider

  • Each part of Dashboard should be encapsulated in a single Fragment with a corresponding ViewModel
  • Dashboard entries should be represented in a RecyclerView that is fed by a single ViewModel that emits a generic stream of data (it is represented by a sealed class)

Fix showing error and retry view in AuthorFragment

The issue occurs when in the local database there exists cached quotes of a particular author
and there is no internet connection.
Then, both quotes view and error and retry view are shown.

Fix: error and retry view should be invisible in this particular case.

Add caching all types of quotes

The app consists of quotes that are presented in different contexts:

  • All quotes
  • Quotes of a particular author
  • Quotes of a particular tag
  • Random quote
  • Dashboard exemplary quotes
  • DAO tests

All of the above types should be stored in the local database.

Remove navigation logic from ViewModels

ViewModel should be as reusable as possible, thus, it should not know anything
about specific screen navigation logic, since
it is not always the case that the current Fragment will be totally replaced by a new one.
For example, if we have a tablet, then it is possible that a new Fragment will be shown next to the current one.

In conclusion, we should leave specific navigation logic for UI layer and ViewModel should not be tainted by it.

Add author photo placeholder

Sometimes database of authors' images happens to return no response.
In order to handle this corner case and improve UX
the app should show a default placeholder (for example a default image that depicts a single person).

Add quotes' likes

  • Create a Room entity to store info about likes
  • Adjust domain Quote model to store whether a particular quote has been liked
  • Adjust quote DAOs to handle likes (querying, inserting, deleting)
  • Add heart ๐Ÿค view (both filled and empty one) for quotes' layouts
  • Handle like click in OneQuoteRepository
  • Handle like click in Fragment
  • Handle like click in ViewModel
  • Create getLikedQuotes(): Flow<PagingData<Int, Quote>> in AllQuotesRepository
  • Create LikedQuotesFragment
  • Create LikedQuotesViewModel
  • Add liked quotes entry in the dashboard

Consider adding an additional layer for QuoteDAO aka DataSource

The main reason beyond this idea is to remove the necessity of manually passing an object of type QuoteOriginParams.
After having introduced the DataSource layer, a programmer can call specialized methods,
for instance quotesLocalDataSource.getRandomQuoteFlow.

Dashboard entry: add the last view `see more`

  • Prepare sealed class that encompasses 2 types: normal and seeMore
  • General the last item of type seeMore in the ViewModel
  • Prepare see more layout
  • Handle see more entry in ViewHolder
  • Add onClick listener that navigates to a separate screen containing all items of a particular type

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.