diff --git a/packages/smooth_app/lib/database/knowledge_panels_query.dart b/packages/smooth_app/lib/database/knowledge_panels_query.dart index d3343f3f52b..a15438b7eb6 100644 --- a/packages/smooth_app/lib/database/knowledge_panels_query.dart +++ b/packages/smooth_app/lib/database/knowledge_panels_query.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'package:openfoodfacts/model/KnowledgePanels.dart'; import 'package:openfoodfacts/openfoodfacts.dart'; -import 'package:openfoodfacts/utils/OpenFoodAPIConfiguration.dart'; import 'package:smooth_app/database/product_query.dart'; class KnowledgePanelsQuery { @@ -17,10 +16,18 @@ class KnowledgePanelsQuery { barcode, language: ProductQuery.getLanguage(), country: ProductQuery.getCountry(), + fields: [ProductField.KNOWLEDGE_PANELS], + version: ProductQueryVersion.v2, ); - return OpenFoodAPIClient.getKnowledgePanels( - configuration, - OpenFoodAPIConfiguration.globalQueryType, - ); + + try { + final ProductResult productResult = await OpenFoodAPIClient.getProduct( + configuration, + ); + return productResult.product!.knowledgePanels!; + } catch (exception) { + // TODO(jasmeetsingh): Capture the exception in Sentry and don't log it here. + return KnowledgePanels.empty(); + } } }