mirror of
https://github.com/pachli/pachli-android.git
synced 2025-02-02 18:37:00 +01:00
442f3bc80c
Previously to view a list the user either had to add it to a tab, or tap through "Lists" in the navigation menu to their list of lists, and then tap the list they want. Fix that, and show all their lists in a dedicated section in the menu, with a new "Manage lists" entry that's functionality identical to the old "Lists" entry (i.e., it shows their lists and allows them to create, delete, and edit list settings). To do that: - Implement a proper `ListsRepository` as the single source of truth for list implementation throughout the app. Expose the current list of lists as a flow, with methods to perform operations on the lists. - Collect the `ListsRepository` flow in `MainActivity` and use that to populate the menu and update it whenever the user's lists change. - Rewrite the activities and fragments that manipulate lists to use `ListRepository`. - Always show error snackbars when list operations fail. In particular, the HTTP code and error are always shown. - Delete the custom `Either` implementation, it's no longer used. - Add types for modelling API responses and errors, `ApiResponse` and `ApiError` respectively. The response includes the headers as well as the body, so it can replace the use of `NetworkResult` and `Response`. The actual result of the operation is expected to be carried in a `com.github.michaelbull.result.Result` type. Implement a Retrofit call adapter for these types. Unit tests for these borrow heavily from https://github.com/connyduck/networkresult-calladapter Additional user-visible changes: - Add an accessible "Refresh" menu item to `ListsActivity`. - Adding a list to a tab has a dialog with a "Manage lists" option. Previously that would close the dialog when clicked, so the user had to re-open it on returning from list management. Now the dialog stays open. - The soft keyboard automatically opens when creating or editing a list.