From fda9e6195a995e00c067e129bca394d00f66d060 Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Sat, 15 Jul 2023 18:54:53 -0400 Subject: [PATCH 1/3] Make transition animation directional (#675) --- lib/pages/home.dart | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/pages/home.dart b/lib/pages/home.dart index 1e74fcc..c64ed03 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -26,6 +26,7 @@ class NavigationPageItem { class _HomePageState extends State { List selectedIndexHistory = []; + bool isReversing = false; int prevAppCount = -1; bool prevIsLoading = true; @@ -42,7 +43,16 @@ class _HomePageState extends State { Widget build(BuildContext context) { AppsProvider appsProvider = context.watch(); + setIsReversing(int targetIndex) { + bool reversing = selectedIndexHistory.isNotEmpty && + selectedIndexHistory.last > targetIndex; + setState(() { + isReversing = reversing; + }); + } + switchToPage(int index) async { + setIsReversing(index); if (index == 0) { while ((pages[0].widget.key as GlobalKey).currentState != null) { @@ -79,6 +89,7 @@ class _HomePageState extends State { child: Scaffold( backgroundColor: Theme.of(context).colorScheme.surface, body: PageTransitionSwitcher( + reverse: isReversing, transitionBuilder: ( Widget child, Animation animation, @@ -104,13 +115,16 @@ class _HomePageState extends State { .toList(), onDestinationSelected: (int index) async { HapticFeedback.selectionClick(); - await switchToPage(index); + switchToPage(index); }, selectedIndex: selectedIndexHistory.isEmpty ? 0 : selectedIndexHistory.last, ), ), onWillPop: () async { + setIsReversing(selectedIndexHistory.length >= 2 + ? selectedIndexHistory.reversed.toList()[1] + : 0); if (selectedIndexHistory.isNotEmpty) { setState(() { selectedIndexHistory.removeLast(); From d32e7acc8f68ae13ee5b864667436eab25b79c29 Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Sat, 15 Jul 2023 19:20:17 -0400 Subject: [PATCH 2/3] Fix missing update button bug (perform full load on foreground) --- lib/providers/apps_provider.dart | 46 +++++++++++++------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/lib/providers/apps_provider.dart b/lib/providers/apps_provider.dart index 52fcec3..d6dc4be 100644 --- a/lib/providers/apps_provider.dart +++ b/lib/providers/apps_provider.dart @@ -117,7 +117,7 @@ class AppsProvider with ChangeNotifier { foregroundStream = FGBGEvents.stream.asBroadcastStream(); foregroundSubscription = foregroundStream?.listen((event) async { isForeground = event == FGBGType.foreground; - if (isForeground) await refreshInstallStatuses(); + if (isForeground) await loadApps(); }); () async { var cacheDirs = await getExternalCacheDirectories(); @@ -744,47 +744,35 @@ class AppsProvider with ChangeNotifier { // Put Apps into memory to list them (fast) if (app != null) { try { - apps[app.id] = AppInMemory(app, null, null); + sp.getSource(app.url, overrideSource: app.overrideSource); + apps.update( + app.id, + (value) => + AppInMemory(app, value.downloadProgress, value.installedInfo), + ifAbsent: () => AppInMemory(app, null, null)); } catch (e) { errors.add([app.id, app.finalName, e.toString()]); } } } notifyListeners(); - for (var app in newApps) { - // Check install status for each App (slow) - if (app != null) { - try { - apps[app.id]?.installedInfo = await getInstalledInfo(app.id); - sp.getSource(app.url, overrideSource: app.overrideSource); - } catch (e) { - apps.remove(app.id); - errors.add([app.id, app.finalName, e.toString()]); - } - notifyListeners(); - } - } if (errors.isNotEmpty) { removeApps(errors.map((e) => e[0]).toList()); NotificationsProvider().notify( AppsRemovedNotification(errors.map((e) => [e[1], e[2]]).toList())); } - loadingApps = false; - notifyListeners(); - refreshInstallStatuses(useExistingInstalledInfo: true); - } - - Future refreshInstallStatuses( - {bool useExistingInstalledInfo = false}) async { if (await doesInstalledAppsPluginWork()) { + for (var app in apps.values) { + // Check install status for each App (slow) + apps[app.app.id]?.installedInfo = await getInstalledInfo(app.app.id); + notifyListeners(); + } + // Reconcile version differences List modifiedApps = []; for (var app in apps.values) { - var moddedApp = getCorrectedInstallStatusAppIfPossible( - app.app, - useExistingInstalledInfo - ? app.installedInfo - : await getInstalledInfo(app.app.id)); + var moddedApp = + getCorrectedInstallStatusAppIfPossible(app.app, app.installedInfo); if (moddedApp != null) { modifiedApps.add(moddedApp); } @@ -795,6 +783,7 @@ class AppsProvider with ChangeNotifier { .where((a) => a.installedVersion == null) .map((e) => e.id) .toList(); + // After reconciliation, delete externally uninstalled Apps if needed if (removedAppIds.isNotEmpty) { var settingsProvider = SettingsProvider(); await settingsProvider.initializeSettings(); @@ -804,6 +793,9 @@ class AppsProvider with ChangeNotifier { } } } + + loadingApps = false; + notifyListeners(); } Future saveApps(List apps, From f05902925d45336fbe049d23d7e677ed43ffa28c Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Sat, 15 Jul 2023 19:23:00 -0400 Subject: [PATCH 3/3] Increment version --- lib/main.dart | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 51e56f0..0e1a60e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,7 +21,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart'; // ignore: implementation_imports import 'package:easy_localization/src/localization.dart'; -const String currentVersion = '0.13.16'; +const String currentVersion = '0.13.17'; const String currentReleaseTag = 'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES diff --git a/pubspec.yaml b/pubspec.yaml index 06fd3fb..db13b8a 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: 0.13.16+180 # When changing this, update the tag in main() accordingly +version: 0.13.17+181 # When changing this, update the tag in main() accordingly environment: sdk: '>=2.18.2 <3.0.0'