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 itemCost: "--";
property string marketplace_item_id: "";
property bool standaloneOptimized: false;
property bool standaloneIncompatible: false;
property string certTitleTextColor: hifi.colors.darkGray;
property string certTextColor: hifi.colors.white;
property string infoTextColor: hifi.colors.blueAccent;
@ -71,6 +73,8 @@ Rectangle {
} else {
root.marketplace_item_id = result.data.marketplace_item_id;
root.isMyCert = result.isMyCert ? result.isMyCert : false;
root.standaloneOptimized = result.data.standalone_optimized;
root.standaloneIncompatible = result.data.standalone_incompatible;
if (root.certInfoReplaceMode > 3) {
root.itemName = result.data.marketplace_item_name;
@ -421,6 +425,24 @@ Rectangle {
anchors.rightMargin: 24;
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 {
id: errorText;
visible: !root.useGoldCert;
@ -467,6 +489,7 @@ Rectangle {
color: root.infoTextColor;
elide: Text.ElideRight;
}
AnonymousProRegular {
id: isMyCertText;
visible: root.isMyCert && ownedBy.text !== "--" && ownedBy.text !== "";
@ -485,14 +508,46 @@ Rectangle {
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 {
id: dateAcquiredHeader;
text: "ACQUISITION DATE";
// Text size
size: 16;
// Anchors
anchors.top: ownedBy.bottom;
anchors.topMargin: 28;
anchors.top: standaloneText.bottom;
anchors.topMargin: 20;
anchors.left: parent.left;
anchors.right: parent.horizontalCenter;
anchors.rightMargin: 8;
@ -521,8 +576,8 @@ Rectangle {
// Text size
size: 16;
// Anchors
anchors.top: ownedBy.bottom;
anchors.topMargin: 28;
anchors.top: standaloneText.bottom;
anchors.topMargin: 20;
anchors.left: parent.horizontalCenter;
anchors.right: parent.right;
height: paintedHeight;

View file

@ -405,7 +405,9 @@ Item {
id: permissionExplanationText;
anchors.fill: parent;
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>";
} else if (root.itemType === "entity") {
"You do not have 'Rez Certified' permissions in this domain. <a href='#rezCertifiedPermission'>Learn more</a>";
@ -419,7 +421,11 @@ Item {
verticalAlignment: Text.AlignVCenter;
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;
width: 160;
height: 40;
enabled: root.hasPermissionToRezThis &&
enabled: !root.standaloneIncompatible &&
root.hasPermissionToRezThis &&
MyAvatar.skeletonModelURL !== root.itemHref &&
!root.wornEntityID &&
root.valid;

View file

@ -12,7 +12,7 @@
//
import Hifi 1.0 as Hifi
import QtQuick 2.5
import QtQuick 2.9
import stylesUit 1.0
import controlsUit 1.0 as HifiControlsUit
import "../../../controls" as HifiControls
@ -33,6 +33,7 @@ Rectangle {
property bool purchasesReceived: false;
property bool punctuationMode: false;
property bool isDebuggingFirstUseTutorial: false;
property bool isStandalone: false;
property string installedApps;
property bool keyboardRaised: false;
property int numUpdatesAvailable: 0;
@ -44,6 +45,7 @@ Rectangle {
purchasesModel.getFirstPage();
Commerce.getAvailableUpdates();
}
Connections {
target: Commerce;
@ -110,6 +112,11 @@ Rectangle {
}
}
Component.onCompleted: {
isStandalone = PlatformInfo.isStandalone();
console.log(isStandalone ? "IS STANDALONE" : "ISN'T STANDALONE");
}
HifiCommerceCommon.CommerceLightbox {
id: lightboxPopup;
z: 999;
@ -554,7 +561,7 @@ Rectangle {
itemType: model.item_type;
valid: model.valid;
standaloneOptimized: model.standalone_optimized
standaloneIncompatible: model.standalone_incompatible
standaloneIncompatible: root.isStandalone && model.standalone_incompatible
anchors.topMargin: 10;
anchors.bottomMargin: 10;
@ -675,6 +682,14 @@ Rectangle {
lightboxPopup.visible = false;
}
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") {
filterBar.text = msg.filterText;
} 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);
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.
bool inTestMode { false };
for (int i = 0; i < argc; ++i) {
@ -3029,6 +3034,9 @@ void Application::initializeUi() {
};
OffscreenQmlSurface::addWhitelistContextHandler({
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);
QmlContextCallback ttsCallback = [](QQmlContext* context) {

View file

@ -7,7 +7,7 @@
//
#include "PlatformInfoScriptingInterface.h"
#include "Application.h"
#include <shared/GlobalAppProperties.h>
#include <thread>
#ifdef Q_OS_WIN
@ -138,6 +138,14 @@ bool PlatformInfoScriptingInterface::has3DHTML() {
#if defined(Q_OS_ANDROID)
return false;
#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
}

View file

@ -68,9 +68,15 @@ public slots:
/**jsdoc
* 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>.*/
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

View file

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

View file

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