Skip to content

Commit

Permalink
[buteo-sync-plugins-social] Remove deprecated media_info usage. Contr…
Browse files Browse the repository at this point in the history
…ibutes to JB#46090

Dropbox has deprecated media_info in list_folder requests.
This commit removes our usage of media_info from list_folder requests,
and replaces the image width/height metadata we store with placeholder
values.  Those are eventually exposed (by libsocialcache) as
photoWidth/photoHeight to QML, but are not currently used.
  • Loading branch information
Chris Adams committed Jul 9, 2019
1 parent dcbd28d commit f4ba7a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/dropbox/dropbox-backup/dropboxbackupsyncadaptor.cpp
Expand Up @@ -152,7 +152,6 @@ void DropboxBackupSyncAdaptor::requestList(int accountId,
if (continuationCursor.isEmpty()) {
requestParameters.insert("path", remotePath);
requestParameters.insert("recursive", false);
requestParameters.insert("include_media_info", true);
requestParameters.insert("include_deleted", false);
requestParameters.insert("include_has_explicit_shared_members", false);
} else {
Expand Down
17 changes: 8 additions & 9 deletions src/dropbox/dropbox-images/dropboximagesyncadaptor.cpp
Expand Up @@ -227,7 +227,6 @@ void DropboxImageSyncAdaptor::queryCameraRoll(int accountId, const QString &acce
QJsonObject requestParameters;
if (continuationCursor.isEmpty()) {
requestParameters.insert("path", "/Pictures");
requestParameters.insert("include_media_info", true);
requestParameters.insert("include_deleted", false);
requestParameters.insert("include_has_explicit_shared_members", false);
} else {
Expand Down Expand Up @@ -284,8 +283,6 @@ void DropboxImageSyncAdaptor::cameraRollFinishedHandler()
reply->deleteLater();
removeReplyTimeout(accountId, reply);

qWarning() << "Got replyData:" << replyData;

bool ok = false;
QJsonObject parsed = parseJsonObjectReplyData(replyData, &ok);

Expand Down Expand Up @@ -332,12 +329,14 @@ qWarning() << "Got replyData:" << replyData;
const QString &remoteFilePath = fileObject.value("path_display").toString();
QString photoId = fileObject.value(QLatin1String("rev")).toString();
QString photoName = remoteFilePath.split("/").last();
int imageWidth = fileObject.value(QLatin1String("media_info")).toObject().value(QLatin1String("dimensions")).toObject().value(QLatin1String("width")).toInt();
int imageHeight = fileObject.value(QLatin1String("media_info")).toObject().value(QLatin1String("dimensions")).toObject().value(QLatin1String("height")).toInt();
if (imageWidth == 0 || imageHeight == 0) {
imageWidth = 768;
imageHeight = 1024;
}

// Previously, we retrieved imageWidth and imageHeight via the media_info.
// Dropbox have deprecated that, so now the only way to get the information
// is via per-file get_metadata requests, which are prohibitively expensive.
// Instead, just define these placeholder values, as it turns out that the
// values are never used in practice.
int imageWidth = 1024;
int imageHeight = 768;

QString createdTimeStr = fileObject.value(QLatin1String("client_modified")).toString();
QDateTime createdTime = QDateTime::fromString(createdTimeStr, Qt::ISODate);
Expand Down

0 comments on commit f4ba7a3

Please sign in to comment.