Compare commits

...

2 Commits

Author SHA1 Message Date
Imran Remtulla
57f7bf44c2 Merge pull request #335 from ImranR98/dev
Language bugfix + package upgrades + incr. ver.
2023-02-27 19:01:20 -05:00
Imran Remtulla
ce526d8d26 Language bugfix + package upgrades + incr. ver. 2023-02-27 19:00:50 -05:00
5 changed files with 24 additions and 5 deletions

View File

@@ -21,7 +21,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
// ignore: implementation_imports // ignore: implementation_imports
import 'package:easy_localization/src/localization.dart'; import 'package:easy_localization/src/localization.dart';
const String currentVersion = '0.11.4'; const String currentVersion = '0.11.5';
const String currentReleaseTag = const String currentReleaseTag =
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES 'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
@@ -211,6 +211,14 @@ class _ObtainiumState extends State<Obtainium> {
false) false)
]); ]);
} }
if (!supportedLocales
.map((e) => e.languageCode)
.contains(context.locale.languageCode) ||
settingsProvider.forcedLocale == null &&
context.deviceLocale.languageCode !=
context.locale.languageCode) {
settingsProvider.resetLocaleSafe(context);
}
// Register the background update task according to the user's setting // Register the background update task according to the user's setting
if (existingUpdateInterval != settingsProvider.updateInterval) { if (existingUpdateInterval != settingsProvider.updateInterval) {
if (existingUpdateInterval != -1) { if (existingUpdateInterval != -1) {

View File

@@ -152,7 +152,7 @@ class _SettingsPageState extends State<SettingsPage> {
if (value != null) { if (value != null) {
context.setLocale(Locale(value)); context.setLocale(Locale(value));
} else { } else {
context.resetLocale(); settingsProvider.resetLocaleSafe(context);
} }
}); });

View File

@@ -178,4 +178,15 @@ class SettingsProvider with ChangeNotifier {
bool setEqual(Set<String> a, Set<String> b) => bool setEqual(Set<String> a, Set<String> b) =>
a.length == b.length && a.union(b).length == a.length; a.length == b.length && a.union(b).length == a.length;
void resetLocaleSafe(BuildContext context) {
if (context.supportedLocales
.map((e) => e.languageCode)
.contains(context.deviceLocale.languageCode)) {
context.resetLocale();
} else {
context.setLocale(context.fallbackLocale!);
context.deleteSaveLocale();
}
}
} }

View File

@@ -670,10 +670,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: sqflite name: sqflite
sha256: "78324387dc81df14f78df06019175a86a2ee0437624166c382e145d0a7fd9a4f" sha256: "851d5040552cf911f4cabda08d003eca76b27da3ed0002978272e27c8fbf8ecc"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.4+1" version: "2.2.5"
sqflite_common: sqflite_common:
dependency: transitive dependency: transitive
description: description:

View File

@@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 0.11.4+123 # When changing this, update the tag in main() accordingly version: 0.11.5+124 # When changing this, update the tag in main() accordingly
environment: environment:
sdk: '>=2.18.2 <3.0.0' sdk: '>=2.18.2 <3.0.0'