SSW.Rewards.Mobile icon indicating copy to clipboard operation
SSW.Rewards.Mobile copied to clipboard

♻️ Alerts need an abstraction

Open matt-goldman-ssw opened this issue 1 year ago • 0 comments

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.DisplayAlert with 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!

matt-goldman-ssw avatar Oct 23 '24 22:10 matt-goldman-ssw