Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: old TODOs #4758

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class BackgroundTaskHungerGames extends BackgroundTaskBarcode {
@override
Future<void> upload() async {
final InsightAnnotation? annotation =
_getInsightAnnotation(insightAnnotation);
InsightAnnotation.fromInt(insightAnnotation);
if (annotation == null) {
// very unlikely
return;
Expand All @@ -126,15 +126,4 @@ class BackgroundTaskHungerGames extends BackgroundTaskBarcode {
deviceId: OpenFoodAPIConfiguration.uuid,
);
}

// TODO(monsieurtanuki): move to off-dart
static InsightAnnotation? _getInsightAnnotation(final int annotation) {
for (final InsightAnnotation insightAnnotation
in InsightAnnotation.values) {
if (annotation == insightAnnotation.value) {
return insightAnnotation;
}
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,8 @@ class BackgroundTaskImage extends BackgroundTaskUpload {
}

// cf. https://github.com/openfoodfacts/smooth-app/issues/4219
// TODO(monsieurtanuki): move to off-dart
static const int minimumWidth = 640;
static const int minimumHeight = 160;

static bool isPictureBigEnough(final num width, final num height) =>
width >= minimumWidth || height >= minimumHeight;
width >= ImageHelper.minimumWidth || height >= ImageHelper.minimumHeight;

/// Adds the background task about uploading a product image.
static Future<void> addTask(
Expand Down
81 changes: 0 additions & 81 deletions packages/smooth_app/lib/database/dao_hive_product.dart

This file was deleted.

160 changes: 0 additions & 160 deletions packages/smooth_app/lib/database/dao_unzipped_product.dart

This file was deleted.

14 changes: 1 addition & 13 deletions packages/smooth_app/lib/database/local_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ import 'package:smooth_app/background/background_task_manager.dart';
import 'package:smooth_app/data_models/up_to_date_product_list_provider.dart';
import 'package:smooth_app/data_models/up_to_date_product_provider.dart';
import 'package:smooth_app/database/abstract_dao.dart';
import 'package:smooth_app/database/dao_hive_product.dart';
import 'package:smooth_app/database/dao_instant_string.dart';
import 'package:smooth_app/database/dao_int.dart';
import 'package:smooth_app/database/dao_product.dart';
import 'package:smooth_app/database/dao_product_list.dart';
import 'package:smooth_app/database/dao_product_migration.dart';
import 'package:smooth_app/database/dao_string.dart';
import 'package:smooth_app/database/dao_string_list.dart';
import 'package:smooth_app/database/dao_string_list_map.dart';
import 'package:smooth_app/database/dao_transient_operation.dart';
import 'package:smooth_app/database/dao_unzipped_product.dart';
import 'package:smooth_app/database/dao_work_barcode.dart';
import 'package:sqflite/sqflite.dart';

Expand Down Expand Up @@ -74,7 +71,6 @@ class LocalDatabase extends ChangeNotifier {
// only hive from there
await Hive.initFlutter();
final List<AbstractDao> daos = <AbstractDao>[
DaoHiveProduct(localDatabase),
DaoProductList(localDatabase),
DaoStringList(localDatabase),
DaoString(localDatabase),
Expand All @@ -91,14 +87,7 @@ class LocalDatabase extends ChangeNotifier {
}

// Migrations here
await DaoProductMigration.migrate(
source: DaoHiveProduct(localDatabase),
destination: DaoUnzippedProduct(localDatabase),
);
await DaoProductMigration.migrate(
source: DaoUnzippedProduct(localDatabase),
destination: DaoProduct(localDatabase),
);
// (no migration for the moment)

return localDatabase;
}
Expand All @@ -112,7 +101,6 @@ class LocalDatabase extends ChangeNotifier {
final int oldVersion,
final int newVersion,
) async {
await DaoUnzippedProduct.onUpgrade(db, oldVersion, newVersion);
await DaoProduct.onUpgrade(db, oldVersion, newVersion);
await DaoWorkBarcode.onUpgrade(db, oldVersion, newVersion);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/smooth_app/lib/pages/crop_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ class _CropPageState extends State<CropPage> {
title: appLocalizations.crop_page_too_small_image_title,
body: Text(
appLocalizations.crop_page_too_small_image_message(
BackgroundTaskImage.minimumWidth,
BackgroundTaskImage.minimumHeight,
ImageHelper.minimumWidth,
ImageHelper.minimumHeight,
width,
height,
),
Expand Down