[gnome-online-accounts/gbsneto/facebook-contacts] facebook: Support Facebook contacts
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/gbsneto/facebook-contacts] facebook: Support Facebook contacts
- Date: Tue, 4 May 2021 23:00:04 +0000 (UTC)
commit e5893101da4caaa7bcceba93f964feb940d0865e
Author: Umang Jain <umang endlessm com>
Date: Mon Apr 15 13:04:02 2019 +0530
facebook: Support Facebook contacts
Integrate Facebook contacts with GNOME Online Accounts
through the Graphs API.
src/goabackend/goafacebookprovider.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
---
diff --git a/src/goabackend/goafacebookprovider.c b/src/goabackend/goafacebookprovider.c
index c6033fbc..83ca4956 100644
--- a/src/goabackend/goafacebookprovider.c
+++ b/src/goabackend/goafacebookprovider.c
@@ -67,6 +67,7 @@ get_provider_features (GoaProvider *provider)
{
return GOA_PROVIDER_FEATURE_BRANDED |
GOA_PROVIDER_FEATURE_PHOTOS |
+ GOA_PROVIDER_FEATURE_CONTACTS |
GOA_PROVIDER_FEATURE_MAPS;
}
@@ -112,6 +113,7 @@ get_scope (GoaOAuth2Provider *oauth2_provider)
/* see https://developers.facebook.com/docs/authentication/permissions/ */
/* Note: Email is requested to obtain a human understandable unique Id */
return
+ "user_friends,"
"user_events,"
"email,"
"user_photos,"
@@ -122,7 +124,7 @@ get_scope (GoaOAuth2Provider *oauth2_provider)
static guint
get_credentials_generation (GoaProvider *provider)
{
- return 3;
+ return 4;
}
static const gchar *
@@ -280,6 +282,7 @@ build_object (GoaProvider *provider,
GoaAccount *account = NULL;
gboolean photos_enabled;
gboolean maps_enabled;
+ gboolean contacts_enabled;
gboolean ret = FALSE;
/* Chain up */
@@ -323,6 +326,25 @@ build_object (GoaProvider *provider,
ret = TRUE;
+ /* Contacts */
+ contacts_enabled = g_key_file_get_boolean (key_file, group, "ContactsEnabled", NULL);
+ goa_object_skeleton_attach_contacts (object,
+ "https://graph.facebook.com/me/friends",
+ contacts_enabled,
+ FALSE);
+
+ if (just_added)
+ {
+ goa_account_set_contacts_disabled (account, !contacts_enabled);
+ g_signal_connect (account,
+ "notify::contacts-disabled",
+ G_CALLBACK (goa_util_account_notify_property_cb),
+ "ContactsEnabled");
+ }
+
+ ret = TRUE;
+
+
out:
g_clear_object (&account);
return ret;
@@ -336,6 +358,7 @@ add_account_key_values (GoaOAuth2Provider *oauth2_provider,
{
g_variant_builder_add (builder, "{ss}", "PhotosEnabled", "true");
g_variant_builder_add (builder, "{ss}", "MapsEnabled", "true");
+ g_variant_builder_add (builder, "{ss}", "ContactsEnabled", "true");
}
/* ---------------------------------------------------------------------------------------------------- */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]