From 3c32261b04a8199b590f2246cce53be96f16c1be Mon Sep 17 00:00:00 2001 From: Jozys Date: Mon, 5 May 2025 09:02:19 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Remove=20installed=5Fa?= =?UTF-8?q?pps=20dependency=20and=20update=20related=20code=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - This is due to QUERY_ALL_PACKAGES not being allowed to be used in production for our use case --- lib/utils/system_utils.dart | 14 ++++++++------ pubspec.lock | 8 -------- pubspec.yaml | 1 - 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/utils/system_utils.dart b/lib/utils/system_utils.dart index 0ea4edb..9b57ea5 100644 --- a/lib/utils/system_utils.dart +++ b/lib/utils/system_utils.dart @@ -1,17 +1,19 @@ import 'dart:typed_data'; -import 'package:installed_apps/installed_apps.dart'; import 'package:logging/logging.dart'; Future getInstalledAppIcon(String sourceId) async { final log = Logger("InstalledAppIcon"); if (sourceId.isNotEmpty) { try { - var appIcon = - (await InstalledApps.getAppInfo(sourceId.toString(), null))?.icon; - if (appIcon != null && appIcon.isNotEmpty) { - return appIcon; - } + // Sadly due to the QUERY_ALL_PACKAGES permission not being allowed for release in the Play Store in this use case, this + // method is not usable in production. Therefore we have to disable it for now. + // TODO: Find a way to get the app icon without using QUERY_ALL_PACKAGES + // var appIcon = + // (await InstalledApps.getAppInfo(sourceId.toString(), null))?.icon; + // if (appIcon != null && appIcon.isNotEmpty) { + // return appIcon; + // } } catch (_) { log.info("App icon fetching failed"); } diff --git a/pubspec.lock b/pubspec.lock index 0395e64..d82da2d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -494,14 +494,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.5.4" - installed_apps: - dependency: "direct main" - description: - name: installed_apps - sha256: dd2b7c531f91114cd6df447c56567593c9799ca83f057137ae719324ae0afd06 - url: "https://pub.dev" - source: hosted - version: "1.6.0" intl: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index d633697..71c0d9f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,7 +25,6 @@ dependencies: percent_indicator: ^4.2.3 shared_preferences: ^2.3.1 fl_chart: ^0.70.2 - installed_apps: ^1.5.2 package_info_plus: ^8.3.0 sqflite: ^2.4.1 path: ^1.9.0 From 1842ca12521ec83e6bbb759614ac152b474342eb Mon Sep 17 00:00:00 2001 From: Jozys Date: Mon, 5 May 2025 09:08:10 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Clean=20up=20getInstal?= =?UTF-8?q?ledAppIcon=20function=20by=20removing=20unused=20logging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/utils/system_utils.dart | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/utils/system_utils.dart b/lib/utils/system_utils.dart index 9b57ea5..f7a528c 100644 --- a/lib/utils/system_utils.dart +++ b/lib/utils/system_utils.dart @@ -1,22 +1,15 @@ import 'dart:typed_data'; -import 'package:logging/logging.dart'; - Future getInstalledAppIcon(String sourceId) async { - final log = Logger("InstalledAppIcon"); if (sourceId.isNotEmpty) { - try { - // Sadly due to the QUERY_ALL_PACKAGES permission not being allowed for release in the Play Store in this use case, this - // method is not usable in production. Therefore we have to disable it for now. - // TODO: Find a way to get the app icon without using QUERY_ALL_PACKAGES - // var appIcon = - // (await InstalledApps.getAppInfo(sourceId.toString(), null))?.icon; - // if (appIcon != null && appIcon.isNotEmpty) { - // return appIcon; - // } - } catch (_) { - log.info("App icon fetching failed"); - } + // Sadly due to the QUERY_ALL_PACKAGES permission not being allowed for release in the Play Store in this use case, this + // method is not usable in production. Therefore we have to disable it for now. + // TODO: Find a way to get the app icon without using QUERY_ALL_PACKAGES + // var appIcon = + // (await InstalledApps.getAppInfo(sourceId.toString(), null))?.icon; + // if (appIcon != null && appIcon.isNotEmpty) { + // return appIcon; + // } } return null; }