diff --git a/Goober.pro b/Goober.pro index 458c558..d9ea75d 100644 --- a/Goober.pro +++ b/Goober.pro @@ -1,7 +1,7 @@ APP_NAME = Goober CONFIG += qt warn_on cascades10 -LIBS += -lbbdata +LIBS += -lbbdata -lbbsystem QT += network include(config.pri) diff --git a/assets/.assets.index b/assets/.assets.index index 5a7c16b..6e8d35c 100644 --- a/assets/.assets.index +++ b/assets/.assets.index @@ -1,9 +1,10 @@ 1 -40 +41 AppCover.qml icons/at.png icons/bell-slash.png icons/bell.png +icons/bookmark.png icons/comments.png icons/default_cover.png icons/globe.png diff --git a/assets/StreamTab.qml b/assets/StreamTab.qml index 4800ad7..ecd34bf 100644 --- a/assets/StreamTab.qml +++ b/assets/StreamTab.qml @@ -30,6 +30,7 @@ NavigationPane { property int unread: -1 property bool refreshpull: false property bool active + property bool at_end: false signal openLogin() signal closeLogin() @@ -109,13 +110,13 @@ NavigationPane { ListScrollStateHandler { onAtEndChanged: { if (atEnd) { - console.log("I'm at the end!!!") - pnut.getStream(endpoint, Pnut.STREAM_OLDER); + if (!at_end && pnut.beforeId != 0) { + pnut.getStream(endpoint, Pnut.STREAM_OLDER); + } } } onAtBeginningChanged: { if (atBeginning) { - console.log("I'm at the top!!!") unread = 0 nav.parent.unreadContentCount = unread } @@ -213,15 +214,18 @@ NavigationPane { onStreamReceived: { - stream.forEach(function(post) { - if (post.is_deleted) { - console.log("got a deleted post") - } - }) +// stream.forEach(function(post) { +// if (post.is_deleted) { +// console.log("got a deleted post") +// } +// }) switch (rtype) { case Pnut.STREAM_OLDER: //streamView.scrollToPosition(ScrollPosition.End, ScrollAnimation.None); + if (stream.length < 50) { + at_end = true + } postModel.append(stream); break; case Pnut.STREAM_NEWER: @@ -316,6 +320,9 @@ NavigationPane { case "Mentions": endpoint = "/users/me/mentions" break; + case "Bookmarks": + endpoint = "/users/me/bookmarks" + break; case "Global": default: endpoint = "/posts/streams/global" diff --git a/assets/icons/bookmark.png b/assets/icons/bookmark.png new file mode 100644 index 0000000..4916d12 Binary files /dev/null and b/assets/icons/bookmark.png differ diff --git a/assets/main.qml b/assets/main.qml index 84d33d0..f4e0413 100644 --- a/assets/main.qml +++ b/assets/main.qml @@ -98,6 +98,28 @@ TabbedPane { } } + Tab { + id: bookmarksStream + title: qsTr("Bookmarks") + objectName: "BookmarksTab" + delegate: Delegate { + StreamTab { + title: qsTr("Bookmarks") + stream_type: "Bookmarks" + onOpenLogin: { + loginSheet.open() + } + onCloseLogin: { + loginSheet.close() + } + } + } + imageSource: "asset:///icons/bookmark.png" + onUnreadContentCountChanged: { + _activeFrame.setGlobalUnread(unreadContentCount) + } + } + Tab { id: globalStream title: qsTr("Global") diff --git a/buildnum b/buildnum index e99fdcc..b3b2268 100644 --- a/buildnum +++ b/buildnum @@ -1 +1 @@ -217 \ No newline at end of file +228 \ No newline at end of file diff --git a/config.pri b/config.pri index 3a4934e..cf67b3d 100644 --- a/config.pri +++ b/config.pri @@ -78,6 +78,7 @@ config_pri_assets { $$quote($$BASEDIR/assets/icons/at.png) \ $$quote($$BASEDIR/assets/icons/bell-slash.png) \ $$quote($$BASEDIR/assets/icons/bell.png) \ + $$quote($$BASEDIR/assets/icons/bookmark.png) \ $$quote($$BASEDIR/assets/icons/comments.png) \ $$quote($$BASEDIR/assets/icons/default_cover.png) \ $$quote($$BASEDIR/assets/icons/globe.png) \ diff --git a/src/Pnut.cpp b/src/Pnut.cpp index f392d94..7e8b4a0 100644 --- a/src/Pnut.cpp +++ b/src/Pnut.cpp @@ -180,6 +180,9 @@ void Pnut::onRequestReady(QByteArray data) qDebug() << "- NetworkError -"; getUserInfo(); break; + default: + qDebug() << "- other? -"; + qDebug() << oauthManager->lastError(); } } @@ -189,7 +192,7 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id) qDebug() << "- onAuthorizedRequestReady"; qDebug() << "- id: " << id; qDebug() << "- endpoint: " << endpoint; - qDebug() << data; +// qDebug() << data; QVariant variant; bb::data::JsonDataAccess jda; @@ -201,7 +204,9 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id) { case Pnut::OK: { - if (endpoint.startsWith("/posts/streams/") || endpoint == "/users/me/mentions") + if (endpoint.startsWith("/posts/streams/") || + endpoint == "/users/me/mentions" || + endpoint == "/users/me/bookmarks") { Pnut::RequestType rtype = rtype_map[id]; emit streamReceived(variant.toMap()["data"].toList(), rtype); @@ -275,7 +280,8 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id) QString gpid = endpoint.replace(":deletepost:",""); getPost(gpid); } - else { + else + { qDebug() << "GOT SOMETHING NEW!"; qDebug() << endpoint; } @@ -285,7 +291,7 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id) { if (endpoint == "/posts") { - qDebug() << "Success!"; + qDebug() << "Create post success!"; req_map.remove(id); } else diff --git a/translations/Goober.ts b/translations/Goober.ts index 076952f..c8751aa 100644 --- a/translations/Goober.ts +++ b/translations/Goober.ts @@ -162,22 +162,22 @@ StreamTab - + New Post - + To Top - + To Bottom - + Reload @@ -204,6 +204,12 @@ + Bookmarks + + + + + Global