GReader-Like Mobile Version

Development-related discussion, including bundled plugins
ReineW
Bear Rating Trainee
Bear Rating Trainee
Posts: 9
Joined: 21 Mar 2013, 04:16

Re: GReader-Like Mobile Version

Postby ReineW » 31 Mar 2013, 03:01

G2TT-mobile wrote:
ReineW wrote:J0nson, i just installed your GReader mobile and i love it! The look and feel is just like google reader, you did a really good job! This was the final thing i missed before i could do a transition to tt-rss, the other mobile clients i didn't like so much and i do alot of reading on my mobile so i want a quick gui. It's even quicker and snappier than Google :-D

Some minor wishes, i would like to be able to choose a subcategory so i can read just one feed and not the whole group/category, and the login screen could be a little nicer...


ReineW, are you referring to j0nson's version or the one I just posted? Trying to determine who you are making the request of.

I'm sorry, the one you just posted, i've mixed you guys up :-(

G2TT-mobile
Bear Rating Disaster
Bear Rating Disaster
Posts: 52
Joined: 30 Mar 2013, 00:47

Re: GReader-Like Mobile Version

Postby G2TT-mobile » 01 Apr 2013, 20:49

ReineW,

I'm looking into adding subcategory support but the problem is that the APIs (at least not that I see) do not return the data necessary. For example, I cannot find an appropriate call that returns a category's subcategories, nor when returning all categories, does it specify which is a sub or not (let alone who it is a sub of). My final solution may include a patch to TT-RSS to support SubCategories through the APIs if you are comfortable modifying that.

G2TT-mobile
Bear Rating Disaster
Bear Rating Disaster
Posts: 52
Joined: 30 Mar 2013, 00:47

Re: GReader-Like Mobile Version

Postby G2TT-mobile » 02 Apr 2013, 02:46

Alright, I added SubCategory support but it is not thoroughly tested because I do not use subcategories (Google Reader does not support them). If a category has subcategories, selecting it will display the subcategories, otherwise it will display the articles as before. If you select the top/parent category while viewing subcategories, that will view that category and all its subcategory's articles.

I DID have to modify classes/api.php to support this so here is the patch/changes I made:

Code: Select all

--- a/classes/api.php   2013-04-01 15:20:41.724142074 -0700
+++ b/classes/api.php   2013-04-01 15:20:30.064233753 -0700
@@ -122,16 +122,17 @@ class API extends Handler {
    function getCategories() {
       $unread_only = sql_bool_to_bool($_REQUEST["unread_only"]);
       $enable_nested = sql_bool_to_bool($_REQUEST["enable_nested"]);
+      $nested_cat = sql_bool_to_bool($_REQUEST["nested_cat"]);
 
       // TODO do not return empty categories, return Uncategorized and standard virtual cats
 
-      if ($enable_nested)
+      if ($enable_nested && !$nested_cat)
          $nested_qpart = "parent_cat IS NULL";
       else
          $nested_qpart = "true";
 
       $result = db_query($this->link, "SELECT
-            id, title, order_id, (SELECT COUNT(id) FROM
+            id, title, order_id, parent_cat, (SELECT COUNT(id) FROM
             ttrss_feeds WHERE
             ttrss_feed_categories.id IS NOT NULL AND cat_id = ttrss_feed_categories.id) AS num_feeds
          FROM ttrss_feed_categories
@@ -152,6 +153,7 @@ class API extends Handler {
                   "title" => $line["title"],
                   "unread" => $unread,
                   "order_id" => (int) $line["order_id"],
+                  "parent" => (int) $line["parent_cat"],
                ));
             }
          }


I probably could have made this cleaner, but my goal was to modify tt-rss code as little as possible.
Attachments
gmobile-ttrss.zip
Files for Google-esq mobile interface, requires subcategory patch to tt-rss APIs.
(127.19 KiB) Downloaded 126 times

j0nson
Bear Rating Trainee
Bear Rating Trainee
Posts: 21
Joined: 16 Mar 2013, 04:41

Re: GReader-Like Mobile Version

Postby j0nson » 02 Apr 2013, 08:11

G2TT-mobile wrote:Alright,


nicely done, but did you have to make it look and feel exactly like google reader? I mean, user interface is not their strong suit!! They are masters at function, but they have lost it a bit in the last few years trying to make things look pretty. I mean... look at all the wasted screen space!

You are welcome to collaborate if you like (https://github.com/j0nson/tt-rss_mobile). Actually, you should probably just rewrite my code completely since you have added jquery... no need for php curl when you already have jquery loaded.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: GReader-Like Mobile Version

Postby fox » 02 Apr 2013, 09:03

>I'm looking into adding subcategory support but the problem is that the APIs (at least not that I see) do not return the data necessary.

You are using it wrong.

G2TT-mobile
Bear Rating Disaster
Bear Rating Disaster
Posts: 52
Joined: 30 Mar 2013, 00:47

Re: GReader-Like Mobile Version

Postby G2TT-mobile » 02 Apr 2013, 16:57

fox wrote:>I'm looking into adding subcategory support but the problem is that the APIs (at least not that I see) do not return the data necessary.

You are using it wrong.


Hi fox, sorry, I was going off your response in the "Support Subcategory" thread from September ("I still have no idea how to add subcategories to the API properly, this will come later.") which was the most recent comment on it that I found as well as my understanding of the APIs. BUT, I know see that the API documentation has been updated in the past few days (few hours?) to include this under getCategories:

Code: Select all

This should be used as a starting point, to display a root list of all (for backwards compatibility) or topmost categories, use getFeeds to traverse deeper.


I will look into getFeeds and likely update my mobile UI to work without any modification to the base code.

Thanks for the response cause it got me searching the site and code more to discover what I missed.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: GReader-Like Mobile Version

Postby fox » 02 Apr 2013, 17:01

Yeah, I've added that precisely because of this post, it never occured to me somehow that it was unclear that this information should be received by other means (e.g. getFeeds). D'oh.

I'm not sure maybe adding this to getCategories() is a valid approach too, in case you don't want feeds in the output for some reason.

Edit: android client can be considered a reference implementation of an api client I suppose. You can always look there too.

G2TT-mobile
Bear Rating Disaster
Bear Rating Disaster
Posts: 52
Joined: 30 Mar 2013, 00:47

Re: GReader-Like Mobile Version

Postby G2TT-mobile » 04 Apr 2013, 00:12

fox wrote:Yeah, I've added that precisely because of this post, it never occured to me somehow that it was unclear that this information should be received by other means (e.g. getFeeds). D'oh.

I'm not sure maybe adding this to getCategories() is a valid approach too, in case you don't want feeds in the output for some reason.

Edit: android client can be considered a reference implementation of an api client I suppose. You can always look there too.


Ah, I see. I was doing getFeeds on category -3 and that doesn't list subcategories. It appears I have to enumerate through all categories to see if they contain a subcategory or not (it isn't even recursive, so if a subcategory has a subcategory, it isn't returned when asking about the top-most parent). I can make that work, just requires an API request for every category instead of just 1 API request. Will be slower for people who use many categories (O(n) instead of O(1)).

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: GReader-Like Mobile Version

Postby fox » 04 Apr 2013, 00:15

See this is why you use getFeedTree instead and get all the hierarchy in one call.

G2TT-mobile
Bear Rating Disaster
Bear Rating Disaster
Posts: 52
Joined: 30 Mar 2013, 00:47

Re: GReader-Like Mobile Version

Postby G2TT-mobile » 04 Apr 2013, 00:23

Awesome! Thanks. Didn't catch that change in 1.7.6. Very grateful that you take the time to reply and help out.

G2TT-mobile
Bear Rating Disaster
Bear Rating Disaster
Posts: 52
Joined: 30 Mar 2013, 00:47

Re: GReader-Like Mobile Version

Postby G2TT-mobile » 04 Apr 2013, 03:27

Alright, updated to use getFeedTree() and does not require any modification to the base tt-rss code. However, getFeedTree()'s unread counts are just placeholders and so I still had to make an additional API call for each category (if you look at the source of getUnread you can find out that it takes parameters even though http://tt-rss.org/redmine/projects/tt-r ... iReference does not document it). But getUnread does not support a nested unread count so I had to fiddle with some of my recursion logic to get the unread count of all children.

The extra API calls increase the overhead of initial load. Maybe if I dug in the code more I could come up with a cleaner way to do this but in the end this was a fun exercise!
Attachments
gmobile-ttrss.zip
(127.45 KiB) Downloaded 122 times

johnh123
Bear Rating Trainee
Bear Rating Trainee
Posts: 3
Joined: 04 Apr 2013, 00:58

Re: GReader-Like Mobile Version

Postby johnh123 » 04 Apr 2013, 04:53

I'm installed in .../tt-rss/m and get a page not found. External api is active and working with the mobile apps. Any thoughts as to what may be wrong with what I am doing?

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: GReader-Like Mobile Version

Postby fox » 04 Apr 2013, 08:58

>However, getFeedTree()'s unread counts are just placeholders and so I still had to make an additional API call for each category

This is when you use getCounters, I think.

User avatar
sancho1234
Bear Rating Trainee
Bear Rating Trainee
Posts: 44
Joined: 30 Mar 2013, 04:19
Location: Hungary
Contact:

Re: GReader-Like Mobile Version

Postby sancho1234 » 04 Apr 2013, 17:30

johnh123 wrote:I'm installed in .../tt-rss/m and get a page not found. External api is active and working with the mobile apps. Any thoughts as to what may be wrong with what I am doing?

Extenral API enabled?
Image

ReineW
Bear Rating Trainee
Bear Rating Trainee
Posts: 9
Joined: 21 Mar 2013, 04:16

Re: GReader-Like Mobile Version

Postby ReineW » 05 Apr 2013, 05:06

Can't get the latest update to work, no categories are visible...?

* The class="Load-more-message hidden">load more items..., will you continue to work on that? I miss that function.
* Maybe add a search function?


Return to “Development”

Who is online

Users browsing this forum: No registered users and 2 guests