Skip to content

Commit

Permalink
Save the date when the language is changed (#5443)
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k committed Jul 4, 2024
1 parent b2fbb75 commit ca749bc
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class UserPreferences extends ChangeNotifier {
static const String _TAG_CURRENT_COLOR_SCHEME = 'currentColorScheme';
static const String _TAG_CURRENT_CONTRAST_MODE = 'contrastMode';
static const String _TAG_USER_COUNTRY_CODE = 'userCountry';
static const String _TAG_USER_COUNTRY_CODE_LAST_UPDATE =
'userCountryLastUpdate';
static const String _TAG_USER_CURRENCY_CODE = 'userCurrency';
static const String _TAG_LAST_VISITED_ONBOARDING_PAGE =
'lastVisitedOnboardingPage';
Expand Down Expand Up @@ -227,6 +229,10 @@ class UserPreferences extends ChangeNotifier {
/// Please use [ProductQuery.setCountry] as interface
Future<void> setUserCountryCode(final String countryCode) async {
await _sharedPreferences.setString(_TAG_USER_COUNTRY_CODE, countryCode);
await _sharedPreferences.setInt(
_TAG_USER_COUNTRY_CODE_LAST_UPDATE,
DateTime.now().millisecondsSinceEpoch,
);
notifyListeners();
}

Expand Down

0 comments on commit ca749bc

Please sign in to comment.