openedx / openedx-app-ios

The mobile app for iOS for the Open EdX Platform.
Apache License 2.0
19 stars 13 forks source link

[iOS] Unification of Navigation Titles and Error Message Handling Across Multiple Views #443

Open IvanStepanok opened 1 month ago

IvanStepanok commented 1 month ago

We have identified repetitive implementations of navigation titles and error message handling across multiple views in our project. This redundancy makes the codebase harder to maintain and less consistent. Specifically, the navigation titles are repeatedly defined in VideoDownloadQualityView, SignUpView, SettingsView, ManageAccountView, VideoSettingsView, and VideoQualityView. Additionally, the SnackBarView(message: viewModel.errorMessage) is used across various screens for error messaging but lacks a unified implementation.

To address this, I propose creating reusable components for navigation titles and error message handling. This would involve:

Implementing a NavigationTitle component that can be reused across all views requiring a navigation title. Implementing a SnackBarView component for consistent error message display across the application. Refactoring the views (VideoDownloadQualityView, SignUpView, SettingsView, ManageAccountView, VideoSettingsView, VideoQualityView) to use these new components. This unification will lead to a more maintainable and consistent codebase.

An alternative would be to continue with the current implementation, making individual changes to navigation titles and error messages as needed. However, this approach is not scalable and would result in further code duplication and inconsistencies.

I've already done similar unification in a previous pull request: PR #439, where I created ErrorAlertView and NavigationTitle components. We can reuse these components for this unification effort.