Skip to content

Commit

Permalink
Silently fail (openfoodfacts#6162)
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k authored Jan 10, 2025
1 parent e37d569 commit d7a2176
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
20 changes: 2 additions & 18 deletions packages/smooth_app/lib/data_models/onboarding_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:smooth_app/data_models/onboarding_data_product.dart';
import 'package:smooth_app/database/local_database.dart';
import 'package:smooth_app/generic_lib/duration_constants.dart';
import 'package:smooth_app/generic_lib/loading_dialog.dart';
import 'package:smooth_app/pages/onboarding/onboarding_flow_navigator.dart';

Expand All @@ -19,30 +18,15 @@ class OnboardingLoader {
final OnboardingPage page,
final BuildContext context,
) async {
final AppLocalizations appLocalizations = AppLocalizations.of(context);
switch (page) {
case OnboardingPage.WELCOME:
final bool? downloaded = await LoadingDialog.run<bool>(
await LoadingDialog.run<bool>(
context: context,
future: _downloadData(),
future: _downloadData().timeout(const Duration(seconds: 4)),
title: AppLocalizations.of(context)
.onboarding_welcome_loading_dialog_title,
dismissible: false,
);
if (downloaded != true) {
if (!context.mounted) {
return;
}
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(appLocalizations.onboarding_welcome_loading_error),
duration: SnackBarDuration.short,
behavior: SnackBarBehavior.floating,
elevation: 0,
),
);
}
return;
case OnboardingPage.NOT_STARTED:
case OnboardingPage.HOME_PAGE:
case OnboardingPage.HEALTH_CARD_EXAMPLE:
Expand Down
4 changes: 0 additions & 4 deletions packages/smooth_app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1226,10 +1226,6 @@
"@onboarding_welcome_loading_dialog_title": {
"description": "Title for the onboarding loading dialog"
},
"onboarding_welcome_loading_error": "Seems like there is no example product in your language",
"@onboarding_welcome_loading_error": {
"description": "Seems like there is no example product in your language"
},
"product_list_your_ranking": "Your ranking",
"@product_list_your_ranking": {
"description": "Your ranking screen title"
Expand Down

0 comments on commit d7a2176

Please sign in to comment.