Update: Todoist Integration

In the last blog post, I gave a brief idea as to how Todoist plugin is structured to work and I talked about my work related to loading Todoist tasks inside GNOME To Do. After modifying the previous work and making some improvements, the code has finally been pushed to master. I also worked on implementing functions that will save any changes made to Todoist tasks or lists. The Todoist Api allows applications to send an HTTP Post requests for adding/deleting tasks/lists. To Do makes uses of the Todoist Api v7 and sends HTTP response for fetching and storing the changes.

static void
gtd_provider_todoist_remove_task (GtdProvider *provider,
                                  GtdTask *task)
{
 GtdProviderTodoist *self;
 JsonObject *params;
 g_autofree gchar *command;
 g_autofree gchar *command_uuid;

 self = GTD_PROVIDER_TODOIST (provider);
 command = command_uuid = NULL;

if (!self->access_token)
 {
  emit_access_token_error ();
  return;
 }

 params = json_object_new ();

 command_uuid = g_uuid_string_random ();
 command = g_strdup_printf ("[{\"type\": \"item_delete\", \"uuid\": \"%s\", "
                            "\"args\": {\"ids\": [%s]}}]",
                            command_uuid,
                            gtd_object_get_uid (GTD_OBJECT (task)));

 json_object_set_string_member (params, "token", self->access_token);
 json_object_set_string_member (params, "commands", command);

 post (params, (RestProxyCallAsyncCallback) post_generic_cb, self);
}

The above snippet is to remove a task-list. Other function that work as editing the changes to Todoist, have similar implementation. They send param such as “token” and “command” and make use of post method to send an HTTP Post request. The post method use librest to make a call to Todoist sync endpoint.

What has been completed?

  1. GNOME To Do can load Todoist tasks and lists. So now, users can view their Todoist tasks inside To Do.
  2. Not just view, but one can also modify the tasks and lists and these changes will get saved to user Todoist account.
  3. Deleting tasks and list is also possible now. Although, deleting list won’t work because of a bug in GOA which doesn’t provide correct access rights to Todoist Account.

What is to be done?

  1. We cannot create a todoist task or list from GNOME To Do currently. This will be covered by next week.
  2. To Do cannot sync tasks and lists from Todoist automatically. This is currently in progress and hopefully will be completed by next 2 weeks.
  3. After completing the above tasks, I will work on limiting the number of post requests made by To Do so that we do not exceed the Todoist limit of 50 per minute.

A small video demonstrating the above Changes:

Do checkout the work and feel free to open bugs on bugzilla if you encounter them . Any suggestion for improvement is most welcomed. Don’t forget to drop a mail if you have Todoist specific features suggestions i.e Productivity Graph that can be implemented in GNOME To Do.

GSOC : Post Phase 1 Update

The first phase of my GSoC project has completed. I received an evaluation on my work from my mentor, feaneron. I am happy that the project is moving well. I hope to keep up with the work and continue this awesome journey and learn in the process.

So, let me come back to the project update. We have come a long way and I am happy to tell everyone that To Do can now load Todoist task lists and tasks. Although this work is still in progress and patch related to this change will be pushed probably by this week. So everyone waiting to use Todoist with To Do keep a watch on To Do repo for the update.

The major problem that I faced was synchronizing the tasks and task lists so that they are updated automatically. After discussion with my mentor, we have decided to sync tasks every hour, although this may change. I wanted the sync calls and functions updating the changes to be separate so that there is less friction between the code.

The current flow of Todoist plugin is:

Todoist Plugin WorkFlow (1).jpg

All the phases shown in the flowchart, except the last part which is synchronizing the tasks, has been completed. The major problem with task synchronization is code repetition due to addition of update functions. After some thinking I decided to make the function that initially loads tasks to be good enough so that it can be also be used to update tasks. To achieve this I had to add a check if lists/tasks already exists using the id. So if suppose the list already exists, I just fetch the list from Hash Table using the id as key and make changes to it’s properties. This way the list gets updated and not created again if it already exists. The problem that still exists is with the “list-changed” signal which is not behaving as thought and I need to fix this.

I have a short video demonstration for the work in progress.

Feel free to drop suggestions and give your feedback.

GSOC with GNOME : To Do

I am really happy and excited to be accepted as Google Summer of Code Student by GNOME and i will be working on integrating Todoist to GNOME To Do. Todoist is a widely used and popular Online Task Manager App. To be honest, this wouldn’t have been possible without the support I received from people in GNOME and especially my mentor feaneron who answered my every single query, even the silliest of them ( I am sorry Georges :P). I am really excited to be a part of such an helpful and knowledgeable group of people and hope to make best of this opportunity and learn lot of new things 🙂

Planning and Future of Todoist Plugin

We are collaborating with GNOME Recipe, Outreachy Project, since the project also requires Todoist integration and the work related to adding a Todoist Provider in Gnome Online Accounts (GOA) will be shared .We have held two meetings with my mentor (feaneron) and GOA maintainer(rishi) along with Recipe team (mclasen and ekta) and have started to finally build a plan as to how things would work out.We still have one meeting scheduled to finalize the whole thing.

Till now this is how things have shaped:

  1. Introduce a Todoist Provider in GOA –  Since Gnome To Do and Recipe are not core apps, it is possible that user may not be using these application in which case the Todoist provider will be left useless. So we decided to have a Todoist Provider which will only be shown in case there is an app that uses.We would be adding a AddAccount function in libgoa that To Do and Recipe can use to interact over dbus with GOA and a ListAccount that can be used to list all accounts including the hidden Todoist accounts.Then it works normally like any other provider allowing user authorization and saving access token.
  2. Implementation details in To Do – 
    • Preferences Panel – This will allow user to select an already added Todoist Account or set-up a new account that will make use of the ListAccount and AddAccount method introduced in previous step.
    • This is how a Preference Panel looks like. We will have something similar showing list of Todoist Account in a List Box and allowing user to add more accounts.Screenshot from 2017-05-22 21-20-50
    • TodoistPlugin – The plugin is medium between the provider and To Do which helps in maintaining the providers , adding , removing them.
    • TodoistProvider – A Todoist Provider is basically a TodoistAccount (as added by user) along with method that will fetch task ,tasklists and other information from the Todoist Server and also methods to update local changes to Todoist. Currently Todoist supports some cool features that are not supported by To Do but our focus in the project is not to integrate all those features, but a solid Todoist Plugin that does every basic task that To Do supports and ofcourse we will look to expand the features as time permits 🙂

So this is how the plugin is designed in To Do.We have one more meeting after which things would be even more clear. I have asked feaneron for a Q/A Session to discuss more about the plugin and i am sure we can improve our plan and execute it to perfection. Sorry for not having any demo photos at the moment but I promise to keep them posted here as Project continues 🙂

Feel free to drop suggestion.

Some notes from our meeting Click Here.

Project Wiki Page.