mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-19 12:22:47 +01:00
Some optimalizations on OAuth process.
This commit is contained in:
parent
4175dc2265
commit
f23e1aec73
@ -26,6 +26,7 @@
|
||||
|
||||
#include "definitions/definitions.h"
|
||||
#include "miscellaneous/application.h"
|
||||
#include "network-web/networkfactory.h"
|
||||
#include "network-web/webfactory.h"
|
||||
#include "services/inoreader/definitions.h"
|
||||
|
||||
@ -186,7 +187,10 @@ void OAuth2Service::tokenRequestFinished(QNetworkReply* network_reply) {
|
||||
|
||||
qDebug() << "Token response:" << json_document.toJson();
|
||||
|
||||
if (root_obj.keys().contains("error")) {
|
||||
if (network_reply->error() != QNetworkReply::NetworkError::NoError) {
|
||||
emit tokensRetrieveError(QString(), NetworkFactory::networkErrorText(network_reply->error()));
|
||||
}
|
||||
else if (root_obj.keys().contains("error")) {
|
||||
QString error = root_obj.value("error").toString();
|
||||
QString error_description = root_obj.value("error_description").toString();
|
||||
|
||||
|
@ -164,11 +164,11 @@ void GmailServiceRoot::start(bool freshly_activated) {
|
||||
loadFromDatabase();
|
||||
loadCacheFromFile(accountId());
|
||||
|
||||
m_network->oauth()->login();
|
||||
|
||||
if (childCount() <= 1) {
|
||||
syncIn();
|
||||
}
|
||||
|
||||
m_network->oauth()->login();
|
||||
}
|
||||
|
||||
void GmailServiceRoot::stop() {
|
||||
|
@ -269,6 +269,8 @@ void GmailNetworkFactory::onTokensError(const QString& error, const QString& err
|
||||
QSystemTrayIcon::Critical,
|
||||
nullptr, false,
|
||||
[this]() {
|
||||
m_oauth2->setAccessToken(QString());
|
||||
m_oauth2->setRefreshToken(QString());
|
||||
m_oauth2->login();
|
||||
});
|
||||
}
|
||||
|
@ -122,11 +122,12 @@ void InoreaderServiceRoot::start(bool freshly_activated) {
|
||||
loadFromDatabase();
|
||||
loadCacheFromFile(accountId());
|
||||
|
||||
m_network->oauth()->login();
|
||||
|
||||
if (childCount() <= 1) {
|
||||
syncIn();
|
||||
}
|
||||
else {
|
||||
m_network->oauth()->login();
|
||||
}
|
||||
}
|
||||
|
||||
void InoreaderServiceRoot::stop() {
|
||||
|
@ -283,6 +283,8 @@ void InoreaderNetworkFactory::onTokensError(const QString& error, const QString&
|
||||
QSystemTrayIcon::Critical,
|
||||
nullptr, false,
|
||||
[this]() {
|
||||
m_oauth2->setAccessToken(QString());
|
||||
m_oauth2->setRefreshToken(QString());
|
||||
m_oauth2->login();
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user