mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 11:47:46 +00:00
Async WritePassword hates me
This commit is contained in:
parent
322885e8e8
commit
167a94a2fe
2 changed files with 7 additions and 9 deletions
|
@ -106,7 +106,7 @@ private:
|
||||||
/*
|
/*
|
||||||
* Sets a value in the keychain. This function is asynchronous.
|
* Sets a value in the keychain. This function is asynchronous.
|
||||||
*/
|
*/
|
||||||
QCoro::Task<> setKeychainValue(const QString &key, const QString &value);
|
void setKeychainValue(const QString &key, const QString &value);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieves a value from the keychain. This function is synchronous.
|
* Retrieves a value from the keychain. This function is synchronous.
|
||||||
|
|
|
@ -269,7 +269,7 @@ void Account::fetchAvatar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QCoro::Task<> Account::setKeychainValue(const QString &key, const QString &value)
|
void Account::setKeychainValue(const QString &key, const QString &value)
|
||||||
{
|
{
|
||||||
auto job = new QKeychain::WritePasswordJob(QStringLiteral("Astra"), this);
|
auto job = new QKeychain::WritePasswordJob(QStringLiteral("Astra"), this);
|
||||||
job->setTextData(value);
|
job->setTextData(value);
|
||||||
|
@ -281,13 +281,11 @@ QCoro::Task<> Account::setKeychainValue(const QString &key, const QString &value
|
||||||
job->setInsecureFallback(m_launcher.isSteamDeck()); // The Steam Deck does not have secrets provider in Game Mode
|
job->setInsecureFallback(m_launcher.isSteamDeck()); // The Steam Deck does not have secrets provider in Game Mode
|
||||||
job->start();
|
job->start();
|
||||||
|
|
||||||
co_await qCoro(job, &QKeychain::WritePasswordJob::finished);
|
connect(job, &QKeychain::WritePasswordJob::finished, this, [job] {
|
||||||
|
if (job->error() != QKeychain::NoError) {
|
||||||
if (job->error() != QKeychain::NoError) {
|
qWarning(ASTRA_LOG) << "Error when writing" << job->errorString();
|
||||||
qWarning(ASTRA_LOG) << "Error when writing" << key << job->errorString();
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
co_return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QCoro::Task<QString> Account::getKeychainValue(const QString &key)
|
QCoro::Task<QString> Account::getKeychainValue(const QString &key)
|
||||||
|
|
Loading…
Add table
Reference in a new issue