Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'jb46090' into 'master'
[buteo-sync-plugins-social] Remove deprecated media_info usage. Contributes to JB#46090

See merge request mer-core/buteo-sync-plugins-social!44
  • Loading branch information
chriadam committed Jul 11, 2019
2 parents dcbd28d + f4ba7a3 commit 8b9f459
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 8b9f459

Please sign in to comment.