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: Recipes Search #9

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open

Conversation

MoatazBadawy
Copy link
Owner

@MoatazBadawy MoatazBadawy commented Aug 15, 2023

Created recipes search screen logic. Here's what code does.

Database Query:

  • The code starts with a database query using Room's @query annotation. This query retrieves recipes from a table based on a search query. The search query is used to filter recipes whose names contain the search query text.

Repository and Use Case:

  • The GetSearchRecipesUseCase class is responsible for providing a clean and isolated way to fetch search results. It takes a RecipesRepository instance and uses it to fetch recipes based on the search query.

ViewModel:

  • The ViewModel's init block starts the search process when the ViewModel is initialized.
  • The searchRecipes() function uses collectLatest to observe changes in the search query. When the query is not empty, it cancels any ongoing search job and launches a new search using the launchSearch() function. If the query is empty, the UI state is updated to show an empty list.
  • The launchSearch() function uses the getSearchRecipesUseCase to fetch search results and updates the UI state with the received recipes.
  • The onSearchQueryChanged() function is used to update the search query whenever the user types into the search box.
  • The onCleared() function is overridden to ensure that any ongoing search job is canceled when the ViewModel is cleared.
260607686-5e05bdff-a635-4bd2-a69f-6ee32981d2a5.mp4

@MoatazBadawy MoatazBadawy added the enhancement New feature or request label Aug 15, 2023
@MoatazBadawy MoatazBadawy self-assigned this Aug 15, 2023
@gitguardian
Copy link

gitguardian bot commented Aug 15, 2023

⚠️ GitGuardian has uncovered 4 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
7657697 Company Email Password 7a962be app/src/main/res/values-night/strings.xml View secret
7657697 Company Email Password 7a962be app/src/main/res/values/strings.xml View secret
7657697 Company Email Password cb44701 app/src/main/res/values-night/strings.xml View secret
7657697 Company Email Password cb44701 app/src/main/res/values/strings.xml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant