From 17590d3c5abf885fe2b3ecb5b8dbd36f79672f9c Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 25 Feb 2018 07:26:10 -0800 Subject: [PATCH] Use thumbnail url if present when rendering the post item fixes #32 --- assets/PostItem.qml | 24 +++++++++++++++++++++++- translations/Goober.ts | 20 ++++++++++---------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/assets/PostItem.qml b/assets/PostItem.qml index 65d3f17..a186fe7 100644 --- a/assets/PostItem.qml +++ b/assets/PostItem.qml @@ -173,7 +173,7 @@ Container { } return isphoto } - defaultImage: (postitem.ListItem.view.hidePhoto()) ? "" : ptracker.image + defaultImage: (postitem.ListItem.view.hidePhoto()) ? "" : thumbtracker.image onClicked: { postitem.ListItem.view.showImage(ptracker.imageSource) } @@ -194,6 +194,28 @@ Container { } return photo_url } + }, + NetImageTracker { + id: thumbtracker + manager: postitem.ListItem.view.listImageManager + source: { + var photo_url = "" + if (typeof ListItemData.raw !== "undefined" && !postitem.ListItem.view.hidePhoto()) { + ListItemData.raw.forEach(function (item) { + if (item["type"] == "io.pnut.core.oembed") { + if (item["value"]["type"] == "photo") { + if (item["value"]["thumbnail_url"]) { + photo_url = item["value"]["thumbnail_url"] + } else { + photo_url = item["value"]["url"] + } +// photo_url = item["value"]["url"] + } + } + }) + } + return photo_url + } } ] } diff --git a/translations/Goober.ts b/translations/Goober.ts index 6aecc3c..2b48788 100644 --- a/translations/Goober.ts +++ b/translations/Goober.ts @@ -43,52 +43,52 @@ PostItem - + Reply - + Reply All - + Delete Bookmark - + Add Bookmark - + Delete Repost - + Repost - + Quote - + View Profile - + Copy text - + Delete