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: [ attachedObjects: [
NetImageTracker { NetImageTracker {
id: tracker 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 manager: postitem.ListItem.view.listImageManager
} }
] ]
@ -179,7 +179,7 @@ Container {
manager: postitem.ListItem.view.listImageManager manager: postitem.ListItem.view.listImageManager
source: { source: {
var photo_url = "" var photo_url = ""
if (typeof ListItemData.raw !== "undefined") { if (typeof ListItemData.raw !== "undefined" && !postitem.ListItem.view.hidePhoto()) {
ListItemData.raw.forEach(function (item) { ListItemData.raw.forEach(function (item) {
if (item["type"] == "io.pnut.core.oembed") { if (item["type"] == "io.pnut.core.oembed") {
if (item["value"]["type"] == "photo") { if (item["value"]["type"] == "photo") {

View file

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

View file

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