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

Feature/cache detail #58

Merged
merged 8 commits into from
May 15, 2024
Merged

Feature/cache detail #58

merged 8 commits into from
May 15, 2024

Conversation

hadi-norouzi
Copy link
Collaborator

@hadi-norouzi hadi-norouzi commented May 1, 2024

Description

Cache permanent movie details in the Room database.

Checklist

  • Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the linter (code style) passes
  • Appropriate docs were updated (if necessary)

Fixes #56

@hadi-norouzi hadi-norouzi requested a review from moallemi May 1, 2024 16:57
@moallemi
Copy link
Owner

moallemi commented May 8, 2024

@hadi-norouzi let me know when your PR is ready for review

Comment on lines +7 to +16
@TypeConverter
fun stringToList(stringList: String): List<String> {
return stringList.split(",")
}

@TypeConverter
fun listToString(list: List<String>): String {
return list.joinToString(",")
}
}
Copy link
Owner

Choose a reason for hiding this comment

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

It may seem like I'm splitting hairs, but this approach has some corner cases. e.g: You try to store

listOf("A,B", "C", "D")

and you restore as:

listOf("A", "B", "C", "D")

No need to change it right now.

is Success -> {
_state.update { state ->
state.copy(videoDetail = result.data, isLoading = false)
_state.update { it.copy(isLoading = true) }
Copy link
Owner

Choose a reason for hiding this comment

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

there is a known bug here that we should reset error as well. otherwise our offline implementation does not work well.

Suggested change
_state.update { it.copy(isLoading = true) }
_state.update { it.copy(isLoading = true, error = null) }

@hadi-norouzi hadi-norouzi self-assigned this May 15, 2024
@hadi-norouzi
Copy link
Collaborator Author

@hadi-norouzi let me know when your PR is ready for review

It's completed.

@moallemi moallemi merged commit b8deb99 into dev May 15, 2024
1 check passed
@moallemi moallemi deleted the feature/cache-detail branch May 15, 2024 19:17
This pull request was closed.
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.

[FR]: Cache movie details in local database
2 participants