-
Notifications
You must be signed in to change notification settings - Fork 7
Use api v2 #1173
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
base: main
Are you sure you want to change the base?
Use api v2 #1173
Conversation
ba24658 to
4082446
Compare
|
When running this branch on a fresh simulator (e.g. because I finally updated Xcode 😅 ), you can't really open the app; you keep getting a 404 popup on Android where you can only hit "Try again", and on iOS, the build pauses in Xcode and you can't continue. We can fix this sometime in the future, it's more of a note to myself in the future: Switch to main, choose a profession, you can switch back to this branch then. |
899f8fb to
881a419
Compare
|
Still to do:
|
To make it possible to test with a local cms server
This will prevent an old `cmsOverwrite` value from being kept after updating the app
This commit leaves most of the implementation in tact, so that we can reuse parts of it should we decide to re-add this feature. However, users will not be able to interact with it anymore
* Add `CmsApi` service and switch the words endpoint * Dont store `id` field of images The new API does not deliver an `id` field and it was also not used in the code at all. * Mark types in `migrate1To2` as incomplete to signify intent
* Rename professions to jobs to match the new cms terminology * Remove the distinction between `ScopeSelection` and `JobSelection` The new api has no concept of job categories anymore, so instead we will want to list all jobs on the same screen in the future - Remove `JobSelection` - Rename the old `ScopeSelectionScreen` to `JobSelection` * labels: rename `manageSelection` to `manageJobs` * use new api in JobSelection TODO: combine `JobSelection` and `FilteredJobList` - Add new CmsApi service for all api calls - Add hook to load all jobs - Update `JobSelection` to use the new hook and get rid of the root level disciplines * use new api in JobCard * use new api in SelectionItem
The api v2 now returnes an array of images, instead of a single image
- Add new api endpoint in `CmsApi.ts` - Move the model to `models/sponsor.ts`
* Rename DisciplineSelectionScreen to UnitSelectionScreen, to match the new naming convention
* Add endpoints for units of jobs and words of units
Also updates the model of units, which lead to some further changes:
- Rename more instances of `Discipline` to either `Job` or `Unit`
- Create Unit model in new directory model/unit.ts
- Differentiate between standard units and user vocabulary units in the type system, so that the ids cannot be mixed up anymore accidentally
- This uncovered some bugs where ids of standard units and user vocabulary units got mixed up!
- For example, in user vocabulary exercises, progress is ignored. However, it still got updated and would have changed standard units with the same id.
- Migrate hooks still using the old api
- Add hook to load units
- Make `useReadProgress` async, because the api no longer sends out units of jobs
* Rename `title` to `jobTitle` in `NextExerciseData` for clarification
* Migrate `useLoadVocabularyItems`
* Simplify ExercisesParams
This gets rid of a few unused parameters and makes the code easier to read
* Remove some hooks that are now unused
* Fix type of `VocabularyItemType`
technically not relevant for this pr, but its a small fix
* Fix duplicateKeyWarning in `FavoritesScreen`
Not 100% sure what the exact problem was, might be caused by `FavoriteItem` not assigning a key if the data haven't loaded yet.
Instead, I just use a keyExtractor on the list
* Migrate feedback to new api - Add endpoint to `CmsAPI.ts` - Add feedback model - Fix bug where it was possible to create feedback about user vocabulary & units
* Remove filtered job search list Now that there are no more groups of professions, there is no reason to not use the normal job list when searching. This also improves the UI. Also remove the now unused function to split text
* Move `VocabularyItem` to the model directory * Refactor id of `VocabularyItem` Instead of storing `id`, `type` and `apiKey` in the object, we will now move these fields into a new type `VocabularyItemId`. The advantage is that we now have a type-safe way of working with `VocabularyItem`s without confusion about where it came from. - No feedback about protected vocabulary - no wrong type in api - no more wrong keys in list items - easier conversion from vocabulary items to favorites
f61553b to
ab6b8d9
Compare
Short Description
Draft to switch to the v2 api of the cms. Should not be merged before api v2 is available in the production cms.
This pr will hold all the changes to the api endpoints and will only be ready to merge when every endpoint is migrated.
Proposed Changes
Side Effects
Testing
Resolved Issues
Fixes: #1141