Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors locale management in the Mosquito Alert app by consolidating language and country code operations into a single setLocale method. The changes improve API design by accepting a Locale object instead of separate string parameters, and centralize locale identifier handling for the geocoding package.
Key changes:
- Consolidated
setLanguageandsetLanguageCountryinto a singlesetLocale(Locale)method - Moved locale identifier management for geocoding into
UserManager - Removed deprecated
getUserLocalemethod and its usage
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/utils/UserManager.dart | Added setLocale method that accepts a Locale object and handles locale identifier setup; made original setter methods private; removed getUserLocale method |
| lib/pages/settings_pages/settings_page.dart | Updated to call setLocale with a Locale object instead of separate setLanguage and setLanguageCountry calls |
| lib/pages/my_reports_pages/detail/shared_report_widgets.dart | Removed manual locale identifier setup since it's now handled in UserManager.setLocale |
|
|
||
| final String localeIdentifier = | ||
| countryCode != null ? '${languageCode}_$countryCode' : languageCode; | ||
| await setLocaleIdentifier(localeIdentifier); // From geolocator. |
There was a problem hiding this comment.
Corrected comment from 'geolocator' to 'geocoding' - the import at line 3 is package:geocoding/geocoding.dart, not geolocator.
| await setLocaleIdentifier(localeIdentifier); // From geolocator. | |
| await setLocaleIdentifier(localeIdentifier); // Set locale identifier. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #644 +/- ##
==========================================
+ Coverage 25.45% 25.66% +0.20%
==========================================
Files 25 25
Lines 1662 1664 +2
==========================================
+ Hits 423 427 +4
+ Misses 1239 1237 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
No description provided.