prevent network requests when images are being hidden

This commit is contained in:
Morgan McMillian 2017-11-16 17:03:29 -08:00
parent cf0919d06a
commit 49d58341c3
3 changed files with 6 additions and 8 deletions

View file

@ -54,7 +54,7 @@ Container {
attachedObjects: [
NetImageTracker {
id: tracker
source: ListItemData.user.content.avatar_image.link
source: (postitem.ListItem.view.hidePhoto()) ? "" : ListItemData.user.content.avatar_image.link
manager: postitem.ListItem.view.listImageManager
}
]
@ -179,7 +179,7 @@ Container {
manager: postitem.ListItem.view.listImageManager
source: {
var photo_url = ""
if (typeof ListItemData.raw !== "undefined") {
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") {

View file

@ -121,10 +121,8 @@ NavigationPane {
}
function hidePhoto() {
if (_app.setting("hidephoto") === "true") {
console.log("HIDE IT!")
return true
} else {
console.log("show me da photos")
return false
}
}

View file

@ -213,22 +213,22 @@
<context>
<name>StreamTab</name>
<message>
<location filename="../assets/StreamTab.qml" line="164"/>
<location filename="../assets/StreamTab.qml" line="162"/>
<source>New Post</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="178"/>
<location filename="../assets/StreamTab.qml" line="176"/>
<source>To Top</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="206"/>
<location filename="../assets/StreamTab.qml" line="204"/>
<source>To Bottom</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="193"/>
<location filename="../assets/StreamTab.qml" line="191"/>
<source>Reload</source>
<translation type="unfinished"></translation>
</message>