mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 23:55:24 +02:00
Merge pull request #13355 from zfox23/MS14314_multipleSnapshots
Interface Fix for MS14314: Make use of original image filename when sharing
This commit is contained in:
commit
ffb9a47be0
2 changed files with 14 additions and 10 deletions
|
@ -35,6 +35,7 @@ void SnapshotUploader::uploadSuccess(QNetworkReply& reply) {
|
|||
QString thumbnailUrl = dataObject.value("thumbnail_url").toString();
|
||||
QString imageUrl = dataObject.value("image_url").toString();
|
||||
QString snapshotID = dataObject.value("id").toString();
|
||||
QString originalImageFileName = dataObject.value("original_image_file_name").toString();
|
||||
auto addressManager = DependencyManager::get<AddressManager>();
|
||||
QString placeName = _inWorldLocation.authority(); // We currently only upload shareable places, in which case this is just host.
|
||||
QString currentPath = _inWorldLocation.path();
|
||||
|
@ -48,6 +49,7 @@ void SnapshotUploader::uploadSuccess(QNetworkReply& reply) {
|
|||
detailsObject.insert("shareable_url", dataObject.value("shareable_url").toString());
|
||||
}
|
||||
detailsObject.insert("snapshot_id", snapshotID);
|
||||
detailsObject.insert("original_image_file_name", originalImageFileName);
|
||||
QString pickledDetails = QJsonDocument(detailsObject).toJson();
|
||||
userStoryObject.insert("details", pickledDetails);
|
||||
userStoryObject.insert("thumbnail_url", thumbnailUrl);
|
||||
|
|
|
@ -37,8 +37,8 @@ var shareAfterLogin = false;
|
|||
var snapshotToShareAfterLogin = [];
|
||||
var METAVERSE_BASE = Account.metaverseServerURL;
|
||||
var isLoggedIn;
|
||||
var numGifSnapshotUploadsPending = 0;
|
||||
var numStillSnapshotUploadsPending = 0;
|
||||
var mostRecentGifSnapshotFilename = "";
|
||||
var mostRecentStillSnapshotFilename = "";
|
||||
|
||||
// It's totally unnecessary to return to C++ to perform many of these requests, such as DELETEing an old story,
|
||||
// POSTING a new one, PUTTING a new audience, or GETTING story data. It's far more efficient to do all of that within JS
|
||||
|
@ -64,6 +64,10 @@ function fileExtensionMatches(filePath, extension) {
|
|||
return filePath.split('.').pop().toLowerCase() === extension;
|
||||
}
|
||||
|
||||
function getFilenameFromPath(str) {
|
||||
return str.split('\\').pop().split('/').pop();
|
||||
}
|
||||
|
||||
function onMessage(message) {
|
||||
// Receives message from the html dialog via the qwebchannel EventBridge. This is complicated by the following:
|
||||
// 1. Although we can send POJOs, we cannot receive a toplevel object. (Arrays of POJOs are fine, though.)
|
||||
|
@ -147,9 +151,9 @@ function onMessage(message) {
|
|||
print('Sharing snapshot with audience "for_url":', message.data);
|
||||
Window.shareSnapshot(message.data, Settings.getValue("previousSnapshotHref"));
|
||||
if (isGif) {
|
||||
numGifSnapshotUploadsPending++;
|
||||
mostRecentGifSnapshotFilename = getFilenameFromPath(message.data);
|
||||
} else {
|
||||
numStillSnapshotUploadsPending++;
|
||||
mostRecentStillSnapshotFilename = getFilenameFromPath(message.data);
|
||||
}
|
||||
} else {
|
||||
shareAfterLogin = true;
|
||||
|
@ -385,13 +389,11 @@ function snapshotUploaded(isError, reply) {
|
|||
ignoreStillSnapshotData = false;
|
||||
storyIDsToMaybeDelete.push(storyID);
|
||||
if (isGif) {
|
||||
numGifSnapshotUploadsPending--;
|
||||
if (numGifSnapshotUploadsPending !== 0) {
|
||||
if (mostRecentGifSnapshotFilename !== replyJson.user_story.details.original_image_file_name) {
|
||||
ignoreGifSnapshotData = true;
|
||||
}
|
||||
} else {
|
||||
numStillSnapshotUploadsPending--;
|
||||
if (numStillSnapshotUploadsPending !== 0) {
|
||||
if (mostRecentStillSnapshotFilename !== replyJson.user_story.details.original_image_file_name) {
|
||||
ignoreStillSnapshotData = true;
|
||||
}
|
||||
}
|
||||
|
@ -686,9 +688,9 @@ function onUsernameChanged() {
|
|||
Window.shareSnapshot(element.path, element.href);
|
||||
var isGif = fileExtensionMatches(element.path, "gif");
|
||||
if (isGif) {
|
||||
numGifSnapshotUploadsPending++;
|
||||
mostRecentGifSnapshotFilename = getFilenameFromPath(element.path);
|
||||
} else {
|
||||
numStillSnapshotUploadsPending++;
|
||||
mostRecentStillSnapshotFilename = getFilenameFromPath(element.path);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue