mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 21:18:43 +02:00
Merge pull request #11972 from zfox23/commerce_fixWalletStatus1
Set Wallet Status to 'Ready' after correctly authenticating wallet
This commit is contained in:
commit
f0507e1608
3 changed files with 11 additions and 6 deletions
|
@ -315,7 +315,6 @@ Wallet::Wallet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
walletScriptingInterface->setWalletStatus(status);
|
walletScriptingInterface->setWalletStatus(status);
|
||||||
emit walletStatusResult(status);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
|
@ -491,6 +490,7 @@ bool Wallet::walletIsAuthenticatedWithPassphrase() {
|
||||||
}
|
}
|
||||||
if (_publicKeys.count() > 0) {
|
if (_publicKeys.count() > 0) {
|
||||||
// we _must_ be authenticated if the publicKeys are there
|
// we _must_ be authenticated if the publicKeys are there
|
||||||
|
DependencyManager::get<WalletScriptingInterface>()->setWalletStatus((uint)WalletStatus::WALLET_STATUS_READY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,6 +503,7 @@ bool Wallet::walletIsAuthenticatedWithPassphrase() {
|
||||||
|
|
||||||
// be sure to add the public key so we don't do this over and over
|
// be sure to add the public key so we don't do this over and over
|
||||||
_publicKeys.push_back(publicKey.toBase64());
|
_publicKeys.push_back(publicKey.toBase64());
|
||||||
|
DependencyManager::get<WalletScriptingInterface>()->setWalletStatus((uint)WalletStatus::WALLET_STATUS_READY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -801,15 +802,12 @@ void Wallet::account() {
|
||||||
|
|
||||||
void Wallet::getWalletStatus() {
|
void Wallet::getWalletStatus() {
|
||||||
auto walletScriptingInterface = DependencyManager::get<WalletScriptingInterface>();
|
auto walletScriptingInterface = DependencyManager::get<WalletScriptingInterface>();
|
||||||
uint status;
|
|
||||||
|
|
||||||
if (DependencyManager::get<AccountManager>()->isLoggedIn()) {
|
if (DependencyManager::get<AccountManager>()->isLoggedIn()) {
|
||||||
// This will set account info for the wallet, allowing us to decrypt and display the security image.
|
// This will set account info for the wallet, allowing us to decrypt and display the security image.
|
||||||
account();
|
account();
|
||||||
} else {
|
} else {
|
||||||
status = (uint)WalletStatus::WALLET_STATUS_NOT_LOGGED_IN;
|
walletScriptingInterface->setWalletStatus((uint)WalletStatus::WALLET_STATUS_NOT_LOGGED_IN);
|
||||||
emit walletStatusResult(status);
|
|
||||||
walletScriptingInterface->setWalletStatus(status);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,3 +22,8 @@ void WalletScriptingInterface::refreshWalletStatus() {
|
||||||
auto wallet = DependencyManager::get<Wallet>();
|
auto wallet = DependencyManager::get<Wallet>();
|
||||||
wallet->getWalletStatus();
|
wallet->getWalletStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WalletScriptingInterface::setWalletStatus(const uint& status) {
|
||||||
|
_walletStatus = status;
|
||||||
|
emit DependencyManager::get<Wallet>()->walletStatusResult(status);
|
||||||
|
}
|
|
@ -39,7 +39,9 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void refreshWalletStatus();
|
Q_INVOKABLE void refreshWalletStatus();
|
||||||
Q_INVOKABLE uint getWalletStatus() { return _walletStatus; }
|
Q_INVOKABLE uint getWalletStatus() { return _walletStatus; }
|
||||||
void setWalletStatus(const uint& status) { _walletStatus = status; }
|
// setWalletStatus() should never be made Q_INVOKABLE. If it were,
|
||||||
|
// scripts could cause the Wallet to incorrectly report its status.
|
||||||
|
void setWalletStatus(const uint& status);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void walletStatusChanged();
|
void walletStatusChanged();
|
||||||
|
|
Loading…
Reference in a new issue