Skip to content

Commit

Permalink
fix: contributor correctly displayed
Browse files Browse the repository at this point in the history
Impacted files:
* `json_helper.dart`: contributor correctly included in `toJson`
* `product_image.dart`: contributor correctly included in `toString`
  • Loading branch information
monsieurtanuki committed Nov 28, 2024
1 parent 43bb499 commit fd8a16a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/src/model/product_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ class ProductImage {
'${angle == null ? '' : ',angle=${angle!.degreesClockwise}'}'
'${url == null ? '' : ',url=$url'}'
'${uploaded == null ? '' : ',uploaded=$uploaded'}'
'${contributor == null ? '' : ',uploader=$contributor'}'
'${imgid == null ? '' : ',imgid=$imgid'}'
'${rev == null ? '' : ',rev=$rev'}'
'${coordinatesImageSize == null ? '' : ',coordinatesImageSize=$coordinatesImageSize'}'
Expand Down
6 changes: 5 additions & 1 deletion lib/src/utils/json_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class JsonHelper {
if (imageId != null) {
final DateTime? uploaded =
timestampToDate(fieldObject[_ALL_IMAGES_TAG_UPLOADED]);
final String? contributor = fieldObject[_ALL_IMAGES_TAG_UPLOADER];
// get each number object (e.g. 200)
for (var size in ImageSize.values) {
var number = size.number;
Expand All @@ -159,7 +160,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],
contributor: contributor,
),
);
}
Expand Down Expand Up @@ -277,6 +278,9 @@ class JsonHelper {
item[_ALL_IMAGES_TAG_UPLOADED] =
dateToTimestamp(productImage.uploaded);
}
if (productImage.contributor != null) {
item[_ALL_IMAGES_TAG_UPLOADER] = productImage.contributor;
}
} else {
if (productImage.rev != null) {
item[_ALL_IMAGES_TAG_REVISION] = productImage.rev.toString();
Expand Down

0 comments on commit fd8a16a

Please sign in to comment.