Foursquare and Facebook Check-In integration in Maps

Short Description

The aim of this project is to add social integration in GNOME Maps, namely, Foursquare and Facebook Check-In integration. User will be able to checkin to places and see last known checkin location of their friends. This will require some work in both gnome-maps and gnome-online-accounts components. Also, I'll work in the GtkPopover integration within GNOME Maps markers, opening paths for a more content rich map application.

About Me

I'm Damián Nohales, 23 years old Software Engineering student at CAECE University from Mar del Plata, Argentina. You can contact me at,

Schedule

A tentative schedule on how I'm going to proceed is the following

April 24st - May 7th

Start understanding GNOME Online Accounts.

May 8th - May 20th

Start implementing Facebook Check-In integration in GOA (that includes necessary changes in GOA provider, understanding Facebook API and example code that perform a check-in and get contacts check-in).

May 21th - June 8th

Start implementing Foursquare integration in GOA (that includes Foursquare provider creation, understanding Foursquare API and example code that perform a check-in and get contacts check-in).

June 9th - June 15th

UI design to perform a check-in in GNOME Maps (may require a feed post dialog).

June 16th - July 13th

Midterm evaluation and start coding the check-in UI.

July 14th - July 18th

UI design to get information about contact check-in's.

July 19th - July 25th

Start coding the contact check-in feature.

July 26th - August 18th

Start implementing GtkPopover within Maps markers to show rich location information to the users.

Implementation documentation

Add a new provider feature

We need to add a new feature, namely the checkin feature, that means org.gnome.OnlineAccounts.Checkin D-Bus interface and GOA_PROVIDER_FEATURE_CHECKIN enum, as a guide, we can see the commit where Pocket provider was added:

https://git.gnome.org/browse/gnome-online-accounts/commit/?id=6aedcc5bffa57b0b19a4b029985410390e3f1aeb

Status: done, see https://bugzilla.gnome.org/show_bug.cgi?id=729740

Modify GOA Facebook provider

Once we created the new checkin feature, we need to modify Facebook provider to tell the GOA clients that Facebook implements that feature. We need to:

  • Add the feature in GoaFacebookProvider::get_provider_features method.

  • Add the following scopes in GoaFacebookProvider::get_scope so we let know Facebook that we need checkin features.

    • user_status: to get user status with location attached
    • publish_actions: to publish a new check-in in the user stream
  • Analyze the addition of this scopes
    • friend_location: to get the place where the contact is living (not related to checkin)

Status: done, see https://bugzilla.gnome.org/show_bug.cgi?id=729740

Add Foursquare support in GOA

Add a provider in GOA to support login with Foursquare. Foursquare login is very similar to the Facebook login, both needs an API key and a secret key but there is a flow where apps doesn't need to expose the secret key, in Foursquare, this flow is called "Token flow", this is the flow that GOA is going to use.

More Information

We can check the commit where Pocket provider was added to get the idea:

https://git.gnome.org/browse/gnome-online-accounts/commit/?id=6aedcc5bffa57b0b19a4b029985410390e3f1aeb

Status: on review, see https://bugzilla.gnome.org/show_bug.cgi?id=729837

Add Check-In GUI in GNOME Maps

Add a GUI in GNOME Maps that allows user to perform a check-in.

Status: on review, see https://bugzilla.gnome.org/show_bug.cgi?id=731113

Add "See friends check-in" feature

Goals

  • Show markers in the map that represent the friend check-in. That marker should contains a thumbnail with the friend profile photo.
  • Show a bubble for that marker that contain more information about the check-in (message, datetime, place information, friend information)
  • Find a way to attract the attention about new check-ins
  • Don't overload Foursquare API, we have a total of 500 API calls per user per hour.
  • Secondary: Integrate with GNOME Contacts

After analyze the APIs from both services, Facebook and Foursquare, the conclusions are:

  • Facebook: I couldn't find a reliable and efficient to get the posts with place attached from all the friends at the same time. It can be done, but requires tons of API call (one per friend), that'd be make the feature usefulness.

  • Foursquare: There is an API function with that goal in mind.

So, to keep it simple, user will need a Foursquare account to access this feature.

Implementation

Since the Foursquare API function gives to us the user recent check-ins around the world, not per bounding box or location, a ChamplainTileSource based implementation (like ones used in the POI feature) is not feasible.

There will be two main components for this feature:

  • CheckInManager: This class was implemented here to allow Maps to perform check-in, we need to add a method called findRecentCheckins to this component.

  • CheckInMarkerProvider: This component is going to call CheckInManager::findRecentCheckins where appropriate, implements result caching, show/hide markers, etc. This component is going to be an application global service.

Other classes to be implemented will be:

  • CheckInMarker: The marker

  • CheckInBubble: The marker bubble

  • SocialPlace: Implemented here, it represent a social service place (like a Foursquare venue or Facebook place).

  • Contact: Represents a contact in a social service.

  • ContactCheckIn: Represents a contact check-in, it holds a Contact and a SocialPlace instances and some check-in properties (link, ID, datetime, etc).

The algorithm:

class CheckInProvider
{
    func init() {
        loadCache();
        refreshMarkers();
        interval(time: 10min, fetchCheckIns);

        if (cache.age > 10min) {
            fetchCheckIns();
        }
    }

    func refreshMarkers() {
        showMarkersOnCache;
    }

    func saveToCache(checkIns) {
        cache.removeOldCheckIns();
        cache.add(checkIns);
        cache.save();
    }

    func loadCache() {
        cache.load();
        //We don't want to show old check-ins at startup
        cache.removeOldCheckIns();
        cache.save();
    }

    func fetchCheckIns() {
        checkIns = CheckInManager.findRecentCheckins();
        saveToCache(checkIns);
        refreshMarkers();
        showNotification();
    }
}

Remarks and questions

  • System notifications, in-app notifications or no notifications?
  • How old should be a check-in to be declared old?
  • Is hiding old check-in the appropriate behavior or is confusing?

Status: on development, see https://bugzilla.gnome.org/show_bug.cgi?id=732509

Refactorize markers code and use GtkPopover in markers

This includes a refactorizations in the MapLocation and UserLocation classes to make the addition of different kind of markers easier and to add support to show a bubble related to the marker, using GtkPopover. This feature will be used to other related Maps GSoC projects.

Status: on review, see https://bugzilla.gnome.org/show_bug.cgi?id=722871

More Resources

TODO

  • Facebook
    • I cannot find a way to get the latest for all the user friends, maybe Foursquare can do that.

Outreach/SummerOfCode/2014/Projects/DamianNohales_MapsFoursquareFacebook (last edited 2015-10-28 12:56:36 by DamianNohales)