Skip to content

Commit

Permalink
Merge branch 'develop' into fix/4549
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurtanuki authored Aug 16, 2023
2 parents 87d644b + e265e75 commit af985ca
Show file tree
Hide file tree
Showing 157 changed files with 475 additions and 314 deletions.
35 changes: 0 additions & 35 deletions packages/smooth_app/assets/preferences/twitter-bird.svg

This file was deleted.

3 changes: 3 additions & 0 deletions packages/smooth_app/assets/preferences/x-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,6 @@ class ContinuousScanModel with ChangeNotifier {
case FetchedProductStatus.internetError:
_setBarcodeState(barcode, ScannedProductState.ERROR_INTERNET);
return;
case FetchedProductStatus.codeInvalid:
_setBarcodeState(barcode, ScannedProductState.ERROR_INVALID_CODE);
return;
case FetchedProductStatus.userCancelled:
// we do nothing
return;
Expand All @@ -247,9 +244,6 @@ class ContinuousScanModel with ChangeNotifier {
case FetchedProductStatus.internetError:
_setBarcodeState(barcode, ScannedProductState.ERROR_INTERNET);
return;
case FetchedProductStatus.codeInvalid:
_setBarcodeState(barcode, ScannedProductState.ERROR_INVALID_CODE);
return;
case FetchedProductStatus.userCancelled:
// we do nothing
return;
Expand Down
51 changes: 43 additions & 8 deletions packages/smooth_app/lib/data_models/fetched_product.dart
Original file line number Diff line number Diff line change
@@ -1,28 +1,63 @@
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:openfoodfacts/openfoodfacts.dart';

/// Status of a "fetch [Product]" operation
enum FetchedProductStatus {
// found locally or from internet
ok,
internetNotFound,
internetError,
userCancelled,
codeInvalid,
// TODO(monsieurtanuki): time-out
}

/// A [Product] that we tried to fetch, but was it successful?..
class FetchedProduct {
const FetchedProduct._({
required this.status,
this.product,
this.connectivityResult,
this.exceptionString,
this.failedPingedHost,
});

// The reason behind the "ignore": I want to force "product" to be not null
FetchedProduct(final Product product)
const FetchedProduct.found(final Product product)
// ignore: prefer_initializing_formals
: product = product,
status = FetchedProductStatus.ok;
: this._(
status: FetchedProductStatus.ok,
product: product,
);

/// The internet Product search said it couldn't find the product.
const FetchedProduct.internetNotFound()
: this._(status: FetchedProductStatus.internetNotFound);

/// The user cancelled the operation.
const FetchedProduct.userCancelled()
: this._(status: FetchedProductStatus.userCancelled);

/// When the "fetch product" operation didn't go well (no status "ok" here)
FetchedProduct.error(this.status)
: product = null,
assert(status != FetchedProductStatus.ok);
/// When the "fetch product" operation had an internet error.
const FetchedProduct.error({
required final String exceptionString,
required final ConnectivityResult connectivityResult,
final String? failedPingedHost,
}) : this._(
status: FetchedProductStatus.internetError,
connectivityResult: connectivityResult,
exceptionString: exceptionString,
failedPingedHost: failedPingedHost,
);

final Product? product;
final FetchedProductStatus status;

/// When relevant, result of the connectivity check.
final ConnectivityResult? connectivityResult;

/// When relevant, string of the exception.
final String? exceptionString;

/// When relevant, host of the query that we couldn't even ping.
final String? failedPingedHost;
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,32 @@ class _KnowledgePanelPageState extends State<KnowledgePanelPage>
),
body: RefreshIndicator(
onRefresh: () => _refreshProduct(context),
child: SingleChildScrollView(
child: CustomScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: SmoothCard(
padding: const EdgeInsets.all(
SMALL_SPACE,
),
child: KnowledgePanelExpandedCard(
panelId: widget.panelId,
product: upToDateProduct,
isInitiallyExpanded: true,
),
),
slivers: <Widget>[
SliverToBoxAdapter(
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(
bottom: SMALL_SPACE,
top: SMALL_SPACE,
),
child: SmoothCard(
padding: const EdgeInsets.all(
SMALL_SPACE,
),
child: KnowledgePanelExpandedCard(
panelId: widget.panelId,
product: upToDateProduct,
isInitiallyExpanded: true,
),
),
),
],
),
)
],
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_aa.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_af.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_ak.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_am.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_ar.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "اتصل بنا",
"instagram": "إنستغرام",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "الأسئلة المتكررة",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_as.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_az.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_be.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Звяжыцеся з намі",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Блог",
"faq": "FAQ",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_bg.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Свържи се с нас",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Блог",
"faq": "ЧЗВ",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_bm.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
Expand Down
4 changes: 2 additions & 2 deletions packages/smooth_app/lib/l10n/app_bn.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,11 +861,11 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
"discover": "খুঁজুন",
"discover": "আবিষ্কার করো",
"how_to_contribute": "How to Contribute",
"hint_knowledge_panel_message": "Your can tap on any part of the card to get more details about what you see. Try it now!",
"@hint_knowledge_panel_message": {
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_bo.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_br.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_bs.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
Expand Down
12 changes: 6 additions & 6 deletions packages/smooth_app/lib/l10n/app_ca.arb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
"@sign_in_mandatory": {
"description": "Error message: for some features like product edits you need to be signed in"
},
"sign_out": "Tancar la sessió",
"sign_out": "Tanca la sessió",
"@sign_out": {
"description": "Button label: For sign out"
},
Expand Down Expand Up @@ -516,7 +516,7 @@
"@packaging_information_photo": {},
"missing_product": "Heu trobat un nou producte!",
"@missing_product": {},
"add_product_take_photos": "Take photos of the packaging to add this product to Open Food Facts",
"add_product_take_photos": "Feu fotos de l'embalatge per afegir aquest producte a Open Food Facts",
"@add_product_take_photos": {},
"add_product_take_photos_descriptive": "Si us plau, feu algunes fotos primer. Sempre podeu completar el producte més endavant.",
"@add_product_take_photos_descriptive": {},
Expand Down Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connecta amb nosaltres",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Bloc",
"faq": "FAQ",
Expand Down Expand Up @@ -969,7 +969,7 @@
"@authorize": {
"description": "Button to accept the request of sending the anonymous analytics or authorize the camera permission"
},
"refuse_button_label": "Denegar",
"refuse_button_label": "Denega",
"@refuse": {
"description": "Button to decline the request of sending the anonymous analytics"
},
Expand Down Expand Up @@ -1044,7 +1044,7 @@
"@loading_dialog_default_error_message": {
"description": "Default loading dialog error message"
},
"account_delete": "Eliminar compte",
"account_delete": "Elimina el compte",
"@account_delete": {
"description": "Delete account button (user profile)"
},
Expand Down Expand Up @@ -1079,7 +1079,7 @@
}
}
},
"email_subject_account_deletion": "Eliminar compte",
"email_subject_account_deletion": "Elimina el compte",
"@email_subject_account_deletion": {
"description": "Email subject for an account deletion"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_ce.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_co.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_cs.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Spojte se s námi",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "Často kladené otázky",
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/l10n/app_cv.arb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"connect_with_us": "Connect with us",
"instagram": "Instagram",
"instagram_link": "https://instagram.com/open.food.facts",
"twitter": "Twitter",
"twitter": "X (formerly Twitter)",
"twitter_link": "https://www.twitter.com/openfoodfacts",
"blog": "Blog",
"faq": "FAQ",
Expand Down
Loading

0 comments on commit af985ca

Please sign in to comment.