mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-31 05:23:28 +01:00 
			
		
		
		
	Fix translation error in BG check task
This commit is contained in:
		| @@ -16,17 +16,49 @@ import 'package:dynamic_color/dynamic_color.dart'; | |||||||
| import 'package:device_info_plus/device_info_plus.dart'; | import 'package:device_info_plus/device_info_plus.dart'; | ||||||
| import 'package:android_alarm_manager_plus/android_alarm_manager_plus.dart'; | import 'package:android_alarm_manager_plus/android_alarm_manager_plus.dart'; | ||||||
| import 'package:easy_localization/easy_localization.dart'; | import 'package:easy_localization/easy_localization.dart'; | ||||||
|  | // ignore: implementation_imports | ||||||
|  | import 'package:easy_localization/src/easy_localization_controller.dart'; | ||||||
|  | // ignore: implementation_imports | ||||||
|  | import 'package:easy_localization/src/localization.dart'; | ||||||
|  |  | ||||||
| const String currentVersion = '0.8.4'; | const String currentVersion = '0.8.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 | ||||||
|  |  | ||||||
| const int bgUpdateCheckAlarmId = 666; | const int bgUpdateCheckAlarmId = 666; | ||||||
|  |  | ||||||
|  | const supportedLocales = [Locale('en')]; | ||||||
|  | const fallbackLocale = Locale('en'); | ||||||
|  | const localeDir = 'assets/translations'; | ||||||
|  |  | ||||||
|  | Future<void> loadTranslations() async { | ||||||
|  |   // See easy_localization/issues/210 | ||||||
|  |   await EasyLocalizationController.initEasyLocation(); | ||||||
|  |   final controller = EasyLocalizationController( | ||||||
|  |     saveLocale: true, | ||||||
|  |     fallbackLocale: fallbackLocale, | ||||||
|  |     supportedLocales: supportedLocales, | ||||||
|  |     assetLoader: const RootBundleAssetLoader(), | ||||||
|  |     useOnlyLangCode: false, | ||||||
|  |     useFallbackTranslations: true, | ||||||
|  |     path: localeDir, | ||||||
|  |     onLoadError: (FlutterError e) { | ||||||
|  |       throw e; | ||||||
|  |     }, | ||||||
|  |   ); | ||||||
|  |   await controller.loadTranslations(); | ||||||
|  |   Localization.load(controller.locale, | ||||||
|  |       translations: controller.translations, | ||||||
|  |       fallbackTranslations: controller.fallbackTranslations); | ||||||
|  | } | ||||||
|  |  | ||||||
| @pragma('vm:entry-point') | @pragma('vm:entry-point') | ||||||
| Future<void> bgUpdateCheck(int taskId, Map<String, dynamic>? params) async { | Future<void> bgUpdateCheck(int taskId, Map<String, dynamic>? params) async { | ||||||
|   WidgetsFlutterBinding.ensureInitialized(); |   WidgetsFlutterBinding.ensureInitialized(); | ||||||
|   await EasyLocalization.ensureInitialized(); |   await EasyLocalization.ensureInitialized(); | ||||||
|  |  | ||||||
|  |   await loadTranslations(); | ||||||
|  |  | ||||||
|   LogsProvider logs = LogsProvider(); |   LogsProvider logs = LogsProvider(); | ||||||
|   logs.add(tr('startedBgUpdateTask')); |   logs.add(tr('startedBgUpdateTask')); | ||||||
|   int? ignoreAfterMicroseconds = params?['ignoreAfterMicroseconds']; |   int? ignoreAfterMicroseconds = params?['ignoreAfterMicroseconds']; | ||||||
| @@ -116,9 +148,9 @@ void main() async { | |||||||
|       Provider(create: (context) => LogsProvider()) |       Provider(create: (context) => LogsProvider()) | ||||||
|     ], |     ], | ||||||
|     child: EasyLocalization( |     child: EasyLocalization( | ||||||
|         supportedLocales: const [Locale('en')], |         supportedLocales: supportedLocales, | ||||||
|         path: 'assets/translations', |         path: localeDir, | ||||||
|         fallbackLocale: const Locale('en'), |         fallbackLocale: fallbackLocale, | ||||||
|         child: const Obtainium()), |         child: const Obtainium()), | ||||||
|   )); |   )); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -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.8.4+67 # When changing this, update the tag in main() accordingly | version: 0.8.5+68 # 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' | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user