mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 02:03:11 +02:00
PR feedback
This commit is contained in:
parent
18990821df
commit
d4f376879d
2 changed files with 4 additions and 15 deletions
|
@ -148,8 +148,6 @@ void Snapshot::uploadSnapshot(const QString& filename) {
|
||||||
const QString SNAPSHOT_UPLOAD_URL = "/api/v1/snapshots";
|
const QString SNAPSHOT_UPLOAD_URL = "/api/v1/snapshots";
|
||||||
static SnapshotUploader uploader;
|
static SnapshotUploader uploader;
|
||||||
|
|
||||||
qDebug() << "uploading snapshot " << filename;
|
|
||||||
|
|
||||||
QFile* file = new QFile(filename);
|
QFile* file = new QFile(filename);
|
||||||
Q_ASSERT(file->exists());
|
Q_ASSERT(file->exists());
|
||||||
file->open(QIODevice::ReadOnly);
|
file->open(QIODevice::ReadOnly);
|
||||||
|
@ -165,11 +163,7 @@ void Snapshot::uploadSnapshot(const QString& filename) {
|
||||||
multiPart->append(imagePart);
|
multiPart->append(imagePart);
|
||||||
|
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
JSONCallbackParameters callbackParams;
|
JSONCallbackParameters callbackParams(&uploader, "uploadSuccess", &uploader, "uploadFailure");
|
||||||
callbackParams.jsonCallbackReceiver = &uploader;
|
|
||||||
callbackParams.jsonCallbackMethod = "uploadSuccess";
|
|
||||||
callbackParams.errorCallbackReceiver = &uploader;
|
|
||||||
callbackParams.errorCallbackMethod = "uploadFailure";
|
|
||||||
|
|
||||||
accountManager->sendRequest(SNAPSHOT_UPLOAD_URL,
|
accountManager->sendRequest(SNAPSHOT_UPLOAD_URL,
|
||||||
AccountManagerAuth::Required,
|
AccountManagerAuth::Required,
|
||||||
|
@ -191,7 +185,7 @@ void SnapshotUploader::uploadSuccess(QNetworkReply& reply) {
|
||||||
QString thumbnailUrl = doc.object().value("thumbnail_url").toString();
|
QString thumbnailUrl = doc.object().value("thumbnail_url").toString();
|
||||||
auto addressManager = DependencyManager::get<AddressManager>();
|
auto addressManager = DependencyManager::get<AddressManager>();
|
||||||
QString placeName = addressManager->getPlaceName();
|
QString placeName = addressManager->getPlaceName();
|
||||||
if(placeName.isEmpty()) {
|
if (placeName.isEmpty()) {
|
||||||
placeName = addressManager->getHost();
|
placeName = addressManager->getHost();
|
||||||
}
|
}
|
||||||
QString currentPath = addressManager->currentPath(true);
|
QString currentPath = addressManager->currentPath(true);
|
||||||
|
@ -206,11 +200,7 @@ void SnapshotUploader::uploadSuccess(QNetworkReply& reply) {
|
||||||
rootObject.insert("user_story", userStoryObject);
|
rootObject.insert("user_story", userStoryObject);
|
||||||
|
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
JSONCallbackParameters callbackParams;
|
JSONCallbackParameters callbackParams(&uploader, "createStorySuccess", &uploader, "createStoryFailure");
|
||||||
callbackParams.jsonCallbackReceiver = &uploader;
|
|
||||||
callbackParams.jsonCallbackMethod = "createStorySuccess";
|
|
||||||
callbackParams.errorCallbackReceiver = &uploader;
|
|
||||||
callbackParams.errorCallbackMethod = "createStoryFailure";
|
|
||||||
|
|
||||||
accountManager->sendRequest(STORY_UPLOAD_URL,
|
accountManager->sendRequest(STORY_UPLOAD_URL,
|
||||||
AccountManagerAuth::Required,
|
AccountManagerAuth::Required,
|
||||||
|
@ -219,7 +209,6 @@ void SnapshotUploader::uploadSuccess(QNetworkReply& reply) {
|
||||||
QJsonDocument(rootObject).toJson());
|
QJsonDocument(rootObject).toJson());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Error parsing upload response: " << jsonError.errorString();
|
|
||||||
emit DependencyManager::get<WindowScriptingInterface>()->snapshotShared(false);
|
emit DependencyManager::get<WindowScriptingInterface>()->snapshotShared(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ function confirmShare(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function snapshotShared(success) {
|
function snapshotShared(success) {
|
||||||
if(success) {
|
if (success) {
|
||||||
// for now just print status
|
// for now just print status
|
||||||
print('snapshot uploaded and shared');
|
print('snapshot uploaded and shared');
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue