Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/openfoodfacts#798' into …
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurtanuki committed Jan 3, 2022
2 parents bdf5557 + 5761357 commit 0dac0b9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 122 deletions.
11 changes: 4 additions & 7 deletions packages/smooth_app/lib/cards/data_cards/image_upload_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,11 @@ class _ImageUploadCardState extends State<ImageUploadCard> {
imageUri: croppedImageFile.uri,
);

// a registered user login for https://world.openfoodfacts.org/ is required
//ToDo: Add user
const User myUser =
User(userId: 'smoothie-app', password: 'strawberrybanana');

// query the OpenFoodFacts API
final Status result =
await OpenFoodAPIClient.addProductImage(myUser, image);
final Status result = await OpenFoodAPIClient.addProductImage(
ProductQuery.getUser(),
image,
);

if (result.status != 'status ok') {
throw Exception(
Expand Down
3 changes: 2 additions & 1 deletion packages/smooth_app/lib/database/keywords_product_query.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';

import 'package:openfoodfacts/model/parameter/SearchTerms.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:smooth_app/data_models/product_list.dart';
Expand All @@ -16,7 +17,7 @@ class KeywordsProductQuery implements ProductQuery {
@override
Future<SearchResult> getSearchResult() async =>
OpenFoodAPIClient.searchProducts(
ProductQuery.SMOOTH_USER,
ProductQuery.getUser(),
ProductSearchQueryConfiguration(
fields: ProductQuery.fields,
parametersList: <Parameter>[
Expand Down
12 changes: 7 additions & 5 deletions packages/smooth_app/lib/database/product_query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ abstract class ProductQuery {
static void setCountry(final String? isoCode) =>
OpenFoodAPIConfiguration.globalCountry = CountryHelper.fromJson(isoCode);

static const User SMOOTH_USER = User(
userId: 'project-smoothie',
password: 'smoothie',
comment: 'Test user for project smoothie',
);
static User getUser() =>
OpenFoodAPIConfiguration.globalUser ??
const User(
userId: 'smoothie-app',
password: 'strawberrybanana',
comment: 'Test user for project smoothie',
);

static List<ProductField> get fields => <ProductField>[
ProductField.NAME,
Expand Down
71 changes: 0 additions & 71 deletions packages/smooth_app/lib/pages/smooth_it_page.dart

This file was deleted.

38 changes: 0 additions & 38 deletions packages/smooth_app/lib/pages/tracking_page.dart

This file was deleted.

0 comments on commit 0dac0b9

Please sign in to comment.