Use thumbnail url if present when rendering the post item fixes #32

This commit is contained in:
Morgan McMillian 2018-02-25 07:26:10 -08:00
parent ec769a3771
commit 17590d3c5a
2 changed files with 33 additions and 11 deletions

View file

@ -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
}
}
]
}

View file

@ -43,52 +43,52 @@
<context>
<name>PostItem</name>
<message>
<location filename="../assets/PostItem.qml" line="226"/>
<location filename="../assets/PostItem.qml" line="248"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="235"/>
<location filename="../assets/PostItem.qml" line="257"/>
<source>Reply All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="245"/>
<location filename="../assets/PostItem.qml" line="267"/>
<source>Delete Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="245"/>
<location filename="../assets/PostItem.qml" line="267"/>
<source>Add Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="256"/>
<location filename="../assets/PostItem.qml" line="278"/>
<source>Delete Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="256"/>
<location filename="../assets/PostItem.qml" line="278"/>
<source>Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="267"/>
<location filename="../assets/PostItem.qml" line="289"/>
<source>Quote</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="276"/>
<location filename="../assets/PostItem.qml" line="298"/>
<source>View Profile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="283"/>
<location filename="../assets/PostItem.qml" line="305"/>
<source>Copy text</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="313"/>
<location filename="../assets/PostItem.qml" line="335"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>