From dd8273bd1876d168f8653ad82a66147d040ad750 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sat, 22 Oct 2016 12:25:59 -0700 Subject: [PATCH] fixed stream preferences and added mentions tab --- assets/.assets.index | 4 +- assets/SettingsPage.qml | 125 ++++++++++++++++++++++------------------ assets/StreamTab.qml | 42 ++++++++------ assets/icons/at.png | Bin 0 -> 1530 bytes assets/main.qml | 49 +++++++++++++++- buildnum | 2 +- config.pri | 1 + src/Pnut.cpp | 2 +- translations/Goober.ts | 36 ++++++++++-- 9 files changed, 176 insertions(+), 85 deletions(-) create mode 100644 assets/icons/at.png diff --git a/assets/.assets.index b/assets/.assets.index index 17bada9..aedfdc8 100644 --- a/assets/.assets.index +++ b/assets/.assets.index @@ -1,6 +1,7 @@ 1 -36 +38 AppCover.qml +icons/at.png icons/bell-slash.png icons/bell.png icons/comments.png @@ -34,5 +35,6 @@ NewPostSheet.qml PostItem.qml ProfilePage.qml RefreshItem.qml +SettingsPage.qml StreamTab.qml ThreadPage.qml diff --git a/assets/SettingsPage.qml b/assets/SettingsPage.qml index 2449976..c96849a 100644 --- a/assets/SettingsPage.qml +++ b/assets/SettingsPage.qml @@ -3,16 +3,17 @@ import bb.cascades 1.4 Page { id: settingsPage - signal modifySetting(string setting, variant value) - titleBar: TitleBar { title: qsTr("Settings") } + + signal reload() + ScrollView { Container { layout: StackLayout {} Container { - topPadding: 15.0 + topPadding: ui.sdu(2) } Container { layout: DockLayout {} @@ -22,75 +23,85 @@ Page { verticalAlignment: VerticalAlignment.Center leftPadding: ui.sdu(3) Label { - text: "This is my toggle" + text: qsTr("Unified Home") + textStyle.fontSize: FontSize.Medium + textStyle.fontWeight: FontWeight.Bold + } + Label { + text: qsTr("Include mentions in home stream") + textStyle.fontSize: FontSize.Small } } Container { rightPadding: ui.sdu(3) horizontalAlignment: HorizontalAlignment.Right + verticalAlignment: VerticalAlignment.Center ToggleButton { - checked: true + checked: _app.setting("unified") onCheckedChanged: { if (checked) { - modifySetting("datenew", true) + _app.setSetting("unified", true) + reload() } else { - modifySetting("datenew", false) + _app.setSetting("unified", false) + reload() } } + accessibility.name: "unified" } } } Divider {} - Container { - layout: DockLayout {} - horizontalAlignment: HorizontalAlignment.Fill - Container { - leftPadding: ui.sdu(3) - rightPadding: ui.sdu(3) - DropDown { - title: "Dropdown" - preferredWidth: 1440.0 - onSelectedIndexChanged: { - modifySetting("sort", selectedValue) - } - Option { - text: "Option Zero" - value: 0 - selected: sort == 0 - } - Option { - text: "Option Three" - value: 3 - selected: sort == 3 - } - Option { - text: "Option One" - value: 1 - selected: sort == 1 - } - Option { - text: "Option Two" - value: 2 - selected: sort == 2 - } - } - } - } - Divider {} - Container { - layout: DockLayout {} - horizontalAlignment: HorizontalAlignment.Fill - leftPadding: 30.0 - rightPadding: 30.0 - Button { - preferredWidth: 1440.0 - text: "Button" - onClicked: { - console.log("button") - } - } - } - Divider {} +// Container { +// layout: DockLayout {} +// horizontalAlignment: HorizontalAlignment.Fill +// Container { +// leftPadding: ui.sdu(3) +// rightPadding: ui.sdu(3) +// DropDown { +// title: "Dropdown" +// preferredWidth: 1440.0 +// onSelectedIndexChanged: { +// modifySetting("sort", selectedValue) +// } +// Option { +// text: "Option Zero" +// value: 0 +// selected: sort == 0 +// } +// Option { +// text: "Option Three" +// value: 3 +// selected: sort == 3 +// } +// Option { +// text: "Option One" +// value: 1 +// selected: sort == 1 +// } +// Option { +// text: "Option Two" +// value: 2 +// selected: sort == 2 +// } +// } +// } +// } +// Divider {} +// Container { +// layout: DockLayout {} +// horizontalAlignment: HorizontalAlignment.Fill +// leftPadding: 30.0 +// rightPadding: 30.0 +// Button { +// preferredWidth: 1440.0 +// text: "Button" +// onClicked: { +// console.log("button") +// } +// } +// } +// Divider {} } } } diff --git a/assets/StreamTab.qml b/assets/StreamTab.qml index b3f81e3..a189ded 100644 --- a/assets/StreamTab.qml +++ b/assets/StreamTab.qml @@ -150,10 +150,7 @@ NavigationPane { title: qsTr("Reload") ActionBar.placement: ActionBarPlacement.InOverflow onTriggered: { - postModel.clear() - pnut.beforeId = 0 - pnut.sinceId = 0 - pnut.getStream(endpoint, Pnut.STREAM_OLDER); + reload() } imageSource: "asset:///icons/ic_reload.png" }, @@ -251,10 +248,7 @@ NavigationPane { function update_user_page(user) { nav.top.user = user - postModel.clear() - pnut.beforeId = 0 - pnut.sinceId = 0 - pnut.getStream(endpoint, Pnut.STREAM_OLDER) + reload() } function update_app_cover(count) { @@ -271,15 +265,7 @@ NavigationPane { page.destroy(); } onCreationCompleted: { - switch (stream_type) { - case "Home": - endpoint = "/posts/streams/unified" - break; - case "Global": - default: - endpoint = "/posts/streams/global" - break; - } + setEndpoint() if (_app.setting("access_token") && _app.setting("access_token").length > 0) { console.log("__I think I'm authenticated") pnut.getUserInfo() @@ -291,10 +277,32 @@ NavigationPane { timer.stop() } } + function setEndpoint() { + switch (stream_type) { + case "Home": + var hometype = (_app.setting("unified") === "true") ? "unified" : "me" + endpoint = "/posts/streams/" + hometype + break; + case "Mentions": + endpoint = "/users/me/mentions" + break; + case "Global": + default: + endpoint = "/posts/streams/global" + break; + } + } function login() { pnut.authorize() } function logout() { pnut.logout() } + function reload() { + setEndpoint() + postModel.clear() + pnut.beforeId = 0 + pnut.sinceId = 0 + pnut.getStream(endpoint, Pnut.STREAM_OLDER); + } } diff --git a/assets/icons/at.png b/assets/icons/at.png new file mode 100644 index 0000000000000000000000000000000000000000..f1871493e495767f3bec07e908d56227802a2351 GIT binary patch literal 1530 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD3?#3*wF4!Xz6bb(xc(mnqaiTzLg4oAn3ces zz*rLG7tG-B>_!@hljQC0!qCAg>jC6&7I;J!Gca%qgD@k*tT_@uLG}_)Usv`ATw=of z)@K)bG66GDji-xaNXEUl5#HX19R$wVuMf?1{jk8DziXaNg+R1`px|p}-6no5t!+VD z*9Kh))5tZg7D)blBSp>n_lbp*c5a#Z_uFry*>6(Pb+or$3G&Wev*u)twVAKo$wg)P zJ$p|DoR(UU&UAUndgEzJ4o#St<2G^Mv5h4=H%@BQIK|Y)>&trTO(rjEe%kDg&7wcK zQa?iJ9}To{rIJO zjxe!aKkgPJ@Mrq8dZu~7I;Ttj*S(%L#p%gkm*P93=RHMMv==_9@xAp!ZwkJjPHwhPn!g+%N253(Pp4`(%r|*{e7Q6!|9J=u4xR7p@sL_ zSaY&wiM35=jpI&fo5aAcaWv0wdVOH5f*t34=Ebp-9Mn}B62uoI9xv9gu-_dnYA@+* z*2-nDQ}ob*&z{^eD!KxnW2XweP*Dp|Y&2z&;QTXdi-VqF+M7+5&+a9x`qBu!_6S z?ojO$^RnVzWR@svtH7KsO!KRA)zmNWtv@>L@r=*wZ0Fv)=pFE(JE~sf;;EAxv$ffO z<-Zh-s`=Q+Q|l#i@~i}F`V#TN;MtW5U_cV%qn77hIvT@zx zbu-PLbksr&Bw*rU;> z{qF=s|16aahG7XK$iTsgCoP+{>J=E + + SettingsPage + + + Settings + + + + + Unified Home + + + + + Include mentions in home stream + + + StreamTab @@ -139,7 +157,7 @@ - + To Bottom @@ -152,19 +170,25 @@ main - + Logout - - + + Home - - + + + Mentions + + + + + Global