mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-30 04:53:28 +01:00 
			
		
		
		
	WiFi only BG update toggle (#819) + typo fix
This commit is contained in:
		| @@ -247,7 +247,8 @@ | |||||||
|    "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", |    "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.", |    "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|    "verifyLatestTag": "Verify the 'latest' tag", |    "verifyLatestTag": "Verify the 'latest' tag", | ||||||
|    "examptFromBackgroundUpdates": "Exempt from background updates (if enabled)", |    "exemptFromBackgroundUpdates": "Exempt from background updates (if enabled)", | ||||||
|  |    "bgUpdatesOnWiFiOnly": "Disable background updates when not on WiFi", | ||||||
|    "removeAppQuestion": { |    "removeAppQuestion": { | ||||||
|       "one": "Želite li ukloniti aplikaciju?", |       "one": "Želite li ukloniti aplikaciju?", | ||||||
|       "other": "Želite li ukloniti aplikacije?" |       "other": "Želite li ukloniti aplikacije?" | ||||||
|   | |||||||
| @@ -247,7 +247,8 @@ | |||||||
|     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", |     "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.", |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "verifyLatestTag": "Verify the 'latest' tag", |     "verifyLatestTag": "Verify the 'latest' tag", | ||||||
|     "examptFromBackgroundUpdates": "Exempt from background updates (if enabled)", |     "exemptFromBackgroundUpdates": "Exempt from background updates (if enabled)", | ||||||
|  |     "bgUpdatesOnWiFiOnly": "Disable background updates when not on WiFi", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "App entfernen?", |         "one": "App entfernen?", | ||||||
|         "other": "Apps entfernen?" |         "other": "Apps entfernen?" | ||||||
|   | |||||||
| @@ -250,7 +250,8 @@ | |||||||
|     "verifyLatestTag": "Verify the 'latest' tag", |     "verifyLatestTag": "Verify the 'latest' tag", | ||||||
|     "intermediateLinkRegex": "Filter for an 'Intermediate' Link to Visit First", |     "intermediateLinkRegex": "Filter for an 'Intermediate' Link to Visit First", | ||||||
|     "intermediateLinkNotFound": "Intermediate link not found", |     "intermediateLinkNotFound": "Intermediate link not found", | ||||||
|     "examptFromBackgroundUpdates": "Exempt from background updates (if enabled)", |     "exemptFromBackgroundUpdates": "Exempt from background updates (if enabled)", | ||||||
|  |     "bgUpdatesOnWiFiOnly": "Disable background updates when not on WiFi", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Remove App?", |         "one": "Remove App?", | ||||||
|         "other": "Remove Apps?" |         "other": "Remove Apps?" | ||||||
|   | |||||||
| @@ -247,7 +247,8 @@ | |||||||
|     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", |     "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.", |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "verifyLatestTag": "Verify the 'latest' tag", |     "verifyLatestTag": "Verify the 'latest' tag", | ||||||
|     "examptFromBackgroundUpdates": "Exempt from background updates (if enabled)", |     "exemptFromBackgroundUpdates": "Exempt from background updates (if enabled)", | ||||||
|  |     "bgUpdatesOnWiFiOnly": "Disable background updates when not on WiFi", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "¿Eliminar Aplicación?", |         "one": "¿Eliminar Aplicación?", | ||||||
|         "other": "¿Eliminar Aplicaciones?" |         "other": "¿Eliminar Aplicaciones?" | ||||||
|   | |||||||
| @@ -247,7 +247,8 @@ | |||||||
|     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", |     "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.", |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "verifyLatestTag": "Verify the 'latest' tag", |     "verifyLatestTag": "Verify the 'latest' tag", | ||||||
|     "examptFromBackgroundUpdates": "Exempt from background updates (if enabled)", |     "exemptFromBackgroundUpdates": "Exempt from background updates (if enabled)", | ||||||
|  |     "bgUpdatesOnWiFiOnly": "Disable background updates when not on WiFi", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "برنامه حذف شود؟", |         "one": "برنامه حذف شود؟", | ||||||
|         "other": "برنامه ها حذف شوند؟" |         "other": "برنامه ها حذف شوند؟" | ||||||
|   | |||||||
| @@ -247,7 +247,8 @@ | |||||||
|     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", |     "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.", |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "verifyLatestTag": "Verify the 'latest' tag", |     "verifyLatestTag": "Verify the 'latest' tag", | ||||||
|     "examptFromBackgroundUpdates": "Exempt from background updates (if enabled)", |     "exemptFromBackgroundUpdates": "Exempt from background updates (if enabled)", | ||||||
|  |     "bgUpdatesOnWiFiOnly": "Disable background updates when not on WiFi", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Supprimer l'application ?", |         "one": "Supprimer l'application ?", | ||||||
|         "other": "Supprimer les applications ?" |         "other": "Supprimer les applications ?" | ||||||
|   | |||||||
| @@ -246,7 +246,8 @@ | |||||||
|     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", |     "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.", |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "verifyLatestTag": "Verify the 'latest' tag", |     "verifyLatestTag": "Verify the 'latest' tag", | ||||||
|     "examptFromBackgroundUpdates": "Exempt from background updates (if enabled)", |     "exemptFromBackgroundUpdates": "Exempt from background updates (if enabled)", | ||||||
|  |     "bgUpdatesOnWiFiOnly": "Disable background updates when not on WiFi", | ||||||
|     "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?" | ||||||
|   | |||||||
| @@ -247,7 +247,8 @@ | |||||||
|     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", |     "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.", |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "verifyLatestTag": "Verify the 'latest' tag", |     "verifyLatestTag": "Verify the 'latest' tag", | ||||||
|     "examptFromBackgroundUpdates": "Exempt from background updates (if enabled)", |     "exemptFromBackgroundUpdates": "Exempt from background updates (if enabled)", | ||||||
|  |     "bgUpdatesOnWiFiOnly": "Disable background updates when not on WiFi", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Rimuovere l'app?", |         "one": "Rimuovere l'app?", | ||||||
|         "other": "Rimuovere le app?" |         "other": "Rimuovere le app?" | ||||||
|   | |||||||
| @@ -248,7 +248,8 @@ | |||||||
|     "backgroundUpdateReqsExplanation": "バックグラウンドアップデートは、すべてのアプリで可能とは限りません。", |     "backgroundUpdateReqsExplanation": "バックグラウンドアップデートは、すべてのアプリで可能とは限りません。", | ||||||
|     "backgroundUpdateLimitsExplanation": "バックグラウンドアップデートが成功したかどうかは、Obtainiumを起動したときにしか判断できません。", |     "backgroundUpdateLimitsExplanation": "バックグラウンドアップデートが成功したかどうかは、Obtainiumを起動したときにしか判断できません。", | ||||||
|     "verifyLatestTag": "'latest'タグを確認する", |     "verifyLatestTag": "'latest'タグを確認する", | ||||||
|     "examptFromBackgroundUpdates": "Exempt from background updates (if enabled)", |     "exemptFromBackgroundUpdates": "Exempt from background updates (if enabled)", | ||||||
|  |     "bgUpdatesOnWiFiOnly": "Disable background updates when not on WiFi", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "アプリを削除しますか?", |         "one": "アプリを削除しますか?", | ||||||
|         "other": "アプリを削除しますか?" |         "other": "アプリを削除しますか?" | ||||||
|   | |||||||
| @@ -253,7 +253,8 @@ | |||||||
|     "backgroundUpdateReqsExplanation": "Aktualizacje w tle mogą nie być możliwe dla wszystkich aplikacji.", |     "backgroundUpdateReqsExplanation": "Aktualizacje w tle mogą nie być możliwe dla wszystkich aplikacji.", | ||||||
|     "backgroundUpdateLimitsExplanation": "Powodzenie instalacji w tle można określić dopiero po otwarciu Obtainium.", |     "backgroundUpdateLimitsExplanation": "Powodzenie instalacji w tle można określić dopiero po otwarciu Obtainium.", | ||||||
|     "verifyLatestTag": "Zweryfikuj najnowszy tag", |     "verifyLatestTag": "Zweryfikuj najnowszy tag", | ||||||
|     "examptFromBackgroundUpdates": "Exempt from background updates (if enabled)", |     "exemptFromBackgroundUpdates": "Exempt from background updates (if enabled)", | ||||||
|  |     "bgUpdatesOnWiFiOnly": "Disable background updates when not on WiFi", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Usunąć aplikację?", |         "one": "Usunąć aplikację?", | ||||||
|         "few": "Usunąć aplikacje?", |         "few": "Usunąć aplikacje?", | ||||||
|   | |||||||
| @@ -247,7 +247,8 @@ | |||||||
|     "backgroundUpdateReqsExplanation": "Background updates may not be possible for all apps.", |     "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.", |     "backgroundUpdateLimitsExplanation": "The success of a background install can only be determined when Obtainium is opened.", | ||||||
|     "verifyLatestTag": "Verify the 'latest' tag", |     "verifyLatestTag": "Verify the 'latest' tag", | ||||||
|     "examptFromBackgroundUpdates": "Exempt from background updates (if enabled)", |     "exemptFromBackgroundUpdates": "Exempt from background updates (if enabled)", | ||||||
|  |     "bgUpdatesOnWiFiOnly": "Disable background updates when not on WiFi", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Удалить приложение?", |         "one": "Удалить приложение?", | ||||||
|         "other": "Удалить приложения?" |         "other": "Удалить приложения?" | ||||||
|   | |||||||
| @@ -247,8 +247,9 @@ | |||||||
|     "enableBackgroundUpdates": "启用后台更新", |     "enableBackgroundUpdates": "启用后台更新", | ||||||
|     "backgroundUpdateReqsExplanation": "后台更新未必适用于所有的应用。", |     "backgroundUpdateReqsExplanation": "后台更新未必适用于所有的应用。", | ||||||
|     "backgroundUpdateLimitsExplanation": "只有在启动 Obtainium 时才能确认安装是否成功。", |     "backgroundUpdateLimitsExplanation": "只有在启动 Obtainium 时才能确认安装是否成功。", | ||||||
|     "examptFromBackgroundUpdates": "Exempt from background updates (if enabled)", |  | ||||||
|     "verifyLatestTag": "验证“Latest”标签", |     "verifyLatestTag": "验证“Latest”标签", | ||||||
|  |     "exemptFromBackgroundUpdates": "Exempt from background updates (if enabled)", | ||||||
|  |     "bgUpdatesOnWiFiOnly": "Disable background updates when not on WiFi", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "是否删除应用?", |         "one": "是否删除应用?", | ||||||
|         "other": "是否删除应用?" |         "other": "是否删除应用?" | ||||||
|   | |||||||
| @@ -252,7 +252,32 @@ class _SettingsPageState extends State<SettingsPage> { | |||||||
|                                                 style: Theme.of(context) |                                                 style: Theme.of(context) | ||||||
|                                                     .textTheme |                                                     .textTheme | ||||||
|                                                     .labelSmall), |                                                     .labelSmall), | ||||||
|                                             height8 |                                             height8, | ||||||
|  |                                             if (settingsProvider | ||||||
|  |                                                 .enableBackgroundUpdates) | ||||||
|  |                                               Column( | ||||||
|  |                                                 children: [ | ||||||
|  |                                                   height16, | ||||||
|  |                                                   Row( | ||||||
|  |                                                     mainAxisAlignment: | ||||||
|  |                                                         MainAxisAlignment | ||||||
|  |                                                             .spaceBetween, | ||||||
|  |                                                     children: [ | ||||||
|  |                                                       Flexible( | ||||||
|  |                                                           child: Text(tr( | ||||||
|  |                                                               'bgUpdatesOnWiFiOnly'))), | ||||||
|  |                                                       Switch( | ||||||
|  |                                                           value: settingsProvider | ||||||
|  |                                                               .bgUpdatesOnWiFiOnly, | ||||||
|  |                                                           onChanged: (value) { | ||||||
|  |                                                             settingsProvider | ||||||
|  |                                                                     .bgUpdatesOnWiFiOnly = | ||||||
|  |                                                                 value; | ||||||
|  |                                                           }) | ||||||
|  |                                                     ], | ||||||
|  |                                                   ), | ||||||
|  |                                                 ], | ||||||
|  |                                               ), | ||||||
|                                           ], |                                           ], | ||||||
|                                         ) |                                         ) | ||||||
|                                       : const SizedBox.shrink(); |                                       : const SizedBox.shrink(); | ||||||
|   | |||||||
| @@ -9,6 +9,7 @@ import 'package:android_alarm_manager_plus/android_alarm_manager_plus.dart'; | |||||||
| import 'package:android_intent_plus/flag.dart'; | import 'package:android_intent_plus/flag.dart'; | ||||||
| import 'package:android_package_installer/android_package_installer.dart'; | import 'package:android_package_installer/android_package_installer.dart'; | ||||||
| import 'package:android_package_manager/android_package_manager.dart'; | import 'package:android_package_manager/android_package_manager.dart'; | ||||||
|  | import 'package:connectivity_plus/connectivity_plus.dart'; | ||||||
| import 'package:device_info_plus/device_info_plus.dart'; | 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'; | ||||||
| @@ -366,7 +367,7 @@ class AppsProvider with ChangeNotifier { | |||||||
|     if (!settingsProvider.enableBackgroundUpdates) { |     if (!settingsProvider.enableBackgroundUpdates) { | ||||||
|       return false; |       return false; | ||||||
|     } |     } | ||||||
|     if (app.additionalSettings['examptFromBackgroundUpdates'] == true) { |     if (app.additionalSettings['exemptFromBackgroundUpdates'] == true) { | ||||||
|       return false; |       return false; | ||||||
|     } |     } | ||||||
|     if (app.apkUrls.length > 1) { |     if (app.apkUrls.length > 1) { | ||||||
| @@ -1323,6 +1324,12 @@ Future<void> bgUpdateCheck(int taskId, Map<String, dynamic>? params) async { | |||||||
|     // If in update mode... |     // If in update mode... | ||||||
|     var didCompleteChecking = false; |     var didCompleteChecking = false; | ||||||
|     CheckingUpdatesNotification? notif; |     CheckingUpdatesNotification? notif; | ||||||
|  |     var networkRestricted = false; | ||||||
|  |     if (settingsProvider.bgUpdatesOnWiFiOnly) { | ||||||
|  |       var netResult = await (Connectivity().checkConnectivity()); | ||||||
|  |       networkRestricted = (netResult != ConnectivityResult.wifi) && | ||||||
|  |           (netResult != ConnectivityResult.ethernet); | ||||||
|  |     } | ||||||
|     // Loop through all updates and check each |     // Loop through all updates and check each | ||||||
|     for (int i = 0; i < toCheck.length; i++) { |     for (int i = 0; i < toCheck.length; i++) { | ||||||
|       var appId = toCheck[i].key; |       var appId = toCheck[i].key; | ||||||
| @@ -1335,8 +1342,9 @@ Future<void> bgUpdateCheck(int taskId, Map<String, dynamic>? params) async { | |||||||
|               cancelExisting: true); |               cancelExisting: true); | ||||||
|           App? newApp = await appsProvider.checkUpdate(appId); |           App? newApp = await appsProvider.checkUpdate(appId); | ||||||
|           if (newApp != null) { |           if (newApp != null) { | ||||||
|             if (!(await appsProvider.canInstallSilently( |             if (networkRestricted || | ||||||
|                 app!.app, settingsProvider))) { |                 !(await appsProvider.canInstallSilently( | ||||||
|  |                     app!.app, settingsProvider))) { | ||||||
|               notificationsProvider.notify( |               notificationsProvider.notify( | ||||||
|                   UpdateNotification([newApp], id: newApp.id.hashCode - 1)); |                   UpdateNotification([newApp], id: newApp.id.hashCode - 1)); | ||||||
|             } else { |             } else { | ||||||
|   | |||||||
| @@ -319,6 +319,15 @@ class SettingsProvider with ChangeNotifier { | |||||||
|     notifyListeners(); |     notifyListeners(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   bool get bgUpdatesOnWiFiOnly { | ||||||
|  |     return prefs?.getBool('bgUpdatesOnWiFiOnly') ?? false; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   set bgUpdatesOnWiFiOnly(bool val) { | ||||||
|  |     prefs?.setBool('bgUpdatesOnWiFiOnly', val); | ||||||
|  |     notifyListeners(); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   DateTime get lastBGCheckTime { |   DateTime get lastBGCheckTime { | ||||||
|     int? temp = prefs?.getInt('lastBGCheckTime'); |     int? temp = prefs?.getInt('lastBGCheckTime'); | ||||||
|     return temp != null |     return temp != null | ||||||
|   | |||||||
| @@ -427,8 +427,8 @@ abstract class AppSource { | |||||||
|     ], |     ], | ||||||
|     [GeneratedFormTextField('appName', label: tr('appName'), required: false)], |     [GeneratedFormTextField('appName', label: tr('appName'), required: false)], | ||||||
|     [ |     [ | ||||||
|       GeneratedFormSwitch('examptFromBackgroundUpdates', |       GeneratedFormSwitch('exemptFromBackgroundUpdates', | ||||||
|           label: tr('examptFromBackgroundUpdates')) |           label: tr('exemptFromBackgroundUpdates')) | ||||||
|     ] |     ] | ||||||
|   ]; |   ]; | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										24
									
								
								pubspec.lock
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								pubspec.lock
									
									
									
									
									
								
							| @@ -114,6 +114,22 @@ packages: | |||||||
|       url: "https://pub.dev" |       url: "https://pub.dev" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "1.17.2" |     version: "1.17.2" | ||||||
|  |   connectivity_plus: | ||||||
|  |     dependency: "direct main" | ||||||
|  |     description: | ||||||
|  |       name: connectivity_plus | ||||||
|  |       sha256: "77a180d6938f78ca7d2382d2240eb626c0f6a735d0bfdce227d8ffb80f95c48b" | ||||||
|  |       url: "https://pub.dev" | ||||||
|  |     source: hosted | ||||||
|  |     version: "4.0.2" | ||||||
|  |   connectivity_plus_platform_interface: | ||||||
|  |     dependency: transitive | ||||||
|  |     description: | ||||||
|  |       name: connectivity_plus_platform_interface | ||||||
|  |       sha256: cf1d1c28f4416f8c654d7dc3cd638ec586076255d407cef3ddbdaf178272a71a | ||||||
|  |       url: "https://pub.dev" | ||||||
|  |     source: hosted | ||||||
|  |     version: "1.2.4" | ||||||
|   convert: |   convert: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
| @@ -454,6 +470,14 @@ packages: | |||||||
|       url: "https://pub.dev" |       url: "https://pub.dev" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "1.0.0" |     version: "1.0.0" | ||||||
|  |   nm: | ||||||
|  |     dependency: transitive | ||||||
|  |     description: | ||||||
|  |       name: nm | ||||||
|  |       sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254" | ||||||
|  |       url: "https://pub.dev" | ||||||
|  |     source: hosted | ||||||
|  |     version: "0.5.0" | ||||||
|   path: |   path: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|   | |||||||
| @@ -64,6 +64,7 @@ dependencies: | |||||||
|   flutter_markdown: ^0.6.14 |   flutter_markdown: ^0.6.14 | ||||||
|   flutter_archive: ^5.0.0 |   flutter_archive: ^5.0.0 | ||||||
|   hsluv: ^1.1.3 |   hsluv: ^1.1.3 | ||||||
|  |   connectivity_plus: ^4.0.2 | ||||||
|  |  | ||||||
| dev_dependencies: | dev_dependencies: | ||||||
|   flutter_test: |   flutter_test: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user