mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 18:01:15 +02:00
checkpoint
This commit is contained in:
parent
acda90577a
commit
1aaae94cc1
9 changed files with 90 additions and 15 deletions
|
@ -59,11 +59,19 @@ Rectangle {
|
||||||
notSetUpTimer.start();
|
notSetUpTimer.start();
|
||||||
}
|
}
|
||||||
} else if (walletStatus === 2) {
|
} else if (walletStatus === 2) {
|
||||||
|
if (root.activeView != "preexisting") {
|
||||||
|
root.activeView = "preexisting";
|
||||||
|
}
|
||||||
|
} else if (walletStatus === 3) {
|
||||||
|
if (root.activeView != "conflicting") {
|
||||||
|
root.activeView = "conflicting";
|
||||||
|
}
|
||||||
|
} else if (walletStatus === 4) {
|
||||||
if (root.activeView !== "passphraseModal") {
|
if (root.activeView !== "passphraseModal") {
|
||||||
root.activeView = "passphraseModal";
|
root.activeView = "passphraseModal";
|
||||||
UserActivityLogger.commercePassphraseEntry("marketplace checkout");
|
UserActivityLogger.commercePassphraseEntry("marketplace checkout");
|
||||||
}
|
}
|
||||||
} else if (walletStatus === 3) {
|
} else if (walletStatus === 5) {
|
||||||
authSuccessStep();
|
authSuccessStep();
|
||||||
} else {
|
} else {
|
||||||
console.log("ERROR in Checkout.qml: Unknown wallet status: " + walletStatus);
|
console.log("ERROR in Checkout.qml: Unknown wallet status: " + walletStatus);
|
||||||
|
|
|
@ -37,9 +37,9 @@ Item {
|
||||||
onWalletStatusResult: {
|
onWalletStatusResult: {
|
||||||
if (walletStatus === 0) {
|
if (walletStatus === 0) {
|
||||||
sendToParent({method: "needsLogIn"});
|
sendToParent({method: "needsLogIn"});
|
||||||
} else if (walletStatus === 3) {
|
} else if (walletStatus === 5) {
|
||||||
Commerce.getSecurityImage();
|
Commerce.getSecurityImage();
|
||||||
} else if (walletStatus > 3) {
|
} else if (walletStatus > 5) {
|
||||||
console.log("ERROR in EmulatedMarketplaceHeader.qml: Unknown wallet status: " + walletStatus);
|
console.log("ERROR in EmulatedMarketplaceHeader.qml: Unknown wallet status: " + walletStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,11 +53,19 @@ Rectangle {
|
||||||
notSetUpTimer.start();
|
notSetUpTimer.start();
|
||||||
}
|
}
|
||||||
} else if (walletStatus === 2) {
|
} else if (walletStatus === 2) {
|
||||||
|
if (root.activeView != "preexisting") {
|
||||||
|
root.activeView = "preexisting";
|
||||||
|
}
|
||||||
|
} else if (walletStatus === 3) {
|
||||||
|
if (root.activeView != "conflicting") {
|
||||||
|
root.activeView = "conflicting";
|
||||||
|
}
|
||||||
|
} else if (walletStatus === 4) {
|
||||||
if (root.activeView !== "passphraseModal") {
|
if (root.activeView !== "passphraseModal") {
|
||||||
root.activeView = "passphraseModal";
|
root.activeView = "passphraseModal";
|
||||||
UserActivityLogger.commercePassphraseEntry("marketplace purchases");
|
UserActivityLogger.commercePassphraseEntry("marketplace purchases");
|
||||||
}
|
}
|
||||||
} else if (walletStatus === 3) {
|
} else if (walletStatus === 5) {
|
||||||
if ((Settings.getValue("isFirstUseOfPurchases", true) || root.isDebuggingFirstUseTutorial) && root.activeView !== "firstUseTutorial") {
|
if ((Settings.getValue("isFirstUseOfPurchases", true) || root.isDebuggingFirstUseTutorial) && root.activeView !== "firstUseTutorial") {
|
||||||
root.activeView = "firstUseTutorial";
|
root.activeView = "firstUseTutorial";
|
||||||
} else if (!Settings.getValue("isFirstUseOfPurchases", true) && root.activeView === "initialize") {
|
} else if (!Settings.getValue("isFirstUseOfPurchases", true) && root.activeView === "initialize") {
|
||||||
|
|
|
@ -56,11 +56,19 @@ Rectangle {
|
||||||
(AddressManager.placename || AddressManager.hostname || '') + (AddressManager.pathname ? AddressManager.pathname.match(/\/[^\/]+/)[0] : ''));
|
(AddressManager.placename || AddressManager.hostname || '') + (AddressManager.pathname ? AddressManager.pathname.match(/\/[^\/]+/)[0] : ''));
|
||||||
}
|
}
|
||||||
} else if (walletStatus === 2) {
|
} else if (walletStatus === 2) {
|
||||||
|
if (root.activeView != "preexisting") {
|
||||||
|
root.activeView = "preexisting";
|
||||||
|
}
|
||||||
|
} else if (walletStatus === 3) {
|
||||||
|
if (root.activeView != "conflicting") {
|
||||||
|
root.activeView = "conflicting";
|
||||||
|
}
|
||||||
|
} else if (walletStatus === 4) {
|
||||||
if (root.activeView !== "passphraseModal") {
|
if (root.activeView !== "passphraseModal") {
|
||||||
root.activeView = "passphraseModal";
|
root.activeView = "passphraseModal";
|
||||||
UserActivityLogger.commercePassphraseEntry("wallet app");
|
UserActivityLogger.commercePassphraseEntry("wallet app");
|
||||||
}
|
}
|
||||||
} else if (walletStatus === 3) {
|
} else if (walletStatus === 5) {
|
||||||
if (root.activeView !== "walletSetup") {
|
if (root.activeView !== "walletSetup") {
|
||||||
root.activeView = "walletHome";
|
root.activeView = "walletHome";
|
||||||
Commerce.getSecurityImage();
|
Commerce.getSecurityImage();
|
||||||
|
@ -168,6 +176,10 @@ Rectangle {
|
||||||
//
|
//
|
||||||
// TITLE BAR END
|
// TITLE BAR END
|
||||||
//
|
//
|
||||||
|
WalletChoice {
|
||||||
|
visible: (root.activeView === "preexisiting") || (root.activeView === "conflicting");
|
||||||
|
activeView: root.activeView;
|
||||||
|
}
|
||||||
|
|
||||||
WalletSetup {
|
WalletSetup {
|
||||||
id: walletSetup;
|
id: walletSetup;
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
//
|
||||||
|
// WalletChoice.qml
|
||||||
|
// qml/hifi/commerce/wallet
|
||||||
|
//
|
||||||
|
// WalletChoice
|
||||||
|
//
|
||||||
|
// Created by Howard Stearns
|
||||||
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
import Hifi 1.0 as Hifi
|
||||||
|
import QtQuick 2.5
|
||||||
|
import "../../../styles-uit"
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
property string activeView: "conflict";
|
||||||
|
RalewayRegular {
|
||||||
|
text: "You have a wallet elsewhere." + activeView;
|
||||||
|
}
|
||||||
|
}
|
|
@ -318,8 +318,8 @@ Item {
|
||||||
|
|
||||||
RalewayRegular {
|
RalewayRegular {
|
||||||
id: noActivityText;
|
id: noActivityText;
|
||||||
text: "<b>The Wallet app is in closed Beta.</b><br><br>To request entry and <b>receive free HFC</b>, please contact " +
|
text: "To <b>receive free HFC</b>, please go to " +
|
||||||
"<b>info@highfidelity.com</b> with your High Fidelity account username and the email address registered to that account.";
|
'<a href="hifi://BankOfHighFidelity/415.049,5.55924,-254.583/0,0.995213,0,0.0977305">BankOfHighFidelity</a>';
|
||||||
// Text size
|
// Text size
|
||||||
size: 24;
|
size: 24;
|
||||||
// Style
|
// Style
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
// inventory answers {status: 'success', data: {assets: [{id: "guid", title: "name", preview: "url"}....]}}
|
// inventory answers {status: 'success', data: {assets: [{id: "guid", title: "name", preview: "url"}....]}}
|
||||||
// balance answers {status: 'success', data: {balance: integer}}
|
// balance answers {status: 'success', data: {balance: integer}}
|
||||||
// buy and receive_at answer {status: 'success'}
|
// buy and receive_at answer {status: 'success'}
|
||||||
|
// account synthesizes a result {status: 'success', data: {keyStatus: "preexisting"|"conflicting"|"ok"}}
|
||||||
|
|
||||||
|
|
||||||
QJsonObject Ledger::apiResponse(const QString& label, QNetworkReply& reply) {
|
QJsonObject Ledger::apiResponse(const QString& label, QNetworkReply& reply) {
|
||||||
QByteArray response = reply.readAll();
|
QByteArray response = reply.readAll();
|
||||||
|
@ -178,7 +180,7 @@ QString transactionString(const QJsonObject& valueObject) {
|
||||||
} else {
|
} else {
|
||||||
result += valueObject["message"].toString();
|
result += valueObject["message"].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// no matter what we append a smaller date to the bottom of this...
|
// no matter what we append a smaller date to the bottom of this...
|
||||||
result += QString("<br><font size='-2' color='#1080B8'>%1").arg(createdAt.toLocalTime().toString(Qt::DefaultLocaleShortDate));
|
result += QString("<br><font size='-2' color='#1080B8'>%1").arg(createdAt.toLocalTime().toString(Qt::DefaultLocaleShortDate));
|
||||||
return result;
|
return result;
|
||||||
|
@ -250,13 +252,26 @@ void Ledger::accountSuccess(QNetworkReply& reply) {
|
||||||
wallet->setIv(iv);
|
wallet->setIv(iv);
|
||||||
wallet->setCKey(ckey);
|
wallet->setCKey(ckey);
|
||||||
|
|
||||||
|
QString keyStatus = "ok";
|
||||||
QStringList localPublicKeys = wallet->listPublicKeys();
|
QStringList localPublicKeys = wallet->listPublicKeys();
|
||||||
if (remotePublicKey.isEmpty() && !localPublicKeys.isEmpty()) {
|
if (remotePublicKey.isEmpty()) {
|
||||||
receiveAt(localPublicKeys.first(), "");
|
if (!localPublicKeys.isEmpty()) {
|
||||||
|
receiveAt(localPublicKeys.first(), "");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (localPublicKeys.isEmpty()) {
|
||||||
|
keyStatus = "preexisting";
|
||||||
|
} else if (localPublicKeys.first() != remotePublicKey) {
|
||||||
|
keyStatus = "conflicting";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// none of the hfc account info should be emitted
|
// none of the hfc account info should be emitted
|
||||||
emit accountResult(QJsonObject{ {"status", "success"} });
|
QJsonObject json;
|
||||||
|
QJsonObject responseData{ { "status", "success"} };
|
||||||
|
json["keyStatus"] = keyStatus;
|
||||||
|
responseData["data"] = json;
|
||||||
|
emit accountResult(responseData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ledger::accountFailure(QNetworkReply& reply) {
|
void Ledger::accountFailure(QNetworkReply& reply) {
|
||||||
|
|
|
@ -300,17 +300,24 @@ Wallet::Wallet() {
|
||||||
packetReceiver.registerListener(PacketType::ChallengeOwnership, this, "handleChallengeOwnershipPacket");
|
packetReceiver.registerListener(PacketType::ChallengeOwnership, this, "handleChallengeOwnershipPacket");
|
||||||
packetReceiver.registerListener(PacketType::ChallengeOwnershipRequest, this, "handleChallengeOwnershipPacket");
|
packetReceiver.registerListener(PacketType::ChallengeOwnershipRequest, this, "handleChallengeOwnershipPacket");
|
||||||
|
|
||||||
connect(ledger.data(), &Ledger::accountResult, this, [&]() {
|
connect(ledger.data(), &Ledger::accountResult, this, [&](QJsonObject result) {
|
||||||
auto wallet = DependencyManager::get<Wallet>();
|
auto wallet = DependencyManager::get<Wallet>();
|
||||||
auto walletScriptingInterface = DependencyManager::get<WalletScriptingInterface>();
|
auto walletScriptingInterface = DependencyManager::get<WalletScriptingInterface>();
|
||||||
uint status;
|
uint status;
|
||||||
|
QString keyStatus = result.contains("data") ? result["data"].toObject()["keyStatus"].toString() : "";
|
||||||
|
|
||||||
if (wallet->getKeyFilePath() == "" || !wallet->getSecurityImage()) {
|
if (wallet->getKeyFilePath() == "" || !wallet->getSecurityImage()) {
|
||||||
status = (uint)WalletStatus::WALLET_STATUS_NOT_SET_UP;
|
if (keyStatus == "preexisting") {
|
||||||
|
status = (uint) WalletStatus::WALLET_STATUS_PREEXISTING;
|
||||||
|
} else{
|
||||||
|
status = (uint) WalletStatus::WALLET_STATUS_NOT_SET_UP;
|
||||||
|
}
|
||||||
} else if (!wallet->walletIsAuthenticatedWithPassphrase()) {
|
} else if (!wallet->walletIsAuthenticatedWithPassphrase()) {
|
||||||
status = (uint)WalletStatus::WALLET_STATUS_NOT_AUTHENTICATED;
|
status = (uint) WalletStatus::WALLET_STATUS_NOT_AUTHENTICATED;
|
||||||
|
} else if (keyStatus == "conflicting") {
|
||||||
|
status = (uint) WalletStatus::WALLET_STATUS_CONFLICTING;
|
||||||
} else {
|
} else {
|
||||||
status = (uint)WalletStatus::WALLET_STATUS_READY;
|
status = (uint) WalletStatus::WALLET_STATUS_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
walletScriptingInterface->setWalletStatus(status);
|
walletScriptingInterface->setWalletStatus(status);
|
||||||
|
|
|
@ -53,6 +53,8 @@ public:
|
||||||
enum WalletStatus {
|
enum WalletStatus {
|
||||||
WALLET_STATUS_NOT_LOGGED_IN = 0,
|
WALLET_STATUS_NOT_LOGGED_IN = 0,
|
||||||
WALLET_STATUS_NOT_SET_UP,
|
WALLET_STATUS_NOT_SET_UP,
|
||||||
|
WALLET_STATUS_PREEXISTING,
|
||||||
|
WALLET_STATUS_CONFLICTING,
|
||||||
WALLET_STATUS_NOT_AUTHENTICATED,
|
WALLET_STATUS_NOT_AUTHENTICATED,
|
||||||
WALLET_STATUS_READY
|
WALLET_STATUS_READY
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue