Skip to content

Commit

Permalink
fix!: removed deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurtanuki committed Aug 25, 2023
1 parent 527373a commit fecbd65
Show file tree
Hide file tree
Showing 28 changed files with 1 addition and 642 deletions.
2 changes: 0 additions & 2 deletions lib/openfoodfacts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export 'src/model/product.dart';
export 'src/model/product_freshness.dart';
export 'src/model/product_image.dart';
export 'src/model/product_packaging.dart';
export 'src/model/product_result.dart';
export 'src/model/product_result_field_answer.dart';
export 'src/model/product_result_v3.dart';
export 'src/model/product_state.dart';
Expand Down Expand Up @@ -111,4 +110,3 @@ export 'src/utils/unit_helper.dart';
export 'src/utils/uri_helper.dart';
export 'src/utils/uri_reader.dart';
export 'src/robot_off_api_client.dart';
export 'src/utils/user_product_search_query_configuration.dart';
4 changes: 0 additions & 4 deletions lib/src/model/allergens.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ enum AllergensTag implements OffTagged {

@override
final String offTag;

// TODO: deprecated from 2022-11-12; remove when old enough
@Deprecated('Use offTag instead')
String get tag => offTag;
}

/// List of known allergens for a [Product].
Expand Down
35 changes: 0 additions & 35 deletions lib/src/model/environment_impact_levels.dart

This file was deleted.

12 changes: 0 additions & 12 deletions lib/src/model/ingredients_analysis_tags.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ enum VeganStatus implements OffTagged {

@override
final String offTag;

// TODO: deprecated from 2022-11-12; remove when old enough
@Deprecated('Use offTag instead')
String get tag => offTag;
}

enum VegetarianStatus implements OffTagged {
Expand All @@ -30,10 +26,6 @@ enum VegetarianStatus implements OffTagged {

@override
final String offTag;

// TODO: deprecated from 2022-11-12; remove when old enough
@Deprecated('Use offTag instead')
String get tag => offTag;
}

enum PalmOilFreeStatus implements OffTagged {
Expand All @@ -48,10 +40,6 @@ enum PalmOilFreeStatus implements OffTagged {

@override
final String offTag;

// TODO: deprecated from 2022-11-12; remove when old enough
@Deprecated('Use offTag instead')
String get tag => offTag;
}

class IngredientsAnalysisTags {
Expand Down
13 changes: 0 additions & 13 deletions lib/src/model/insight.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,6 @@ enum InsightType implements OffTagged {
OffTagged.fromOffTag(offTag, InsightType.values) as InsightType?;
}

// TODO: deprecated from 2023-06-13; remove when old enough
@Deprecated('Use directly InsightType instead')
extension InsightTypesExtension on InsightType? {
// TODO: deprecated from 2023-06-13; remove when old enough
@Deprecated('Use offTag instead')
String? get value => this?.offTag;

// TODO: deprecated from 2023-06-13; remove when old enough
@Deprecated('Use InsightType.fromOffTag instead')
static InsightType getType(String? s) =>
InsightType.fromOffTag(s) ?? InsightType.UNDEFINED;
}

@JsonSerializable()
class InsightsResult extends JsonObject {
final String? status;
Expand Down
15 changes: 0 additions & 15 deletions lib/src/model/knowledge_panel_element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,21 +298,6 @@ class KnowledgePanelTableElement extends JsonObject {
/// "Contribute action" element of the Knowledge panel.
@JsonSerializable()
class KnowledgePanelActionElement extends JsonObject {
/// Possible needed contribute action: add categories.
// TODO: deprecated from 2023-05-13; remove when old enough
@Deprecated('Use KnowledgePanelAction instead')
static const String ACTION_ADD_CATEGORIES = 'add_categories';

/// Possible needed contribute action: add ingredients text.
// TODO: deprecated from 2023-05-13; remove when old enough
@Deprecated('Use KnowledgePanelAction instead')
static const String ACTION_ADD_INGREDIENTS_TEXT = 'add_ingredients_text';

/// Possible needed contribute action: add nutrition facts.
// TODO: deprecated from 2023-05-13; remove when old enough
@Deprecated('Use KnowledgePanelAction instead')
static const String ACTION_ADD_NUTRITION_FACTS = 'add_nutrition_facts';

/// HTML description.
final String html;

Expand Down
4 changes: 0 additions & 4 deletions lib/src/model/parameter/tag_filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ enum TagFilterType implements OffTagged {

@override
final String offTag;

// TODO: deprecated from 2022-11-06; remove when old enough
@Deprecated('Use offTag instead')
String get key => offTag;
}

/// Tag filter ("LIST contains/without ITEM") search API parameter
Expand Down
28 changes: 1 addition & 27 deletions lib/src/model/product.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'allergens.dart';
import 'attribute.dart';
import 'attribute_group.dart';
import 'ecoscore_data.dart';
import 'environment_impact_levels.dart';
import 'ingredient.dart';
import 'ingredients_analysis_tags.dart';
import 'knowledge_panels.dart';
Expand Down Expand Up @@ -69,10 +68,6 @@ enum ProductImprovement {
});

final ProductImprovementCategory category;

// TODO: deprecated from 2022-11-12; remove when old enough
@Deprecated('Use category instead')
ProductImprovementCategory getCategory() => category;
}

/// Category: what would this [ProductImprovement] help compute?
Expand Down Expand Up @@ -245,15 +240,6 @@ class Product extends JsonObject {
toJson: Additives.additivesToJson)
Additives? additives;

// TODO: deprecated from 2022-10-25; remove when old enough
@Deprecated('Use ecoscore fields instead')
@JsonKey(
name: 'environment_impact_level_tags',
includeIfNull: false,
fromJson: EnvironmentImpactLevels.fromJson,
toJson: EnvironmentImpactLevels.toJson)
EnvironmentImpactLevels? environmentImpactLevels;

@JsonKey(
name: 'allergens_tags',
includeIfNull: false,
Expand Down Expand Up @@ -314,8 +300,6 @@ class Product extends JsonObject {
includeIfNull: false)
Map<OpenFoodFactsLanguage, List<String>>? labelsTagsInLanguages;

// TODO: deprecated from 2022-12-16; remove when old enough
@Deprecated('User packagingS instead')
@JsonKey(name: 'packaging', includeIfNull: false)
String? packaging;

Expand Down Expand Up @@ -449,14 +433,6 @@ class Product extends JsonObject {
toJson: KnowledgePanels.toJsonHelper)
KnowledgePanels? knowledgePanels;

// TODO: deprecated from 2022-10-25; remove when old enough
@Deprecated('Use ecoscore fields instead')
@JsonKey(
name: 'environment_infocard',
includeIfNull: false,
)
String? environmentInfoCard;

@JsonKey(name: 'emb_codes', includeIfNull: false)
String? embCodes;

Expand Down Expand Up @@ -505,7 +481,6 @@ class Product extends JsonObject {
this.ingredientsTagsInLanguages,
this.ingredientsAnalysisTags,
this.additives,
this.environmentImpactLevels,
this.allergens,
this.nutrientLevels,
this.nutrimentEnergyUnit,
Expand All @@ -517,8 +492,7 @@ class Product extends JsonObject {
this.labels,
this.labelsTags,
this.labelsTagsInLanguages,
// TODO: deprecated from 2022-12-16; remove when old enough
@Deprecated('Use packagingS field instead') this.packaging,
this.packaging,
this.packagingTags,
this.miscTags,
this.statesTags,
Expand Down
9 changes: 0 additions & 9 deletions lib/src/model/product.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 0 additions & 23 deletions lib/src/model/product_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,6 @@ enum ImageField implements OffTagged {
/// Returns the first [ImageField] that matches the [offTag].
static ImageField? fromOffTag(final String? offTag) =>
OffTagged.fromOffTag(offTag, ImageField.values) as ImageField?;

// TODO: deprecated from 2022-11-13; remove when old enough
@Deprecated('Use field.offTag instead')
String get value => offTag;
}

extension ImageFieldExtension on ImageField {
// TODO: deprecated from 2022-11-13; remove when old enough
@Deprecated('Use field.offTag instead')
static String getValue(ImageField field) => field.offTag;

// TODO: deprecated from 2022-11-13; remove when old enough
@Deprecated('Use ImageField.fromOffTag instead')
static ImageField getType(String s) =>
ImageField.fromOffTag(s.toLowerCase()) ?? ImageField.OTHER;
}

enum ImageSize implements OffTagged {
Expand Down Expand Up @@ -63,14 +48,6 @@ enum ImageSize implements OffTagged {
}

extension ImageSizeExtension on ImageSize? {
// TODO: deprecated from 2022-11-13; remove when old enough
@Deprecated('Use offTag instead')
String get value => (this ?? ImageSize.UNKNOWN).offTag;

// TODO: deprecated from 2022-11-13; remove when old enough
@Deprecated('Use number instead')
String toNumber() => (this ?? ImageSize.UNKNOWN).number;

static ImageSize getType(String s) => ImageSize.values.firstWhere(
(final ImageSize key) => key.offTag == s.toLowerCase(),
orElse: () => ImageSize.UNKNOWN,
Expand Down
26 changes: 0 additions & 26 deletions lib/src/model/product_result.dart

This file was deleted.

28 changes: 0 additions & 28 deletions lib/src/model/product_result.g.dart

This file was deleted.

4 changes: 0 additions & 4 deletions lib/src/model/taxonomy_additive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ enum TaxonomyAdditiveField implements OffTagged {

@override
final String offTag;

// TODO: deprecated from 2022-11-12; remove when old enough
@Deprecated('Use offTag instead')
String get key => offTag;
}

/// A JSON-serializable version of a Additive taxonomy result.
Expand Down
4 changes: 0 additions & 4 deletions lib/src/model/taxonomy_allergen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ enum TaxonomyAllergenField implements OffTagged {

@override
final String offTag;

// TODO: deprecated from 2022-11-12; remove when old enough
@Deprecated('Use offTag instead')
String get key => offTag;
}

/// A JSON-serializable version of a Allergen taxonomy result.
Expand Down
4 changes: 0 additions & 4 deletions lib/src/model/taxonomy_category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ enum TaxonomyCategoryField implements OffTagged {

@override
final String offTag;

// TODO: deprecated from 2022-11-12; remove when old enough
@Deprecated('Use offTag instead')
String get key => offTag;
}

/// A JSON-serializable version of a category taxonomy result.
Expand Down
Loading

0 comments on commit fecbd65

Please sign in to comment.