Skip to content

Commit

Permalink
Merge pull request #1619 from ImranR98/dev
Browse files Browse the repository at this point in the history
- Bugfix: Get initial data on config import
- Bugfix: Include overrideSource in exported config
  • Loading branch information
ImranR98 authored May 13, 2024
2 parents 9837e8e + b231c75 commit dbcb4b3
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 28 deletions.
3 changes: 2 additions & 1 deletion lib/pages/apps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,8 @@ class AppsPageState extends State<AppsPage> {
'preferredApkIndex':
a.preferredApkIndex,
'additionalSettings':
jsonEncode(a.additionalSettings)
jsonEncode(a.additionalSettings),
'overrideSource': a.overrideSource
}))}\n\n';
}
Share.share(urls,
Expand Down
20 changes: 15 additions & 5 deletions lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -102,13 +103,22 @@ class _HomePageState extends State<HomePage> {
}) !=
null) {
// ignore: use_build_context_synchronously
var result = await context.read<AppsProvider>().import(
action == 'app'
? '{ "apps": [$dataStr] }'
: '{ "apps": $dataStr }');
var appsProvider = await context.read<AppsProvider>();
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 <App>[];
});
}
} else {
throw ObtainiumError(tr('unknown'));
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/import_export.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class _ImportExportPageState extends State<ImportExportPage> {
appsProvider.addMissingCategories(settingsProvider);
showMessage(
'${tr('importedX', args: [
plural('apps', value.key)
plural('apps', value.key.length)
])}${value.value ? ' + ${tr('settings')}' : ''}',
context);
});
Expand Down
6 changes: 3 additions & 3 deletions lib/providers/apps_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ class AppsProvider with ChangeNotifier {
return returnPath;
}

Future<MapEntry<int, bool>> import(String appsJSON) async {
Future<MapEntry<List<App>, bool>> import(String appsJSON) async {
var decodedJSON = jsonDecode(appsJSON);
var newFormat = decodedJSON is! List;
List<App> importedApps =
Expand Down Expand Up @@ -1550,8 +1550,8 @@ class AppsProvider with ChangeNotifier {
}
});
}
return MapEntry<int, bool>(
importedApps.length, newFormat && decodedJSON['settings'] != null);
return MapEntry<List<App>, bool>(
importedApps, newFormat && decodedJSON['settings'] != null);
}

@override
Expand Down
32 changes: 16 additions & 16 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit dbcb4b3

Please sign in to comment.