Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[buteo-sync-plugins-social] Update Contacts plugin to use Google Peop…
…le API. JB#50799

The Google Contacts API is deprecated and the service will cease to
work in June 2021. Update the contacts plugin to use the newer People
API instead.

Main changes:
- Use JSON instead of XML to format request and response data.
- Make multi-part HTTP requests for batched upsync requests.
- Upsync avatar changes separately from other contact data as per the
People API requirements.
- Always save both the remote url and local file path for an avatar
instead of transforming the remote url to a local file after downloading.
- If a downloaded avatar's file extension does not match its meta type
(e.g. is png but has jpg extension) rename the file to match the type.
  • Loading branch information
blammit committed Feb 21, 2021
1 parent b6f3b38 commit a5309ea
Show file tree
Hide file tree
Showing 12 changed files with 3,083 additions and 2,531 deletions.
8 changes: 4 additions & 4 deletions src/google/google-contacts/google-contacts.pri
Expand Up @@ -4,14 +4,14 @@ QT += gui

SOURCES += \
$$PWD/googletwowaycontactsyncadaptor.cpp \
$$PWD/googlecontactstream.cpp \
$$PWD/googlecontactatom.cpp \
$$PWD/googlepeopleapi.cpp \
$$PWD/googlepeoplejson.cpp \
$$PWD/googlecontactimagedownloader.cpp

HEADERS += \
$$PWD/googletwowaycontactsyncadaptor.h \
$$PWD/googlecontactstream.h \
$$PWD/googlecontactatom.h \
$$PWD/googlepeopleapi.h \
$$PWD/googlepeoplejson.h \
$$PWD/googlecontactimagedownloader.h

INCLUDEPATH += $$PWD
Expand Down
210 changes: 0 additions & 210 deletions src/google/google-contacts/googlecontactatom.cpp

This file was deleted.

139 changes: 0 additions & 139 deletions src/google/google-contacts/googlecontactatom.h

This file was deleted.

Expand Up @@ -45,7 +45,6 @@ QNetworkReply * GoogleContactImageDownloader::createReply(const QString &url,

QString accessToken = metadata.value(IMAGE_DOWNLOADER_TOKEN_KEY).toString();
QNetworkRequest request(url);
request.setRawHeader("GData-Version", "3.0");
request.setRawHeader(QString(QLatin1String("Authorization")).toUtf8(),
QString(QLatin1String("Bearer ") + accessToken).toUtf8());
return d->networkAccessManager->get(request);
Expand Down

0 comments on commit a5309ea

Please sign in to comment.