Skip to content

Commit

Permalink
Add the name of the contributor (#953)
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k authored Aug 12, 2024
1 parent f57e51c commit 9296ce6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/src/model/product_image.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'off_tagged.dart';
import '../utils/language_helper.dart';
import '../utils/open_food_api_configuration.dart';
import '../utils/uri_helper.dart';
import 'off_tagged.dart';

enum ImageField implements OffTagged {
FRONT(offTag: 'front'),
Expand Down Expand Up @@ -122,6 +122,7 @@ class ProductImage {
this.y2,
this.width,
this.height,
this.contributor,
});

ProductImage.raw({
Expand All @@ -131,6 +132,7 @@ class ProductImage {
this.width,
this.height,
this.uploaded,
this.contributor,
}) : language = null,
field = null;

Expand All @@ -142,6 +144,9 @@ class ProductImage {
/// Upload timestamp, for uploaded images only, in seconds since Unix Epoch.
DateTime? uploaded;

/// Contributor of this image
String? contributor;

/// Revision number
int? rev;

Expand Down
2 changes: 2 additions & 0 deletions lib/src/utils/json_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class JsonHelper {

// only for raw images
static const String _ALL_IMAGES_TAG_UPLOADED = 'uploaded_t';
static const String _ALL_IMAGES_TAG_UPLOADER = 'uploader';

// common to main and raw images
static const String _ALL_IMAGES_TAG_IMAGE_ID = 'imgid';
Expand Down Expand Up @@ -169,6 +170,7 @@ class JsonHelper {
height: JsonObject.parseInt(numberObject[_ALL_IMAGES_TAG_HEIGHT]),
url: numberObject[_ALL_IMAGES_TAG_URL],
uploaded: uploaded,
contributor: fieldObject[_ALL_IMAGES_TAG_UPLOADER],
),
);
}
Expand Down

0 comments on commit 9296ce6

Please sign in to comment.