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

LUN-420: User vocabulary can be marked as favorite #371

Merged
merged 7 commits into from
Oct 24, 2022

Conversation

ztefanie
Copy link
Member

@ztefanie ztefanie commented Sep 21, 2022

This pull request belongs to an issue on our bugtracker.
You can find it there by looking for an issue with the key which is mentioned in the title of this pull request.
It starts with the keyword LUN.

@steffenkleinle @f1sh1918
When marking user-vocabulary as favorite, we have the problem, that we cannot just save the id, as this id is also an id of a lunes-standard vocab. Same problem for dicitionary, where we want to show user-vocabulary in the future. I thought about different solutions:

  1. The one in this PR: For documents we save the type (lunes-standard, lunes-protected, or user-created)
  2. We could save two array with id's to AsyncStorage (e.g. lunes-favorites and user-created-favorites), but I think this is not a good idea, as we need to know and check everywhere (e.g. in an exercise or in the dictionary) if the word that is marked as a favorite, is lunes-standard or user-created.
  3. We could somehow modify the id, like "lunes-standard-421" and "user-created-5", but I think this es even worse, as it is hard to check, if value are valid and also hard to filter, e.g. all favorites, that are user-created and need different loading-handling.

I will go on implementing this feature, if you think my suggested solution is the one we want to use.

As these first changes have been approved, I finished this ticket.

  • I also replaced manual document building in some tests, with the document-builder-helper we have.
  • Renamed the routing for VocabularyDetail, as it was named "DictionaryDetail" previously, but was used in UserVocabulary and Favorites, too.
  • Renamed VocabularyDetailScreen to VocabularyDetailExerciseScreen, as this naming was duplicated.

@ztefanie
Copy link
Member Author

@steffenkleinle @f1sh1918 (see comment above, i think ping does not work in description)

@f1sh1918
Copy link
Contributor

i'm fine with solution 1

@steffenkleinle
Copy link
Member

Same for me, solution 1 works for me.

@ztefanie ztefanie marked this pull request as ready for review October 17, 2022 11:41
@ztefanie ztefanie changed the title LUN-420: Add document type LUN-420: User vocabulary can be marked as favorite Oct 17, 2022
@ztefanie ztefanie force-pushed the LUN-420-user-vocabulary-can-be-marked-as-favorite branch from 2220726 to 2fa8c3d Compare October 17, 2022 11:50
Copy link
Member

@steffenkleinle steffenkleinle left a comment

Choose a reason for hiding this comment

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

Tested on android, nice work!

src/services/AsyncStorage.ts Show resolved Hide resolved
src/components/FavoriteButton.tsx Show resolved Hide resolved
src/constants/data.ts Outdated Show resolved Hide resolved
@@ -0,0 +1,62 @@
import { RouteProp, useFocusEffect } from '@react-navigation/native'
Copy link
Member

Choose a reason for hiding this comment

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

I don't want to open the discussion on this place again but I really dislike the moving and renaming to/from route folders 🙈 Makes it very hard to review changes since only small changes at the same time with renaming lead to github showing the file as deleted and added. Still a fan of the integreat way of just putting everything in the same folder and just prefixing it with the route name if necessary.

Copy link
Member

Choose a reason for hiding this comment

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

Not really reviewed/compared to previous

Copy link
Member Author

Choose a reason for hiding this comment

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

Not having a folder structur is really bad practice, but I see your point though. I think it would make sense to put every route in a subfolder also it they do no have components yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

i agree with Steffi in this case. We may add a guideline for naming & structuring of components/routes and stick to them. Sure once you move it its a pain to review but after having a clear structure this shouldn't happen. I also support structures like baseComponents Text/Buttons/TextInput etc. I think finding components and routes in integreat is quite a pain

src/routes/favorites/FavoritesScreen.tsx Outdated Show resolved Hide resolved
src/hooks/useLoadFavorite.ts Outdated Show resolved Hide resolved
src/hooks/useLoadFavorite.ts Outdated Show resolved Hide resolved
Copy link
Member

@steffenkleinle steffenkleinle left a comment

Choose a reason for hiding this comment

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

The favorite icon of protected vocabulary is not displayed as marked as favorite, also in details view, but displayed in the favorites list.

@steffenkleinle
Copy link
Member

Is this done with this PR? https://issues.tuerantuer.org/browse/LUN-307

@ztefanie
Copy link
Member Author

The favorite icon of protected vocabulary is not displayed as marked as favorite, also in details view, but displayed in the favorites list.

Was broken before. Can not be fixed by us, as the api-endpoint is missing the feature do return protected words. Already opend a ticket.

@ztefanie
Copy link
Member Author

Is this done with this PR? https://issues.tuerantuer.org/browse/LUN-307

This was already done here: #307

Copy link
Contributor

@f1sh1918 f1sh1918 left a comment

Choose a reason for hiding this comment

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

Works fine on ios nice work! Even i have problems with the image path on ios emulators. but on real devices it works fine

src/routes/favorites/FavoritesScreen.tsx Show resolved Hide resolved
src/routes/user-vocabulary-list/components/ListItem.tsx Outdated Show resolved Hide resolved
@ztefanie ztefanie enabled auto-merge October 24, 2022 06:26
@ztefanie ztefanie merged commit df025a6 into main Oct 24, 2022
@ztefanie ztefanie deleted the LUN-420-user-vocabulary-can-be-marked-as-favorite branch October 24, 2022 06:42
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.

3 participants