SSW.Rewards.Mobile
SSW.Rewards.Mobile copied to clipboard
♻️ Alerts need an abstraction
Cc: @zacharykeeping @AntPolkanov
Hi
Pain
I've noticed we're depending directly on App.Current.MainPage.DisplayAlert. There's an argument that we should use custom dialogs, but that aside, we need an abstraction for using system dialogs (e.g. IAlertService).
Using IAlertService an in ViewModels instead of directly calling App.Current.MainPage.DisplayAlert promotes testability, separation of concerns, and better adherence to MVVM principles. It decouples the UI framework from the business logic, making it easier to mock alerts in unit tests and maintain cross-platform flexibility.
What code could be improved?
https://github.com/search?q=repo%3ASSWConsulting%2FSSW.Rewards.Mobile%20App.Current.MainPage.DisplayAlert&type=code
Tasks
- [ ] Create the abstraction
- [ ] Replace all instances of
App.Current.MainPage.DisplayAlertwith calls to the service
Acceptance Criteria
- [ ] Meets Definition of Done - https://github.com/SSWConsulting/SSW.Rewards.Mobile/blob/main/_docs/Definition-of-Done.md
- [ ] Code is testable
Thanks!