diff --git a/lib/pages/apps.dart b/lib/pages/apps.dart index ca188bcf..3b4c9fd6 100644 --- a/lib/pages/apps.dart +++ b/lib/pages/apps.dart @@ -893,7 +893,8 @@ class AppsPageState extends State { 'preferredApkIndex': a.preferredApkIndex, 'additionalSettings': - jsonEncode(a.additionalSettings) + jsonEncode(a.additionalSettings), + 'overrideSource': a.overrideSource }))}\n\n'; } Share.share(urls, diff --git a/lib/pages/home.dart b/lib/pages/home.dart index ff1655d1..00a89afe 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -13,6 +13,7 @@ import 'package:obtainium/pages/import_export.dart'; import 'package:obtainium/pages/settings.dart'; import 'package:obtainium/providers/apps_provider.dart'; import 'package:obtainium/providers/settings_provider.dart'; +import 'package:obtainium/providers/source_provider.dart'; import 'package:provider/provider.dart'; class HomePage extends StatefulWidget { @@ -102,13 +103,22 @@ class _HomePageState extends State { }) != null) { // ignore: use_build_context_synchronously - var result = await context.read().import( - action == 'app' - ? '{ "apps": [$dataStr] }' - : '{ "apps": $dataStr }'); + var appsProvider = await context.read(); + var result = await appsProvider.import(action == 'app' + ? '{ "apps": [$dataStr] }' + : '{ "apps": $dataStr }'); // ignore: use_build_context_synchronously showMessage( - tr('importedX', args: [plural('apps', result.key)]), context); + tr('importedX', args: [plural('apps', result.key.length)]), + context); + await appsProvider + .checkUpdates(specificIds: result.key.map((e) => e.id).toList()) + .catchError((e) { + if (e is Map && e['errors'] is MultiAppMultiError) { + showError(e['errors'].toString(), context); + } + return []; + }); } } else { throw ObtainiumError(tr('unknown')); diff --git a/lib/pages/import_export.dart b/lib/pages/import_export.dart index 7e73d0a8..4d1da077 100644 --- a/lib/pages/import_export.dart +++ b/lib/pages/import_export.dart @@ -144,7 +144,7 @@ class _ImportExportPageState extends State { appsProvider.addMissingCategories(settingsProvider); showMessage( '${tr('importedX', args: [ - plural('apps', value.key) + plural('apps', value.key.length) ])}${value.value ? ' + ${tr('settings')}' : ''}', context); }); diff --git a/lib/providers/apps_provider.dart b/lib/providers/apps_provider.dart index a7a05b59..6f103383 100644 --- a/lib/providers/apps_provider.dart +++ b/lib/providers/apps_provider.dart @@ -1516,7 +1516,7 @@ class AppsProvider with ChangeNotifier { return returnPath; } - Future> import(String appsJSON) async { + Future, bool>> import(String appsJSON) async { var decodedJSON = jsonDecode(appsJSON); var newFormat = decodedJSON is! List; List importedApps = @@ -1550,8 +1550,8 @@ class AppsProvider with ChangeNotifier { } }); } - return MapEntry( - importedApps.length, newFormat && decodedJSON['settings'] != null); + return MapEntry, bool>( + importedApps, newFormat && decodedJSON['settings'] != null); } @override diff --git a/pubspec.lock b/pubspec.lock index 6d9a462a..15d7f79d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -215,10 +215,10 @@ packages: dependency: "direct main" description: name: easy_localization - sha256: "432698c31a488dd64c56d4759f20d04844baba5e9e4f2cb1abb9676257918b17" + sha256: fa59bcdbbb911a764aa6acf96bbb6fa7a5cf8234354fc45ec1a43a0349ef0201 url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "3.0.7" easy_logger: dependency: transitive description: @@ -324,18 +324,18 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "4.0.0" flutter_local_notifications: dependency: "direct main" description: name: flutter_local_notifications - sha256: "84a3af6c7fb43c85c3528b434dacc7a7ed4551d1209d93773bf6045cec9ace68" + sha256: "40e6fbd2da7dcc7ed78432c5cdab1559674b4af035fddbfb2f9a8f9c2112fcef" url: "https://pub.dev" source: hosted - version: "17.1.1" + version: "17.1.2" flutter_local_notifications_linux: dependency: transitive description: @@ -491,10 +491,10 @@ packages: dependency: transitive description: name: lints - sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "4.0.0" markdown: dependency: transitive description: @@ -579,10 +579,10 @@ packages: dependency: transitive description: name: path_provider_foundation - sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" + sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.0" path_provider_linux: dependency: transitive description: @@ -723,10 +723,10 @@ packages: dependency: transitive description: name: shared_preferences_foundation - sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" + sha256: "0a8a893bf4fd1152f93fec03a415d11c27c74454d96e2318a7ac38dd18683ab7" url: "https://pub.dev" source: hosted - version: "2.3.5" + version: "2.4.0" shared_preferences_linux: dependency: transitive description: @@ -897,10 +897,10 @@ packages: dependency: transitive description: name: url_launcher_ios - sha256: "9149d493b075ed740901f3ee844a38a00b33116c7c5c10d7fb27df8987fb51d5" + sha256: "7068716403343f6ba4969b4173cbf3b84fc768042124bc2c011e5d782b24fe89" url: "https://pub.dev" source: hosted - version: "6.2.5" + version: "6.3.0" url_launcher_linux: dependency: transitive description: @@ -913,10 +913,10 @@ packages: dependency: transitive description: name: url_launcher_macos - sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 + sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.2.0" url_launcher_platform_interface: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 4daa462d..aa90e99c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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 # 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. -version: 1.1.7+2264 +version: 1.1.8+2265 environment: sdk: '>=3.0.0 <4.0.0' @@ -89,7 +89,7 @@ dev_dependencies: # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. - flutter_lints: ^3.0.0 + flutter_lints: ^4.0.0 flutter_launcher_icons: android: "ic_launcher"