Recipes : Wrapping up GSoC ’17

Overview

Its been almost three months that I embarked on GSoC journey with GNOME. And its time to wrap it up. So here it goes ..

My GSoC project was a feature addition to Recipes which was sending the shopping lists to the Todoist. Here are ths sub-tasks the project got divided into :

GNOME-ONLINE-ACCOUNTS

  • Writing a Todoist Provider for gnome-online-accounts
  • Making it hidden from the control center unless there’s an account for it

RECIPES

  • UI implementation (A sharing dialog) for exporting the shopping list
  • Implementation of sending the shopping list to the Todoist app
  • Mark shopping list done in Todoist when marked done in Recipes
  • Avoid sending duplicate items(items once sent already) to the Todoist.

Here is the link to the code base : gnome-online-accounts , recipes

FUTURE FEATURES

  • Sharing isn’t confined to to do-list inside Todoist. Sharing the shopping lists and Recipes to other platforms would be included
  • Introducing Mock-tails as a feature in Recipes
  • Integrating Videos for the Recipes … and many more ..

However this is not the end of this amazing journey I started with GNOME. There’s a lot more learning and fun to come..

And Many Thanks to my mentor Matthias Clasen for all the support through out this span starting from the day I reported my first bug in Recipes. :) 

Sending the Ingredient List to Todoist

A milestone. After placing the UI elements in place, came the real functionality which was to send the ingredients list from Recipes to Todoist.

We’re using REST Apis of Todoist with Librest  to make calls from Recipes. The responses are processed using JsonGlib. In the process that has a description that small, I hit problems and got different error codes : Error code 401: Accidentally sending another provider’s access token with an api call, Error 400: caused by missing parameters / trying to add a JsonArray as a parameter to a RestProxyCall. Before these error codes came RestProxyCall throwing errors in terminal saying RestProxyCall can’t be reused which was caused by an attempt to make various calls using a single instance of RestProxyCall . Well getting past all these silly tiny things was fun. 😀

Here is the result to the fun and the work…  This is how it looks like …

 

The UI elements to the TODOist Integration with Recipes

Control Center…

Before starting the project, there was a question as how to deal with TODOist account showing  up in control center and serving no purpose when Recipes and gnome-TODO aren’t installed, both of them being non-core apps.

So, what we did is hide Provider i.e. TODOist from the control center from the providers list and only show it if account is already configured. This hiding is done using a property in gnome-online-accounts that control center respects so as to display todoist or not. But how would that account get added if the provider isn’t visible in the control-center. Solution for this is letting the app itself, be it Recipes or gnome-todo add an account for TODOist. We use an AddAccount method written by Rohit Kaushik (GSoCer with gnome-todo).

 

Recipes…

This is about the user interface to share the ingredients list to TODOist. A dialog with primary things in it : providers list that have integration with Recipes to add new accounts (it’s is just TODOist at the moment) and the accounts (already once configured) to send ingredients. And this is how it looks like

 

But the control center still crashes..

In the last milestone, adding a TODOist provider to gnome-online-accounts looked like it had a bug which made the control-center crash. Here’s a brief description as to what happened :

  • Run the control center.
  • Add the TODOist account.
      • The dialog to enter the credentials opens.
      • If you cross the above step, it asks for permission to access resources from your account.
      • Granting the permissions, the accounts.conf file gets written and the account gets added.

    And BAM!! it crashes.

    Next time you run the control-center right away, the account would be there showing up all nice.

Hence we go to GDB to seek help about what’s the matter with gnome-online-accounts or control-center. Now GDB’s stack trace (which I’ve lost now and can’t reproduce due to some other graphics problems) pointed out some problem with the Intel graphics drivers which I obviously did not know as how to overcome.

Then in discussion with mclasen about this thing, he pointed out the workaround for the bug which was running control center with the prefix

GDK_BACKEND=x11 

and yay! it works now.  Now this had something to do with wayland backend creating some issues with Intel graphics drivers which I cannot really decode at the moment ¯\_(ツ)_/¯

And closing this one with a realization I had after this bug:

“All software has bugs, and a working system is just one where most bugs are not triggered too frequently” –mclasen

Adding TODOist Provider

The first milestone of the project – writing a TODOist Provider for gnome-online-accounts. This provider will be used for authentication of user and providing authorization to read/write todo-lists from Recipes to TODOist.

The API documentation for TODOist is available here.

    • The process started from registering Recipes and getting the client_id and client_secret from the TODOist.
    • Then comes coding the GoaTodoistProvider that implements GoaOAuth2Provider. Subclasses must implement these methods from GoaOAuth2ProviderClass:
      • GoaOAuth2ProviderClass.get_authorization_uri: getting the authorization url
      • GoaOAuth2ProviderClass.get_token_uri : getting the token url
      • GoaOAuth2ProviderClass.get_redirect_uri : getting the redirection url (which is https://localhost/ for Desktop Clients)
      • GoaOAuth2ProviderClass.get_scope : decides the level of access to ask from the user
      • GoaOAuth2ProviderClass.get_client_id : getting the client_id obtained from TODOist.
      • GoaOAuth2ProviderClass.get_client_secret : getting the client_secret obtained from TODOist
      • GoaOAuth2ProviderClass.get_identity_sync : to obtain the presentation_id (email id in this case) from the json object returned using REST API by reading user’s properties
    • Additionally, the GoaProviderClass methods (that should chain up to its parent class) must be implemented: GoaProviderClass.get_provider_type, GoaProviderClass.get_provider_name , GoaProviderClass.build_object

The final view of how the provider looks like this:

TODOIST LOGIN

 

TODOIST ACCOUNT

And the official coding period begins…

Hello there ! This is my first post about my GSoC project.

About Project

As the title says Sharing of shopping lists from Recipes to TODOist which is self explanatory.

Implementation

There would be addition of minute details as and when the steps gets implemented. The implementation is basically divided into two steps.

  1. Implement gnome-online-accounts Provider for TODOist. (Along with that taking care of the fact that Recipes being non-core app,if isn’t installed, this implementation doesn’t end up having TODOist account that serves no purpose)

  2.  Implement sending shopping list/s from Recipes to TODOist along with sync in the deletion of items

    Onto the implementation of step one. I am digging my way through gnome-online-accounts to write a TODOist provider. Stay tuned for more details! 😉

Hello world!

About Myself

I am Ekta Nandwani, an open-source enthusiast, a foodie and a music lover. I’ve done my major in Computer Science at L.D. College of Engineering. This summer I’ve been selected as a Google Summer of Code Intern under GNOME Foundation. I am quite excited about the opportunity to work in such a great community this summer.

 

I’ll be blogging about my GSoC project which is Sharing of Shopping lists from Recipes (Desktop App) to Todoist (Web + Mobile App). Here is the wiki page for the project