Add uploading to asset server event
Showing the changes to interface/src/scripting/AssetMappingsScriptingInterface.cpp (1 of 10 files). Show all
Unified · Split
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | #include <NetworkLogging.h> | 21 | #include <NetworkLogging.h> |
| 22 | #include <NodeList.h> | 22 | #include <NodeList.h> |
| 23 | #include <OffscreenUi.h> | 23 | #include <OffscreenUi.h> |
| 24 | #include <UserActivityLogger.h> | ||
| 24 | 25 | ||
| 25 | static const int AUTO_REFRESH_INTERVAL = 1000; | 26 | static const int AUTO_REFRESH_INTERVAL = 1000; |
| 26 | 27 | ||
| @@ -104,6 +105,21 @@ void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping, · 77 unmodified lines | |||
| 104 | 105 | ||
| 105 | startedCallback.call(); | 106 | startedCallback.call(); |
| 106 | 107 | ||
| 108 | QFileInfo fileInfo { path }; | ||
| 109 | int64_t size { fileInfo.size() }; | ||
| 110 | |||
| 111 | QString extension = ""; | ||
| 112 | auto idx = path.lastIndexOf("."); | ||
| 113 | if (idx >= 0) { | ||
| 114 | extension = path.mid(idx + 1); | ||
| 115 | } | ||
| 116 | |||
| 117 | UserActivityLogger::getInstance().logAction("uploading_asset", { | ||
| 118 | { "size", (qint64)size }, | ||
| 119 | { "mapping", mapping }, | ||
| 120 | { "extension", extension} | ||
| 121 | }); | ||
| 122 | |||
| 107 | auto upload = DependencyManager::get<AssetClient>()->createUpload(path); | 123 | auto upload = DependencyManager::get<AssetClient>()->createUpload(path); |
| 108 | QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable { | 124 | QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable { |
| 109 | if (upload->getError() != AssetUpload::NoError) { | 125 | if (upload->getError() != AssetUpload::NoError) { |