From 9d01fec5b44e30e7a045ba59b5b06d4f3b1aa6dc Mon Sep 17 00:00:00 2001 From: Jarred Wilson Date: Sun, 15 Mar 2026 08:11:13 -0500 Subject: [PATCH 1/3] logging(liveapppovider): add info log on refresh --- lib/providers/application_provider.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/providers/application_provider.dart b/lib/providers/application_provider.dart index 0cc9eca..415c178 100644 --- a/lib/providers/application_provider.dart +++ b/lib/providers/application_provider.dart @@ -116,6 +116,8 @@ final liveApplicationProvider = Provider.family((ref, appId) { final allApps = ref.watch(appListProvider); + logger.i('Refreshed provider for $appId'); + return allApps[appId]; }); From 2d68e8d7167fd19c31b193fd9cb2abc43ad62d19 Mon Sep 17 00:00:00 2001 From: Jarred Wilson Date: Sun, 15 Mar 2026 17:31:58 -0500 Subject: [PATCH 2/3] refactor(application): add copyWith func --- lib/core/application.dart | 29 ++++++++++++++++++++++++++++ lib/core/flatpak_application.dart | 32 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/lib/core/application.dart b/lib/core/application.dart index 1c3176a..232ac46 100644 --- a/lib/core/application.dart +++ b/lib/core/application.dart @@ -105,6 +105,35 @@ class Application extends AppstreamComponent { String getUpdateTarget() => id; String launchCommand() => id; + + Application copyWith({bool? installed, bool? current, bool? featured}) { + return Application( + id: id, + package: package, + name: name, + summary: summary, + description: description, + developerName: developerName, + projectLicense: projectLicense, + projectGroup: projectGroup, + icons: icons, + urls: urls, + categories: categories, + screenshots: screenshots, + keywords: keywords, + compulsoryForDesktops: compulsoryForDesktops, + releases: releases, + provides: provides, + contentRatings: contentRatings, + custom: custom, + installed: installed ?? this.installed, + bundles: bundles, + remote: remote, + type: type, + current: current ?? this.current, + featured: featured ?? this.featured, + ); + } } extension _GetOrDefault on Map { diff --git a/lib/core/flatpak_application.dart b/lib/core/flatpak_application.dart index dd59feb..a29b528 100644 --- a/lib/core/flatpak_application.dart +++ b/lib/core/flatpak_application.dart @@ -164,4 +164,36 @@ class FlatpakApplication extends Application { String launchCommand() { return "flatpak run $id"; } + + @override + FlatpakApplication copyWith( + {bool? installed, bool? current, bool? featured}) { + return FlatpakApplication( + id: id, + package: package, + name: name, + summary: summary, + description: description, + developerName: developerName, + projectLicense: projectLicense, + projectGroup: projectGroup, + icons: icons, + urls: urls, + categories: categories, + screenshots: screenshots, + keywords: keywords, + compulsoryForDesktops: compulsoryForDesktops, + releases: releases, + provides: provides, + contentRatings: contentRatings, + custom: custom, + installed: installed ?? this.installed, + bundles: bundles, + remote: remote, + type: type, + deployDir: deployDir, + current: current ?? this.current, + featured: featured ?? this.featured, + ); + } } From 8da4b9a2e5d714f79059065061c5448d64934cfe Mon Sep 17 00:00:00 2001 From: Jarred Wilson Date: Sun, 15 Mar 2026 17:32:42 -0500 Subject: [PATCH 3/3] fix(applistprovider):[#161] create new mem instance utilize the application copyWith function to create a new application instance in memory as to force the provider to refresh. this fixes the installed apps not updating and the actions buttons updating on an uninstall --- lib/providers/application_provider.dart | 33 +++++++++---------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/lib/providers/application_provider.dart b/lib/providers/application_provider.dart index 415c178..4a4717e 100644 --- a/lib/providers/application_provider.dart +++ b/lib/providers/application_provider.dart @@ -77,29 +77,18 @@ final featuredAppList = FutureProvider>((ref) async { final appListProvider = Provider((ref) { final remoteApps = ref.watch(remoteAppListProvider).value ?? {}; final installedApps = ref.watch(installedAppListProvider); - final featuredApps = ref.watch(featuredAppList); - - for (var app in installedApps.entries) { - try { - remoteApps[app.key]!.installed = true; - remoteApps[app.key]!.current = app.value; - } catch (e) { - logger.w('Failed to find $app in installed list.'); - } - } + final featuredApps = ref.watch(featuredAppList).value ?? []; - if (featuredApps.hasValue) { - List featured = featuredApps.value!; - - for (var app in featured) { - try { - remoteApps[app]!.featured = true; - } catch (e) { - logger.w('Failed to find $app in featured list.'); - } - } - } - return remoteApps; + return remoteApps.map((id, app) { + return MapEntry( + id, + app.copyWith( + installed: installedApps.containsKey(id), + current: installedApps[id] ?? false, + featured: featuredApps.contains(id), + ), + ); + }); }); final searchKeywordsProvider = Provider((ref) {