mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 06:53:00 +02:00
wrap in marketplace check and change landing point
This commit is contained in:
parent
0784686450
commit
6bde4db0d7
1 changed files with 34 additions and 29 deletions
|
@ -257,7 +257,7 @@ static const QString DESKTOP_DISPLAY_PLUGIN_NAME = "Desktop";
|
||||||
|
|
||||||
static const QString SYSTEM_TABLET = "com.highfidelity.interface.tablet.system";
|
static const QString SYSTEM_TABLET = "com.highfidelity.interface.tablet.system";
|
||||||
|
|
||||||
static const QString DOMAIN_SPAWNING_POINT = "/0, -200, 0";
|
static const QString DOMAIN_SPAWNING_POINT = "/0, -10, 0";
|
||||||
|
|
||||||
const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensions {
|
const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensions {
|
||||||
{ SVO_EXTENSION, &Application::importSVOFromURL },
|
{ SVO_EXTENSION, &Application::importSVOFromURL },
|
||||||
|
@ -6127,38 +6127,44 @@ bool Application::askToWearAvatarAttachmentUrl(const QString& url) {
|
||||||
bool Application::askToReplaceDomainContent(const QString& url) {
|
bool Application::askToReplaceDomainContent(const QString& url) {
|
||||||
QString methodDetails;
|
QString methodDetails;
|
||||||
if (DependencyManager::get<NodeList>()->getThisNodeCanReplaceContent()) {
|
if (DependencyManager::get<NodeList>()->getThisNodeCanReplaceContent()) {
|
||||||
// Create a confirmation dialog when this call is made
|
QUrl originURL{ url };
|
||||||
const int MAX_CHARACTERS_PER_LINE = 90;
|
if (originURL.host().endsWith(MARKETPLACE_CDN_HOSTNAME)) {
|
||||||
static const QString infoText = simpleWordWrap("Your domain's content will be replaced with a new content set. "
|
// Create a confirmation dialog when this call is made
|
||||||
"If you want to save what you have now, create a backup before proceeding. For more information about backing up "
|
const int MAX_CHARACTERS_PER_LINE = 90;
|
||||||
"and restoring content, visit the documentation page at <link>.", MAX_CHARACTERS_PER_LINE);
|
static const QString infoText = simpleWordWrap("Your domain's content will be replaced with a new content set. "
|
||||||
|
"If you want to save what you have now, create a backup before proceeding. For more information about backing up "
|
||||||
|
"and restoring content, visit the documentation page at: ", MAX_CHARACTERS_PER_LINE) +
|
||||||
|
"\nhttps://docs.highfidelity.com/create-and-explore/start-working-in-your-sandbox/restoring-sandbox-content";
|
||||||
|
|
||||||
bool agreeToReplaceContent = false; // assume false
|
bool agreeToReplaceContent = false; // assume false
|
||||||
agreeToReplaceContent = QMessageBox::Yes == OffscreenUi::question("Are you sure you want to replace this domain's content set?",
|
agreeToReplaceContent = QMessageBox::Yes == OffscreenUi::question("Are you sure you want to replace this domain's content set?",
|
||||||
infoText, QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
infoText, QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||||
|
|
||||||
if (agreeToReplaceContent) {
|
if (agreeToReplaceContent) {
|
||||||
// Given confirmation, send request to domain server to replace content
|
// Given confirmation, send request to domain server to replace content
|
||||||
qCDebug(interfaceapp) << "Attempting to replace domain content: " << url;
|
qCDebug(interfaceapp) << "Attempting to replace domain content: " << url;
|
||||||
QByteArray _url(url.toUtf8());
|
QByteArray _url(url.toUtf8());
|
||||||
auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
|
auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
|
||||||
limitedNodeList->eachMatchingNode([](const SharedNodePointer& node) {
|
limitedNodeList->eachMatchingNode([](const SharedNodePointer& node) {
|
||||||
return node->getType() == NodeType::EntityServer && node->getActiveSocket();
|
return node->getType() == NodeType::EntityServer && node->getActiveSocket();
|
||||||
}, [&_url, limitedNodeList](const SharedNodePointer& octreeNode) {
|
}, [&_url, limitedNodeList](const SharedNodePointer& octreeNode) {
|
||||||
auto octreeFilePacket = NLPacket::create(PacketType::OctreeFileReplacementFromUrl, _url.size(), true);
|
auto octreeFilePacket = NLPacket::create(PacketType::OctreeFileReplacementFromUrl, _url.size(), true);
|
||||||
octreeFilePacket->write(_url);
|
octreeFilePacket->write(_url);
|
||||||
limitedNodeList->sendPacket(std::move(octreeFilePacket), *octreeNode);
|
limitedNodeList->sendPacket(std::move(octreeFilePacket), *octreeNode);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
DependencyManager::get<AddressManager>()->handleLookupString(DOMAIN_SPAWNING_POINT);
|
DependencyManager::get<AddressManager>()->handleLookupString(DOMAIN_SPAWNING_POINT);
|
||||||
methodDetails = "SuccessfulRequestToReplaceContent";
|
methodDetails = "SuccessfulRequestToReplaceContent";
|
||||||
|
} else {
|
||||||
|
methodDetails = "UserDeclinedToReplaceContent";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
methodDetails = "UserDeclinedToReplaceContent";
|
methodDetails = "ContentSetDidNotOriginateFromMarketplace";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
methodDetails = "UserDoesNotHavePermissionToReplaceContent";
|
methodDetails = "UserDoesNotHavePermissionToReplaceContent";
|
||||||
OffscreenUi::warning("Unable to replace content", "You do not have permissions to replace domain content",
|
OffscreenUi::warning("Unable to replace content", "You do not have permissions to replace domain content",
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::Ok, QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
QJsonObject messageProperties = {
|
QJsonObject messageProperties = {
|
||||||
{ "status", methodDetails },
|
{ "status", methodDetails },
|
||||||
|
@ -6166,7 +6172,6 @@ bool Application::askToReplaceDomainContent(const QString& url) {
|
||||||
};
|
};
|
||||||
UserActivityLogger::getInstance().logAction("replace_domain_content", messageProperties);
|
UserActivityLogger::getInstance().logAction("replace_domain_content", messageProperties);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::displayAvatarAttachmentWarning(const QString& message) const {
|
void Application::displayAvatarAttachmentWarning(const QString& message) const {
|
||||||
|
|
Loading…
Reference in a new issue