mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-31 13:33:28 +01:00 
			
		
		
		
	Add BG update toggle
This commit is contained in:
		| @@ -244,6 +244,8 @@ | |||||||
|    "appsPossiblyUpdated": "App Updates Attempted", |    "appsPossiblyUpdated": "App Updates Attempted", | ||||||
|    "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", |    "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", | ||||||
|    "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", |    "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", | ||||||
|  |    "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", | ||||||
|  |    "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|    "removeAppQuestion": { |    "removeAppQuestion": { | ||||||
|       "one": "Želite li ukloniti aplikaciju?", |       "one": "Želite li ukloniti aplikaciju?", | ||||||
|       "other": "Želite li ukloniti aplikacije?" |       "other": "Želite li ukloniti aplikacije?" | ||||||
|   | |||||||
| @@ -244,6 +244,8 @@ | |||||||
|     "appsPossiblyUpdated": "App Updates Attempted", |     "appsPossiblyUpdated": "App Updates Attempted", | ||||||
|     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", |     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", | ||||||
|     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", |     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", | ||||||
|  |     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", | ||||||
|  |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "App entfernen?", |         "one": "App entfernen?", | ||||||
|         "other": "Apps entfernen?" |         "other": "Apps entfernen?" | ||||||
|   | |||||||
| @@ -244,6 +244,9 @@ | |||||||
|     "appsPossiblyUpdated": "App Updates Attempted", |     "appsPossiblyUpdated": "App Updates Attempted", | ||||||
|     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", |     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", | ||||||
|     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", |     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", | ||||||
|  |     "enableBackgroundUpdates": "Enable background updates", | ||||||
|  |     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", | ||||||
|  |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Remove App?", |         "one": "Remove App?", | ||||||
|         "other": "Remove Apps?" |         "other": "Remove Apps?" | ||||||
|   | |||||||
| @@ -244,6 +244,8 @@ | |||||||
|     "appsPossiblyUpdated": "App Updates Attempted", |     "appsPossiblyUpdated": "App Updates Attempted", | ||||||
|     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", |     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", | ||||||
|     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", |     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", | ||||||
|  |     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", | ||||||
|  |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "¿Eliminar Aplicación?", |         "one": "¿Eliminar Aplicación?", | ||||||
|         "other": "¿Eliminar Aplicaciones?" |         "other": "¿Eliminar Aplicaciones?" | ||||||
|   | |||||||
| @@ -244,6 +244,8 @@ | |||||||
|     "appsPossiblyUpdated": "App Updates Attempted", |     "appsPossiblyUpdated": "App Updates Attempted", | ||||||
|     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", |     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", | ||||||
|     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", |     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", | ||||||
|  |     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", | ||||||
|  |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "برنامه حذف شود؟", |         "one": "برنامه حذف شود؟", | ||||||
|         "other": "برنامه ها حذف شوند؟" |         "other": "برنامه ها حذف شوند؟" | ||||||
|   | |||||||
| @@ -244,6 +244,8 @@ | |||||||
|     "appsPossiblyUpdated": "App Updates Attempted", |     "appsPossiblyUpdated": "App Updates Attempted", | ||||||
|     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", |     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", | ||||||
|     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", |     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", | ||||||
|  |     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", | ||||||
|  |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Supprimer l'application ?", |         "one": "Supprimer l'application ?", | ||||||
|         "other": "Supprimer les applications ?" |         "other": "Supprimer les applications ?" | ||||||
|   | |||||||
| @@ -243,6 +243,8 @@ | |||||||
|     "appsPossiblyUpdated": "App Updates Attempted", |     "appsPossiblyUpdated": "App Updates Attempted", | ||||||
|     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", |     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", | ||||||
|     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", |     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", | ||||||
|  |     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", | ||||||
|  |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Eltávolítja az alkalmazást?", |         "one": "Eltávolítja az alkalmazást?", | ||||||
|         "other": "Eltávolítja az alkalmazást?" |         "other": "Eltávolítja az alkalmazást?" | ||||||
|   | |||||||
| @@ -244,6 +244,8 @@ | |||||||
|     "appsPossiblyUpdated": "App Updates Attempted", |     "appsPossiblyUpdated": "App Updates Attempted", | ||||||
|     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", |     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", | ||||||
|     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", |     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", | ||||||
|  |     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", | ||||||
|  |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Rimuovere l'app?", |         "one": "Rimuovere l'app?", | ||||||
|         "other": "Rimuovere le app?" |         "other": "Rimuovere le app?" | ||||||
|   | |||||||
| @@ -244,6 +244,8 @@ | |||||||
|     "appsPossiblyUpdated": "App Updates Attempted", |     "appsPossiblyUpdated": "App Updates Attempted", | ||||||
|     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", |     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", | ||||||
|     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", |     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", | ||||||
|  |     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", | ||||||
|  |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "アプリを削除しますか?", |         "one": "アプリを削除しますか?", | ||||||
|         "other": "アプリを削除しますか?" |         "other": "アプリを削除しますか?" | ||||||
|   | |||||||
| @@ -248,6 +248,8 @@ | |||||||
|     "appsPossiblyUpdated": "App Updates Attempted", |     "appsPossiblyUpdated": "App Updates Attempted", | ||||||
|     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", |     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", | ||||||
|     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", |     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", | ||||||
|  |     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", | ||||||
|  |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Usunąć aplikację?", |         "one": "Usunąć aplikację?", | ||||||
|         "other": "Usunąć aplikacje?" |         "other": "Usunąć aplikacje?" | ||||||
|   | |||||||
| @@ -244,6 +244,8 @@ | |||||||
|     "appsPossiblyUpdated": "App Updates Attempted", |     "appsPossiblyUpdated": "App Updates Attempted", | ||||||
|     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", |     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", | ||||||
|     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", |     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", | ||||||
|  |     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", | ||||||
|  |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Удалить приложение?", |         "one": "Удалить приложение?", | ||||||
|         "other": "Удалить приложения?" |         "other": "Удалить приложения?" | ||||||
|   | |||||||
| @@ -244,6 +244,8 @@ | |||||||
|     "appsPossiblyUpdated": "App Updates Attempted", |     "appsPossiblyUpdated": "App Updates Attempted", | ||||||
|     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", |     "appsPossiblyUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were potentially applied in the background", | ||||||
|     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", |     "xWasPossiblyUpdatedToY": "{} may have been updated to {}.", | ||||||
|  |     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", | ||||||
|  |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "是否删除应用?", |         "one": "是否删除应用?", | ||||||
|         "other": "是否删除应用?" |         "other": "是否删除应用?" | ||||||
|   | |||||||
| @@ -1,3 +1,4 @@ | |||||||
|  | import 'package:device_info_plus/device_info_plus.dart'; | ||||||
| import 'package:easy_localization/easy_localization.dart'; | import 'package:easy_localization/easy_localization.dart'; | ||||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||||
| import 'package:obtainium/components/custom_app_bar.dart'; | import 'package:obtainium/components/custom_app_bar.dart'; | ||||||
| @@ -184,6 +185,10 @@ class _SettingsPageState extends State<SettingsPage> { | |||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|  |     const height8 = SizedBox( | ||||||
|  |       height: 8, | ||||||
|  |     ); | ||||||
|  |  | ||||||
|     const height16 = SizedBox( |     const height16 = SizedBox( | ||||||
|       height: 16, |       height: 16, | ||||||
|     ); |     ); | ||||||
| @@ -211,6 +216,47 @@ class _SettingsPageState extends State<SettingsPage> { | |||||||
|                                   color: Theme.of(context).colorScheme.primary), |                                   color: Theme.of(context).colorScheme.primary), | ||||||
|                             ), |                             ), | ||||||
|                             intervalDropdown, |                             intervalDropdown, | ||||||
|  |                             FutureBuilder( | ||||||
|  |                                 builder: (ctx, val) { | ||||||
|  |                                   return (val.data?.version.sdkInt ?? 0) >= 30 | ||||||
|  |                                       ? Column( | ||||||
|  |                                           crossAxisAlignment: | ||||||
|  |                                               CrossAxisAlignment.start, | ||||||
|  |                                           children: [ | ||||||
|  |                                             height16, | ||||||
|  |                                             Row( | ||||||
|  |                                               mainAxisAlignment: | ||||||
|  |                                                   MainAxisAlignment | ||||||
|  |                                                       .spaceBetween, | ||||||
|  |                                               children: [ | ||||||
|  |                                                 Flexible( | ||||||
|  |                                                     child: Text(tr( | ||||||
|  |                                                         'enableBackgroundUpdates'))), | ||||||
|  |                                                 Switch( | ||||||
|  |                                                     value: settingsProvider | ||||||
|  |                                                         .enableBackgroundUpdates, | ||||||
|  |                                                     onChanged: (value) { | ||||||
|  |                                                       settingsProvider | ||||||
|  |                                                               .enableBackgroundUpdates = | ||||||
|  |                                                           value; | ||||||
|  |                                                     }) | ||||||
|  |                                               ], | ||||||
|  |                                             ), | ||||||
|  |                                             height8, | ||||||
|  |                                             Text(tr('backgroundUpdateReqsExplanation'), | ||||||
|  |                                                 style: Theme.of(context) | ||||||
|  |                                                     .textTheme | ||||||
|  |                                                     .labelSmall), | ||||||
|  |                                             Text(tr('backgroundUpdateLimitsExplanation'), | ||||||
|  |                                                 style: Theme.of(context) | ||||||
|  |                                                     .textTheme | ||||||
|  |                                                     .labelSmall), | ||||||
|  |                                             height8 | ||||||
|  |                                           ], | ||||||
|  |                                         ) | ||||||
|  |                                       : const SizedBox.shrink(); | ||||||
|  |                                 }, | ||||||
|  |                                 future: DeviceInfoPlugin().androidInfo), | ||||||
|                             height16, |                             height16, | ||||||
|                             Row( |                             Row( | ||||||
|                               mainAxisAlignment: MainAxisAlignment.spaceBetween, |                               mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||||||
|   | |||||||
| @@ -309,4 +309,13 @@ class SettingsProvider with ChangeNotifier { | |||||||
|     prefs?.setBool('reversePageTransitions', show); |     prefs?.setBool('reversePageTransitions', show); | ||||||
|     notifyListeners(); |     notifyListeners(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   bool get enableBackgroundUpdates { | ||||||
|  |     return prefs?.getBool('enableBackgroundUpdates') ?? true; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   set enableBackgroundUpdates(bool val) { | ||||||
|  |     prefs?.setBool('enableBackgroundUpdates', val); | ||||||
|  |     notifyListeners(); | ||||||
|  |   } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user