attached follow/unfollow signals and cleaned up commented out code

This commit is contained in:
Morgan McMillian 2016-11-12 08:55:16 -08:00
parent c581ff985f
commit 358f0adddc
4 changed files with 26 additions and 116 deletions

View file

@ -200,8 +200,8 @@ Page {
text: qsTr("Following")
onClicked: {
var page = userListPage.createObject()
// page.follow.connect(pnut.followUser)
// page.unfollow.connect(pnut.unfollowUser)
pnut.followSuccess.connect(page.updateUser)
pnut.unfollowSuccess.connect(page.updateUser)
pnut.userListReceived.connect(page.loadThread)
pnut.getFollowing(user.id)
nav.push(page)
@ -215,8 +215,8 @@ Page {
text: qsTr("Followers")
onClicked: {
var page = userListPage.createObject()
// page.follow.connect(pnut.followUser)
// page.unfollow.connect(pnut.unfollowUser)
pnut.followSuccess.connect(page.updateUser)
pnut.unfollowSuccess.connect(page.updateUser)
pnut.userListReceived.connect(page.loadThread)
pnut.getFollowers(user.id)
nav.push(page)
@ -224,79 +224,9 @@ Page {
}
}
}
// SegmentedControl {
// Option {
// id: opt_posts
// text: qsTr("Posts")
// }
// Option {
// id: opt_following
// text: qsTr("Following")
// }
// Option {
// id: opt_followers
// text: qsTr("Followers")
// }
// onSelectedOptionChanged: {
// if (selectedOption == opt_posts) {
// threadModel.clear()
// getPosts(user.id)
// } else if (selectedOption == opt_following) {
// threadModel.clear()
// // do something
// } else if (selectedOption == opt_followers) {
// threadModel.clear()
// // do something
// }
// }
// }
// ListView {
// id: threadView
// //preferredHeight: threadModel.size()
// //preferredHeight: ( height of content row + content padding ) * count of entires in ListView
// dataModel: ArrayDataModel {
// id: threadModel
// }
// listItemComponents: [
// ListItemComponent {
// id: root
// PostItem {
// id: postitem
// }
// }
// ]
// function sendReply(text, pid) {
// pnut.sendReply(text, pid);
// }
// function getUserName() {
// return _app.setting("username")
// }
// function viewProfile(userobj) {
// var page = profilePage.createObject();
// page.user = userobj
// page.follow.connect(follow)
// page.unfollow.connect(unfollow)
// page.block.connect(block)
// page.unblock.connect(unblock)
// page.mute.connect(mute)
// page.unmute.connect(unmute)
// nav.push(page);
// }
// function ccOnReply() {
// if (_app.setting("cc") === "true") {
// return true
// } else {
// return false
// }
// }
// }
}
}
// function loadThread(data) {
// threadModel.append(data);
// }
actions: [
ActionItem {
title: (user.you_follow) ? qsTr("Unfollow") : qsTr("Follow")

View file

@ -54,9 +54,9 @@ Container {
text: (ListItemData.you_follow) ? qsTr("Unfollow") : qsTr("Follow")
onClicked: {
if (ListItemData.you_follow) {
useritem.ListItem.view.unfollow(ListItemData.id)
useritem.ListItem.view.unfollow(ListItemData)
} else {
useritem.ListItem.view.follow(ListItemData.id)
useritem.ListItem.view.follow(ListItemData)
}
}
}

View file

@ -21,12 +21,7 @@ import bb.cascades 1.4
Page {
signal follow(string uid)
signal unfollow(string uid)
signal block(string uid)
signal unblock(string uid)
signal mute(string uid)
signal unmute(string uid)
property variant updateUserObj
Container {
ListView {
@ -40,40 +35,25 @@ Page {
UserItem {}
}
]
function follow(uid) {
pnut.followUser(uid)
function follow(usero) {
console.log("---> follow")
updateUserObj = usero
pnut.followUser(usero.id)
}
function unfollow(uid) {
pnut.unfollowUser(uid)
function unfollow(usero) {
console.log("---> unfollow")
updateUserObj = usero
pnut.unfollowUser(usero.id)
}
// function sendReply(text, pid) {
// pnut.sendReply(text, pid);
// }
// function getUserName() {
// return _app.setting("username")
// }
// function viewProfile(userobj) {
// var page = profilePage.createObject();
// page.user = userobj
// page.follow.connect(follow)
// page.unfollow.connect(unfollow)
// page.block.connect(block)
// page.unblock.connect(unblock)
// page.mute.connect(mute)
// page.unmute.connect(unmute)
// nav.push(page);
// }
// function ccOnReply() {
// if (_app.setting("cc") === "true") {
// return true
// } else {
// return false
// }
// }
}
}
function loadThread(data) {
listModel.append(data);
}
function updateUser(userobj) {
console.log("---> updating entry " + listModel.indexOf(updateUserObj))
listModel.replace(listModel.indexOf(updateUserObj), userobj)
}
}

View file

@ -106,32 +106,32 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/ProfilePage.qml" line="302"/>
<location filename="../assets/ProfilePage.qml" line="232"/>
<source>Unfollow</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/ProfilePage.qml" line="302"/>
<location filename="../assets/ProfilePage.qml" line="232"/>
<source>Follow</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/ProfilePage.qml" line="315"/>
<location filename="../assets/ProfilePage.qml" line="245"/>
<source>Unmute</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/ProfilePage.qml" line="315"/>
<location filename="../assets/ProfilePage.qml" line="245"/>
<source>Mute</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/ProfilePage.qml" line="328"/>
<location filename="../assets/ProfilePage.qml" line="258"/>
<source>Unblock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/ProfilePage.qml" line="328"/>
<location filename="../assets/ProfilePage.qml" line="258"/>
<source>Block</source>
<translation type="unfinished"></translation>
</message>