Standalone Tags - checkpoint

This commit is contained in:
Roxanne Skelly 2019-02-15 11:21:40 -08:00
parent ab1a691dc9
commit be98fb1ac7
8 changed files with 113 additions and 12 deletions

View file

@ -30,6 +30,8 @@ Rectangle {
property string dateAcquired: "--"; property string dateAcquired: "--";
property string itemCost: "--"; property string itemCost: "--";
property string marketplace_item_id: ""; property string marketplace_item_id: "";
property bool standaloneOptimized: false;
property bool standaloneIncompatible: false;
property string certTitleTextColor: hifi.colors.darkGray; property string certTitleTextColor: hifi.colors.darkGray;
property string certTextColor: hifi.colors.white; property string certTextColor: hifi.colors.white;
property string infoTextColor: hifi.colors.blueAccent; property string infoTextColor: hifi.colors.blueAccent;
@ -71,6 +73,8 @@ Rectangle {
} else { } else {
root.marketplace_item_id = result.data.marketplace_item_id; root.marketplace_item_id = result.data.marketplace_item_id;
root.isMyCert = result.isMyCert ? result.isMyCert : false; root.isMyCert = result.isMyCert ? result.isMyCert : false;
root.standaloneOptimized = result.data.standalone_optimized;
root.standaloneIncompatible = result.data.standalone_incompatible;
if (root.certInfoReplaceMode > 3) { if (root.certInfoReplaceMode > 3) {
root.itemName = result.data.marketplace_item_name; root.itemName = result.data.marketplace_item_name;
@ -421,6 +425,24 @@ Rectangle {
anchors.rightMargin: 24; anchors.rightMargin: 24;
height: root.useGoldCert ? 220 : 372; height: root.useGoldCert ? 220 : 372;
HiFiGlyphs {
id: standaloneOptomizedBadge
anchors {
right: parent.right
top: ownedByHeader.top
rightMargin: 15
topMargin: 28
}
visible: root.standaloneOptimized
text: hifi.glyphs.hmd
size: 34
horizontalAlignment: Text.AlignHCenter
color: hifi.colors.blueHighlight
}
RalewayRegular { RalewayRegular {
id: errorText; id: errorText;
visible: !root.useGoldCert; visible: !root.useGoldCert;
@ -467,6 +489,7 @@ Rectangle {
color: root.infoTextColor; color: root.infoTextColor;
elide: Text.ElideRight; elide: Text.ElideRight;
} }
AnonymousProRegular { AnonymousProRegular {
id: isMyCertText; id: isMyCertText;
visible: root.isMyCert && ownedBy.text !== "--" && ownedBy.text !== ""; visible: root.isMyCert && ownedBy.text !== "--" && ownedBy.text !== "";
@ -485,14 +508,46 @@ Rectangle {
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
} }
RalewayRegular {
id: standaloneHeader;
text: root.standaloneOptimized ? "STAND-ALONE OPTIMIZED" : "STAND-ALONE INCOMPATIBLE";
// Text size
size: 16;
// Anchors
anchors.top: ownedBy.bottom;
anchors.topMargin: 15;
anchors.left: parent.left;
anchors.right: parent.right;
visible: root.standaloneOptimized || root.standaloneIncompatible;
height: visible ? paintedHeight : 0;
// Style
color: hifi.colors.darkGray;
}
RalewayRegular {
id: standaloneText;
text: root.standaloneOptimized ? "This item is stand-alone optimized" : "This item is incompatible with stand-alone devices";
// Text size
size: 18;
// Anchors
anchors.top: standaloneHeader.bottom;
anchors.topMargin: 8;
anchors.left: standaloneHeader.left;
visible: root.standaloneOptimized || root.standaloneIncompatible;
height: visible ? paintedHeight : 0;
// Style
color: root.infoTextColor;
elide: Text.ElideRight;
}
RalewayRegular { RalewayRegular {
id: dateAcquiredHeader; id: dateAcquiredHeader;
text: "ACQUISITION DATE"; text: "ACQUISITION DATE";
// Text size // Text size
size: 16; size: 16;
// Anchors // Anchors
anchors.top: ownedBy.bottom; anchors.top: standaloneText.bottom;
anchors.topMargin: 28; anchors.topMargin: 20;
anchors.left: parent.left; anchors.left: parent.left;
anchors.right: parent.horizontalCenter; anchors.right: parent.horizontalCenter;
anchors.rightMargin: 8; anchors.rightMargin: 8;
@ -521,8 +576,8 @@ Rectangle {
// Text size // Text size
size: 16; size: 16;
// Anchors // Anchors
anchors.top: ownedBy.bottom; anchors.top: standaloneText.bottom;
anchors.topMargin: 28; anchors.topMargin: 20;
anchors.left: parent.horizontalCenter; anchors.left: parent.horizontalCenter;
anchors.right: parent.right; anchors.right: parent.right;
height: paintedHeight; height: paintedHeight;

View file

@ -405,7 +405,9 @@ Item {
id: permissionExplanationText; id: permissionExplanationText;
anchors.fill: parent; anchors.fill: parent;
text: { text: {
if (root.itemType === "contentSet") { if (root.standaloneIncompatible) {
"This item is incompatible with stand-alone devices. <a href='#standaloneIncompatible'>Learn more</a>";
} else if (root.itemType === "contentSet") {
"You do not have 'Replace Content' permissions in this domain. <a href='#replaceContentPermission'>Learn more</a>"; "You do not have 'Replace Content' permissions in this domain. <a href='#replaceContentPermission'>Learn more</a>";
} else if (root.itemType === "entity") { } else if (root.itemType === "entity") {
"You do not have 'Rez Certified' permissions in this domain. <a href='#rezCertifiedPermission'>Learn more</a>"; "You do not have 'Rez Certified' permissions in this domain. <a href='#rezCertifiedPermission'>Learn more</a>";
@ -419,7 +421,11 @@ Item {
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
onLinkActivated: { onLinkActivated: {
sendToPurchases({method: 'showPermissionsExplanation', itemType: root.itemType}); if(link == "#standaloneIncompatible") {
sendToPurchases({method: 'showStandaloneIncompatibleExplanation'});
} else {
sendToPurchases({method: 'showPermissionsExplanation', itemType: root.itemType});
}
} }
} }
} }
@ -701,7 +707,8 @@ Item {
anchors.bottomMargin: 8; anchors.bottomMargin: 8;
width: 160; width: 160;
height: 40; height: 40;
enabled: root.hasPermissionToRezThis && enabled: !root.standaloneIncompatible &&
root.hasPermissionToRezThis &&
MyAvatar.skeletonModelURL !== root.itemHref && MyAvatar.skeletonModelURL !== root.itemHref &&
!root.wornEntityID && !root.wornEntityID &&
root.valid; root.valid;

View file

@ -12,7 +12,7 @@
// //
import Hifi 1.0 as Hifi import Hifi 1.0 as Hifi
import QtQuick 2.5 import QtQuick 2.9
import stylesUit 1.0 import stylesUit 1.0
import controlsUit 1.0 as HifiControlsUit import controlsUit 1.0 as HifiControlsUit
import "../../../controls" as HifiControls import "../../../controls" as HifiControls
@ -33,6 +33,7 @@ Rectangle {
property bool purchasesReceived: false; property bool purchasesReceived: false;
property bool punctuationMode: false; property bool punctuationMode: false;
property bool isDebuggingFirstUseTutorial: false; property bool isDebuggingFirstUseTutorial: false;
property bool isStandalone: false;
property string installedApps; property string installedApps;
property bool keyboardRaised: false; property bool keyboardRaised: false;
property int numUpdatesAvailable: 0; property int numUpdatesAvailable: 0;
@ -44,6 +45,7 @@ Rectangle {
purchasesModel.getFirstPage(); purchasesModel.getFirstPage();
Commerce.getAvailableUpdates(); Commerce.getAvailableUpdates();
} }
Connections { Connections {
target: Commerce; target: Commerce;
@ -110,6 +112,11 @@ Rectangle {
} }
} }
Component.onCompleted: {
isStandalone = PlatformInfo.isStandalone();
console.log(isStandalone ? "IS STANDALONE" : "ISN'T STANDALONE");
}
HifiCommerceCommon.CommerceLightbox { HifiCommerceCommon.CommerceLightbox {
id: lightboxPopup; id: lightboxPopup;
z: 999; z: 999;
@ -554,7 +561,7 @@ Rectangle {
itemType: model.item_type; itemType: model.item_type;
valid: model.valid; valid: model.valid;
standaloneOptimized: model.standalone_optimized standaloneOptimized: model.standalone_optimized
standaloneIncompatible: model.standalone_incompatible standaloneIncompatible: root.isStandalone && model.standalone_incompatible
anchors.topMargin: 10; anchors.topMargin: 10;
anchors.bottomMargin: 10; anchors.bottomMargin: 10;
@ -675,6 +682,14 @@ Rectangle {
lightboxPopup.visible = false; lightboxPopup.visible = false;
} }
lightboxPopup.visible = true; lightboxPopup.visible = true;
} else if (msg.method === "showStandaloneIncompatibleExplanation") {
lightboxPopup.titleText = "Stand-alone Incompatible";
lightboxPopup.bodyText = "The item is incompatible with stand-alone devices.";
lightboxPopup.button1text = "CLOSE";
lightboxPopup.button1method = function() {
lightboxPopup.visible = false;
}
lightboxPopup.visible = true;
} else if (msg.method === "setFilterText") { } else if (msg.method === "setFilterText") {
filterBar.text = msg.filterText; filterBar.text = msg.filterText;
} else if (msg.method === "flipCard") { } else if (msg.method === "flipCard") {

View file

@ -768,6 +768,11 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
bool isStore = cmdOptionExists(argc, const_cast<const char**>(argv), OCULUS_STORE_ARG); bool isStore = cmdOptionExists(argc, const_cast<const char**>(argv), OCULUS_STORE_ARG);
qApp->setProperty(hifi::properties::OCULUS_STORE, isStore); qApp->setProperty(hifi::properties::OCULUS_STORE, isStore);
// emulate standalone device
static const auto STANDALONE_ARG = "--standalone";
bool isStandalone = cmdOptionExists(argc, const_cast<const char**>(argv), STANDALONE_ARG);
qApp->setProperty(hifi::properties::STANDALONE, isStandalone);
// Ignore any previous crashes if running from command line with a test script. // Ignore any previous crashes if running from command line with a test script.
bool inTestMode { false }; bool inTestMode { false };
for (int i = 0; i < argc; ++i) { for (int i = 0; i < argc; ++i) {
@ -3029,6 +3034,9 @@ void Application::initializeUi() {
}; };
OffscreenQmlSurface::addWhitelistContextHandler({ OffscreenQmlSurface::addWhitelistContextHandler({
QUrl{ "hifi/commerce/marketplace/Marketplace.qml" }, QUrl{ "hifi/commerce/marketplace/Marketplace.qml" },
QUrl{ "hifi/commerce/purchases/Purchases.qml" },
QUrl{ "hifi/commerce/wallet/Wallet.qml" },
QUrl{ "hifi/commerce/wallet/WalletHome.qml" },
}, platformInfoCallback); }, platformInfoCallback);
QmlContextCallback ttsCallback = [](QQmlContext* context) { QmlContextCallback ttsCallback = [](QQmlContext* context) {

View file

@ -7,7 +7,7 @@
// //
#include "PlatformInfoScriptingInterface.h" #include "PlatformInfoScriptingInterface.h"
#include "Application.h" #include "Application.h"
#include <shared/GlobalAppProperties.h>
#include <thread> #include <thread>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -138,6 +138,14 @@ bool PlatformInfoScriptingInterface::has3DHTML() {
#if defined(Q_OS_ANDROID) #if defined(Q_OS_ANDROID)
return false; return false;
#else #else
return true; return !qApp->property(hifi::properties::STANDALONE).toBool();
#endif
}
bool PlatformInfoScriptingInterface::isStandalone() {
#if defined(Q_OS_ANDROID)
return false;
#else
return qApp->property(hifi::properties::STANDALONE).toBool();
#endif #endif
} }

View file

@ -68,9 +68,15 @@ public slots:
/**jsdoc /**jsdoc
* Returns true if device supports 3d HTML * Returns true if device supports 3d HTML
* @function Window.hasRift * @function Window.has3DHTML
* @returns {boolean} <code>true</code> if device supports 3d HTML, otherwise <code>false</code>.*/ * @returns {boolean} <code>true</code> if device supports 3d HTML, otherwise <code>false</code>.*/
bool has3DHTML(); bool has3DHTML();
/**jsdoc
* Returns true if device is standalone
* @function Window.hasRift
* @returns {boolean} <code>true</code> if device is a standalone device, otherwise <code>false</code>.*/
bool isStandalone();
}; };
#endif // hifi_PlatformInfoScriptingInterface_h #endif // hifi_PlatformInfoScriptingInterface_h

View file

@ -14,6 +14,7 @@ namespace hifi { namespace properties {
const char* STEAM = "com.highfidelity.launchedFromSteam"; const char* STEAM = "com.highfidelity.launchedFromSteam";
const char* LOGGER = "com.highfidelity.logger"; const char* LOGGER = "com.highfidelity.logger";
const char* OCULUS_STORE = "com.highfidelity.oculusStore"; const char* OCULUS_STORE = "com.highfidelity.oculusStore";
const char* STANDALONE = "com.highfidelity.standalone";
const char* TEST = "com.highfidelity.test"; const char* TEST = "com.highfidelity.test";
const char* TRACING = "com.highfidelity.tracing"; const char* TRACING = "com.highfidelity.tracing";
const char* HMD = "com.highfidelity.hmd"; const char* HMD = "com.highfidelity.hmd";

View file

@ -16,6 +16,7 @@ namespace hifi { namespace properties {
extern const char* STEAM; extern const char* STEAM;
extern const char* LOGGER; extern const char* LOGGER;
extern const char* OCULUS_STORE; extern const char* OCULUS_STORE;
extern const char* STANDALONE;
extern const char* TEST; extern const char* TEST;
extern const char* TRACING; extern const char* TRACING;
extern const char* HMD; extern const char* HMD;