Better implementation of location change and bugfixes

This commit is contained in:
Zach Fox 2017-10-06 10:47:06 -07:00
parent e5e6d84e07
commit 1fa9bd8fc6
18 changed files with 131 additions and 72 deletions

View file

@ -579,7 +579,6 @@ Rectangle {
} }
rezzedNotifContainer.visible = true; rezzedNotifContainer.visible = true;
rezzedNotifContainerTimer.start(); rezzedNotifContainerTimer.start();
commerce.updatePopLocation(root.itemId);
} }
} }
RalewaySemiBold { RalewaySemiBold {

View file

@ -347,7 +347,6 @@ Item {
if (urlHandler.canHandleUrl(root.itemHref)) { if (urlHandler.canHandleUrl(root.itemHref)) {
urlHandler.handleUrl(root.itemHref); urlHandler.handleUrl(root.itemHref);
} }
commerce.updatePopLocation(root.itemId);
rezzedNotifContainer.visible = true; rezzedNotifContainer.visible = true;
rezzedNotifContainerTimer.start(); rezzedNotifContainerTimer.start();
} }

View file

@ -283,7 +283,7 @@ Rectangle {
Connections { Connections {
onSendSignalToParent: { onSendSignalToParent: {
if (msg.method === "authSuccess") { if (msg.method === "authSuccess") {
root.activeView = "walletHome"; commerce.getWalletStatus();
} else { } else {
sendToScript(msg); sendToScript(msg);
} }

View file

@ -1006,6 +1006,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// connect to the packet sent signal of the _entityEditSender // connect to the packet sent signal of the _entityEditSender
connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent); connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent);
connect(&_entityEditSender, &EntityEditPacketSender::addingEntityWithCertificate, this, &Application::addingEntityWithCertificate);
const char** constArgv = const_cast<const char**>(argv); const char** constArgv = const_cast<const char**>(argv);
QString concurrentDownloadsStr = getCmdOption(argc, constArgv, "--concurrent-downloads"); QString concurrentDownloadsStr = getCmdOption(argc, constArgv, "--concurrent-downloads");
@ -5735,6 +5736,11 @@ int Application::processOctreeStats(ReceivedMessage& message, SharedNodePointer
void Application::packetSent(quint64 length) { void Application::packetSent(quint64 length) {
} }
void Application::addingEntityWithCertificate(const QString& certificateID, const QString& domainID) {
auto ledger = DependencyManager::get<Ledger>();
ledger->updateLocation(certificateID, domainID);
}
void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointer scriptEngine) { void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointer scriptEngine) {
scriptEngine->setEmitScriptUpdatesFunction([this]() { scriptEngine->setEmitScriptUpdatesFunction([this]() {

View file

@ -440,6 +440,7 @@ private slots:
void nodeActivated(SharedNodePointer node); void nodeActivated(SharedNodePointer node);
void nodeKilled(SharedNodePointer node); void nodeKilled(SharedNodePointer node);
static void packetSent(quint64 length); static void packetSent(quint64 length);
static void addingEntityWithCertificate(const QString& certificateID, const QString& domainID);
void updateDisplayMode(); void updateDisplayMode();
void domainConnectionRefused(const QString& reasonMessage, int reason, const QString& extraInfo); void domainConnectionRefused(const QString& reasonMessage, int reason, const QString& extraInfo);

View file

@ -225,12 +225,20 @@ void Ledger::updateLocationSuccess(QNetworkReply& reply) { apiResponse("updateLo
void Ledger::updateLocationFailure(QNetworkReply& reply) { failResponse("updateLocation", reply); } void Ledger::updateLocationFailure(QNetworkReply& reply) { failResponse("updateLocation", reply); }
void Ledger::updateLocation(const QString& asset_id, const QString location, const bool controlledFailure) { void Ledger::updateLocation(const QString& asset_id, const QString location, const bool controlledFailure) {
auto wallet = DependencyManager::get<Wallet>(); auto wallet = DependencyManager::get<Wallet>();
QStringList keys = wallet->listPublicKeys(); auto walletScriptingInterface = DependencyManager::get<WalletScriptingInterface>();
QString key = keys[0]; uint walletStatus = walletScriptingInterface->getWalletStatus();
QJsonObject transaction;
transaction["asset_id"] = asset_id; if (walletStatus != wallet->WALLET_STATUS_READY) {
transaction["location"] = location; emit walletScriptingInterface->walletNotSetup();
QJsonDocument transactionDoc{ transaction }; qDebug(commerce) << "User attempted to update the location of a certificate, but their wallet wasn't ready. Status:" << walletStatus;
auto transactionString = transactionDoc.toJson(QJsonDocument::Compact); } else {
signedSend("transaction", transactionString, key, "location", "updateLocationSuccess", "updateLocationFailure", controlledFailure); QStringList keys = wallet->listPublicKeys();
QString key = keys[0];
QJsonObject transaction;
transaction["asset_id"] = asset_id;
transaction["location"] = location;
QJsonDocument transactionDoc{ transaction };
auto transactionString = transactionDoc.toJson(QJsonDocument::Compact);
signedSend("transaction", transactionString, key, "location", "updateLocationSuccess", "updateLocationFailure", controlledFailure);
}
} }

View file

@ -15,7 +15,6 @@
#include "Ledger.h" #include "Ledger.h"
#include "Wallet.h" #include "Wallet.h"
#include <AccountManager.h> #include <AccountManager.h>
#include "scripting/WalletScriptingInterface.h"
HIFI_QML_DEF(QmlCommerce) HIFI_QML_DEF(QmlCommerce)
@ -29,37 +28,12 @@ QmlCommerce::QmlCommerce(QQuickItem* parent) : OffscreenQmlDialog(parent) {
connect(ledger.data(), &Ledger::historyResult, this, &QmlCommerce::historyResult); connect(ledger.data(), &Ledger::historyResult, this, &QmlCommerce::historyResult);
connect(wallet.data(), &Wallet::keyFilePathIfExistsResult, this, &QmlCommerce::keyFilePathIfExistsResult); connect(wallet.data(), &Wallet::keyFilePathIfExistsResult, this, &QmlCommerce::keyFilePathIfExistsResult);
connect(ledger.data(), &Ledger::accountResult, this, &QmlCommerce::accountResult); connect(ledger.data(), &Ledger::accountResult, this, &QmlCommerce::accountResult);
connect(ledger.data(), &Ledger::accountResult, this, [&]() { connect(wallet.data(), &Wallet::walletStatusResult, this, &QmlCommerce::walletStatusResult);
auto wallet = DependencyManager::get<Wallet>();
auto walletScriptingInterface = DependencyManager::get<WalletScriptingInterface>();
uint status;
if (wallet->getKeyFilePath() == "" || !wallet->getSecurityImage()) {
status = (uint)WalletStatus::WALLET_STATUS_NOT_SET_UP;
} else if (!wallet->walletIsAuthenticatedWithPassphrase()) {
status = (uint)WalletStatus::WALLET_STATUS_NOT_AUTHENTICATED;
} else {
status = (uint)WalletStatus::WALLET_STATUS_READY;
}
walletScriptingInterface->setWalletStatus(status);
emit walletStatusResult(status);
});
} }
void QmlCommerce::getWalletStatus() { void QmlCommerce::getWalletStatus() {
auto walletScriptingInterface = DependencyManager::get<WalletScriptingInterface>(); auto wallet = DependencyManager::get<Wallet>();
uint status; wallet->getWalletStatus();
if (DependencyManager::get<AccountManager>()->isLoggedIn()) {
// This will set account info for the wallet, allowing us to decrypt and display the security image.
account();
} else {
status = (uint)WalletStatus::WALLET_STATUS_NOT_LOGGED_IN;
emit walletStatusResult(status);
walletScriptingInterface->setWalletStatus(status);
return;
}
} }
void QmlCommerce::getLoginStatus() { void QmlCommerce::getLoginStatus() {
@ -151,9 +125,3 @@ void QmlCommerce::account() {
auto ledger = DependencyManager::get<Ledger>(); auto ledger = DependencyManager::get<Ledger>();
ledger->account(); ledger->account();
} }
void QmlCommerce::updatePopLocation(const QString& popId, const bool controlledFailure) {
auto ledger = DependencyManager::get<Ledger>();
auto nodeList = DependencyManager::get<NodeList>();
ledger->updateLocation(popId, nodeList->getDomainHandler().getUUID().toString(), controlledFailure);
}

View file

@ -27,13 +27,6 @@ class QmlCommerce : public OffscreenQmlDialog {
public: public:
QmlCommerce(QQuickItem* parent = nullptr); QmlCommerce(QQuickItem* parent = nullptr);
enum WalletStatus {
WALLET_STATUS_NOT_LOGGED_IN = 0,
WALLET_STATUS_NOT_SET_UP,
WALLET_STATUS_NOT_AUTHENTICATED,
WALLET_STATUS_READY
};
signals: signals:
void walletStatusResult(uint walletStatus); void walletStatusResult(uint walletStatus);
@ -70,8 +63,6 @@ protected:
Q_INVOKABLE void generateKeyPair(); Q_INVOKABLE void generateKeyPair();
Q_INVOKABLE void reset(); Q_INVOKABLE void reset();
Q_INVOKABLE void account(); Q_INVOKABLE void account();
Q_INVOKABLE void updatePopLocation(const QString& popId, const bool controlledFailure = false);
}; };
#endif // hifi_QmlCommerce_h #endif // hifi_QmlCommerce_h

View file

@ -282,9 +282,27 @@ void initializeAESKeys(unsigned char* ivec, unsigned char* ckey, const QByteArra
Wallet::Wallet() { Wallet::Wallet() {
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
auto ledger = DependencyManager::get<Ledger>();
auto& packetReceiver = nodeList->getPacketReceiver(); auto& packetReceiver = nodeList->getPacketReceiver();
packetReceiver.registerListener(PacketType::ChallengeOwnership, this, "handleChallengeOwnershipPacket"); packetReceiver.registerListener(PacketType::ChallengeOwnership, this, "handleChallengeOwnershipPacket");
connect(ledger.data(), &Ledger::accountResult, this, [&]() {
auto wallet = DependencyManager::get<Wallet>();
auto walletScriptingInterface = DependencyManager::get<WalletScriptingInterface>();
uint status;
if (wallet->getKeyFilePath() == "" || !wallet->getSecurityImage()) {
status = (uint)WalletStatus::WALLET_STATUS_NOT_SET_UP;
} else if (!wallet->walletIsAuthenticatedWithPassphrase()) {
status = (uint)WalletStatus::WALLET_STATUS_NOT_AUTHENTICATED;
} else {
status = (uint)WalletStatus::WALLET_STATUS_READY;
}
walletScriptingInterface->setWalletStatus(status);
emit walletStatusResult(status);
});
} }
Wallet::~Wallet() { Wallet::~Wallet() {
@ -695,3 +713,23 @@ bool Wallet::verifyOwnerChallenge(const QByteArray& encryptedText, const QString
decryptedText = QString("fail"); decryptedText = QString("fail");
return true; return true;
} }
void Wallet::account() {
auto ledger = DependencyManager::get<Ledger>();
ledger->account();
}
void Wallet::getWalletStatus() {
auto walletScriptingInterface = DependencyManager::get<WalletScriptingInterface>();
uint status;
if (DependencyManager::get<AccountManager>()->isLoggedIn()) {
// This will set account info for the wallet, allowing us to decrypt and display the security image.
account();
} else {
status = (uint)WalletStatus::WALLET_STATUS_NOT_LOGGED_IN;
emit walletStatusResult(status);
walletScriptingInterface->setWalletStatus(status);
return;
}
}

View file

@ -17,6 +17,7 @@
#include <DependencyManager.h> #include <DependencyManager.h>
#include <Node.h> #include <Node.h>
#include <ReceivedMessage.h> #include <ReceivedMessage.h>
#include "scripting/WalletScriptingInterface.h"
#include <QPixmap> #include <QPixmap>
@ -50,10 +51,20 @@ public:
void reset(); void reset();
void getWalletStatus();
enum WalletStatus {
WALLET_STATUS_NOT_LOGGED_IN = 0,
WALLET_STATUS_NOT_SET_UP,
WALLET_STATUS_NOT_AUTHENTICATED,
WALLET_STATUS_READY
};
signals: signals:
void securityImageResult(bool exists); void securityImageResult(bool exists);
void keyFilePathIfExistsResult(const QString& path); void keyFilePathIfExistsResult(const QString& path);
void walletStatusResult(uint walletStatus);
private slots: private slots:
void handleChallengeOwnershipPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode); void handleChallengeOwnershipPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);
@ -71,6 +82,8 @@ private:
bool readSecurityImage(const QString& inputFilePath, unsigned char** outputBufferPtr, int* outputBufferLen); bool readSecurityImage(const QString& inputFilePath, unsigned char** outputBufferPtr, int* outputBufferLen);
bool verifyOwnerChallenge(const QByteArray& encryptedText, const QString& publicKey, QString& decryptedText); bool verifyOwnerChallenge(const QByteArray& encryptedText, const QString& publicKey, QString& decryptedText);
void account();
}; };
#endif // hifi_Wallet_h #endif // hifi_Wallet_h

View file

@ -18,6 +18,11 @@ CheckoutProxy::CheckoutProxy(QObject* qmlObject, QObject* parent) : QmlWrapper(q
WalletScriptingInterface::WalletScriptingInterface() { WalletScriptingInterface::WalletScriptingInterface() {
} }
void WalletScriptingInterface::refreshWalletStatus() {
auto wallet = DependencyManager::get<Wallet>();
wallet->getWalletStatus();
}
static const QString CHECKOUT_QML_PATH = qApp->applicationDirPath() + "../../../qml/hifi/commerce/checkout/Checkout.qml"; static const QString CHECKOUT_QML_PATH = qApp->applicationDirPath() + "../../../qml/hifi/commerce/checkout/Checkout.qml";
void WalletScriptingInterface::buy(const QString& name, const QString& id, const int& price, const QString& href) { void WalletScriptingInterface::buy(const QString& name, const QString& id, const int& price, const QString& href) {
if (QThread::currentThread() != thread()) { if (QThread::currentThread() != thread()) {

View file

@ -20,6 +20,7 @@
#include <ui/QmlWrapper.h> #include <ui/QmlWrapper.h>
#include <OffscreenUi.h> #include <OffscreenUi.h>
#include "Application.h" #include "Application.h"
#include "commerce/Wallet.h"
class CheckoutProxy : public QmlWrapper { class CheckoutProxy : public QmlWrapper {
Q_OBJECT Q_OBJECT
@ -36,6 +37,7 @@ class WalletScriptingInterface : public QObject, public Dependency {
public: public:
WalletScriptingInterface(); WalletScriptingInterface();
Q_INVOKABLE void refreshWalletStatus();
Q_INVOKABLE uint getWalletStatus() { return _walletStatus; } Q_INVOKABLE uint getWalletStatus() { return _walletStatus; }
void setWalletStatus(const uint& status) { _walletStatus = status; } void setWalletStatus(const uint& status) { _walletStatus = status; }
@ -43,6 +45,7 @@ public:
signals: signals:
void walletStatusChanged(); void walletStatusChanged();
void walletNotSetup();
private: private:
uint _walletStatus; uint _walletStatus;

View file

@ -93,9 +93,9 @@ void EntityEditPacketSender::queueEditEntityMessage(PacketType type,
QByteArray bufferOut(NLPacket::maxPayloadSize(type), 0); QByteArray bufferOut(NLPacket::maxPayloadSize(type), 0);
bool success; bool success;
auto nodeList = DependencyManager::get<NodeList>();
if (properties.parentIDChanged() && properties.getParentID() == AVATAR_SELF_ID) { if (properties.parentIDChanged() && properties.getParentID() == AVATAR_SELF_ID) {
EntityItemProperties propertiesCopy = properties; EntityItemProperties propertiesCopy = properties;
auto nodeList = DependencyManager::get<NodeList>();
const QUuid myNodeID = nodeList->getSessionUUID(); const QUuid myNodeID = nodeList->getSessionUUID();
propertiesCopy.setParentID(myNodeID); propertiesCopy.setParentID(myNodeID);
success = EntityItemProperties::encodeEntityEditPacket(type, entityItemID, propertiesCopy, bufferOut); success = EntityItemProperties::encodeEntityEditPacket(type, entityItemID, propertiesCopy, bufferOut);
@ -110,6 +110,9 @@ void EntityEditPacketSender::queueEditEntityMessage(PacketType type,
qCDebug(entities) << " properties:" << properties; qCDebug(entities) << " properties:" << properties;
#endif #endif
queueOctreeEditMessage(type, bufferOut); queueOctreeEditMessage(type, bufferOut);
if (type == PacketType::EntityAdd && !properties.getCertificateID().isEmpty()) {
emit addingEntityWithCertificate(properties.getCertificateID(), nodeList->getDomainHandler().getUUID().toString());
}
} }
} }

View file

@ -43,6 +43,9 @@ public:
virtual char getMyNodeType() const override { return NodeType::EntityServer; } virtual char getMyNodeType() const override { return NodeType::EntityServer; }
virtual void adjustEditPacketForClockSkew(PacketType type, QByteArray& buffer, qint64 clockSkew) override; virtual void adjustEditPacketForClockSkew(PacketType type, QByteArray& buffer, qint64 clockSkew) override;
signals:
void addingEntityWithCertificate(const QString& certificateID, const QString& domainID);
public slots: public slots:
void processEntityEditNackPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode); void processEntityEditNackPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);

View file

@ -1099,10 +1099,10 @@ bool EntityTree::isScriptInWhitelist(const QString& scriptProperty) {
void EntityTree::startChallengeOwnershipTimer(const EntityItemID& entityItemID) { void EntityTree::startChallengeOwnershipTimer(const EntityItemID& entityItemID) {
QTimer* _challengeOwnershipTimeoutTimer = new QTimer(this); QTimer* _challengeOwnershipTimeoutTimer = new QTimer(this);
connect(this, &EntityTree::killChallengeOwnershipTimeoutTimer, this, [&](const QString& certID) { connect(this, &EntityTree::killChallengeOwnershipTimeoutTimer, this, [=](const QString& certID) {
QReadLocker locker(&_entityCertificateIDMapLock); QReadLocker locker(&_entityCertificateIDMapLock);
EntityItemID id = _entityCertificateIDMap.value(certID); EntityItemID id = _entityCertificateIDMap.value(certID);
if (entityItemID == id) { if (entityItemID == id && _challengeOwnershipTimeoutTimer) {
_challengeOwnershipTimeoutTimer->stop(); _challengeOwnershipTimeoutTimer->stop();
_challengeOwnershipTimeoutTimer->deleteLater(); _challengeOwnershipTimeoutTimer->deleteLater();
} }
@ -1112,8 +1112,10 @@ void EntityTree::startChallengeOwnershipTimer(const EntityItemID& entityItemID)
deleteEntity(entityItemID, true); deleteEntity(entityItemID, true);
QWriteLocker locker(&_recentlyDeletedEntitiesLock); QWriteLocker locker(&_recentlyDeletedEntitiesLock);
_recentlyDeletedEntityItemIDs.insert(usecTimestampNow(), entityItemID); _recentlyDeletedEntityItemIDs.insert(usecTimestampNow(), entityItemID);
_challengeOwnershipTimeoutTimer->stop(); if (_challengeOwnershipTimeoutTimer) {
_challengeOwnershipTimeoutTimer->deleteLater(); _challengeOwnershipTimeoutTimer->stop();
_challengeOwnershipTimeoutTimer->deleteLater();
}
}); });
_challengeOwnershipTimeoutTimer->setInterval(5000); _challengeOwnershipTimeoutTimer->setInterval(5000);
_challengeOwnershipTimeoutTimer->start(); _challengeOwnershipTimeoutTimer->start();
@ -1134,14 +1136,18 @@ void EntityTree::processChallengeOwnershipPacket(ReceivedMessage& message, const
emit killChallengeOwnershipTimeoutTimer(certID); emit killChallengeOwnershipTimeoutTimer(certID);
if (decryptedText == "fail") { if (decryptedText == "fail") {
QReadLocker certIdMapLocker(&_entityCertificateIDMapLock); EntityItemID id;
EntityItemID id = _entityCertificateIDMap.value(certID); {
QReadLocker certIdMapLocker(&_entityCertificateIDMapLock);
qCDebug(entities) << "Ownership challenge failed, deleting entity" << id; id = _entityCertificateIDMap.value(certID);
deleteEntity(id, true); }
QWriteLocker recentlyDeletedLocker(&_recentlyDeletedEntitiesLock);
_recentlyDeletedEntityItemIDs.insert(usecTimestampNow(), id); if (!id.isNull()) {
} else { qCDebug(entities) << "Ownership challenge failed, deleting entity" << id;
deleteEntity(id, true);
QWriteLocker recentlyDeletedLocker(&_recentlyDeletedEntitiesLock);
_recentlyDeletedEntityItemIDs.insert(usecTimestampNow(), id);
}
} }
} }
@ -2173,3 +2179,6 @@ QStringList EntityTree::getJointNames(const QUuid& entityID) const {
return entity->getJointNames(); return entity->getJointNames();
} }
void EntityTree::startDynamicDomainVerification() {
}

View file

@ -369,6 +369,7 @@ protected:
QHash<EntityItemID, EntityItemPointer> _entitiesToAdd; QHash<EntityItemID, EntityItemPointer> _entitiesToAdd;
Q_INVOKABLE void startChallengeOwnershipTimer(const EntityItemID& entityItemID); Q_INVOKABLE void startChallengeOwnershipTimer(const EntityItemID& entityItemID);
void startDynamicDomainVerification();
}; };
#endif // hifi_EntityTree_h #endif // hifi_EntityTree_h

View file

@ -129,6 +129,10 @@
} }
} }
function openWallet() {
tablet.pushOntoStack(MARKETPLACE_WALLET_QML_PATH);
}
function setCertificateInfo(currentEntityWithContextOverlay, itemMarketplaceId) { function setCertificateInfo(currentEntityWithContextOverlay, itemMarketplaceId) {
wireEventBridge(true); wireEventBridge(true);
tablet.sendToQml({ tablet.sendToQml({
@ -158,6 +162,7 @@
Entities.canWriteAssetsChanged.connect(onCanWriteAssetsChanged); Entities.canWriteAssetsChanged.connect(onCanWriteAssetsChanged);
ContextOverlay.contextOverlayClicked.connect(setCertificateInfo); ContextOverlay.contextOverlayClicked.connect(setCertificateInfo);
GlobalServices.myUsernameChanged.connect(onUsernameChanged); GlobalServices.myUsernameChanged.connect(onUsernameChanged);
Wallet.refreshWalletStatus();
function onMessage(message) { function onMessage(message) {
@ -214,7 +219,7 @@
} else if (parsedJsonMessage.type === "LOGIN") { } else if (parsedJsonMessage.type === "LOGIN") {
openLoginWindow(); openLoginWindow();
} else if (parsedJsonMessage.type === "WALLET_SETUP") { } else if (parsedJsonMessage.type === "WALLET_SETUP") {
tablet.pushOntoStack(MARKETPLACE_WALLET_QML_PATH); openWallet();
} else if (parsedJsonMessage.type === "MY_ITEMS") { } else if (parsedJsonMessage.type === "MY_ITEMS") {
referrerURL = MARKETPLACE_URL_INITIAL; referrerURL = MARKETPLACE_URL_INITIAL;
filterText = ""; filterText = "";
@ -281,7 +286,7 @@
case 'purchases_openWallet': case 'purchases_openWallet':
case 'checkout_openWallet': case 'checkout_openWallet':
case 'checkout_setUpClicked': case 'checkout_setUpClicked':
tablet.pushOntoStack(MARKETPLACE_WALLET_QML_PATH); openWallet();
break; break;
case 'purchases_walletNotSetUp': case 'purchases_walletNotSetUp':
case 'checkout_walletNotSetUp': case 'checkout_walletNotSetUp':
@ -290,7 +295,7 @@
method: 'updateWalletReferrer', method: 'updateWalletReferrer',
referrer: "purchases" referrer: "purchases"
}); });
tablet.pushOntoStack(MARKETPLACE_WALLET_QML_PATH); openWallet();
break; break;
case 'checkout_cancelClicked': case 'checkout_cancelClicked':
tablet.gotoWebScreen(MARKETPLACE_URL + '/items/' + message.params, MARKETPLACES_INJECT_SCRIPT_URL); tablet.gotoWebScreen(MARKETPLACE_URL + '/items/' + message.params, MARKETPLACES_INJECT_SCRIPT_URL);

View file

@ -94,13 +94,15 @@
EDIT_ERROR: 4, EDIT_ERROR: 4,
TABLET: 5, TABLET: 5,
CONNECTION: 6, CONNECTION: 6,
WALLET: 7,
properties: [ properties: [
{ text: "Snapshot" }, { text: "Snapshot" },
{ text: "Level of Detail" }, { text: "Level of Detail" },
{ text: "Connection Refused" }, { text: "Connection Refused" },
{ text: "Edit error" }, { text: "Edit error" },
{ text: "Tablet" }, { text: "Tablet" },
{ text: "Connection" } { text: "Connection" },
{ text: "Wallet" }
], ],
getTypeFromMenuItem: function (menuItemName) { getTypeFromMenuItem: function (menuItemName) {
var type; var type;
@ -574,6 +576,10 @@
createNotification(wordWrap("Error trying to make connection: " + error), NotificationType.CONNECTION); createNotification(wordWrap("Error trying to make connection: " + error), NotificationType.CONNECTION);
} }
function walletNotSetup() {
createNotification("The action you performed requires you to set up your Wallet. Open the Wallet app.", NotificationType.SNAPSHOT);
}
// handles mouse clicks on buttons // handles mouse clicks on buttons
function mousePressEvent(event) { function mousePressEvent(event) {
var pickRay, var pickRay,
@ -682,6 +688,7 @@
Window.notifyEditError = onEditError; Window.notifyEditError = onEditError;
Window.notify = onNotify; Window.notify = onNotify;
Tablet.tabletNotification.connect(tabletNotification); Tablet.tabletNotification.connect(tabletNotification);
Wallet.walletNotSetup.connect(walletNotSetup);
setup(); setup();
}()); // END LOCAL_SCOPE }()); // END LOCAL_SCOPE