emit desktopNotificationsAllowedChanged();
}
+AccountState::ConnectionStatus AccountState::lastConnectionStatus() const
+{
+ return _lastConnectionValidatorStatus;
+}
+
+void AccountState::trySignIn()
+{
+ if (isSignedOut() && account()) {
+ account()->resetRejectedCertificates();
+ signIn();
+ }
+}
+
void AccountState::checkConnectivity()
{
if (isSignedOut() || _waitingForNewCredentials) {
return;
}
+ _lastConnectionValidatorStatus = status;
+
// Come online gradually from 503 or maintenance mode
if (status == ConnectionValidator::Connected
&& (_connectionStatus == ConnectionValidator::ServiceUnavailable
*/
void setDesktopNotificationsAllowed(bool isAllowed);
+ ConnectionStatus lastConnectionStatus() const;
+
+ void trySignIn();
+
public slots:
/// Triggers a ping to the server to update state and
/// connection status and errors.
AccountPtr _account;
State _state;
ConnectionStatus _connectionStatus;
+ ConnectionStatus _lastConnectionValidatorStatus = ConnectionStatus::Undefined;
QStringList _connectionErrors;
bool _waitingForNewCredentials;
QDateTime _timeOfLastETagCheck;
if (state != AccountState::SignedOut && state != AccountState::ConfigurationError
&& state != AccountState::AskingCredentials && !pushNotificationsAvailable) {
accountState->checkConnectivity();
+ } else if (state == AccountState::SignedOut && accountState->lastConnectionStatus() == AccountState::ConnectionStatus::SslError) {
+ qCWarning(lcApplication) << "Account is signed out due to SSL Handshake error. Going to perform a sign-in attempt...";
+ accountState->trySignIn();
}
}
void ConnectionValidator::slotNoStatusFound(QNetworkReply *reply)
{
auto job = qobject_cast<CheckServerJob *>(sender());
- qCWarning(lcConnectionValidator) << reply->error() << job->errorString() << reply->peek(1024);
+ qCWarning(lcConnectionValidator) << reply->error() << reply->errorString() << job->errorString() << reply->peek(1024);
if (reply->error() == QNetworkReply::SslHandshakeFailedError) {
reportResult(SslError);
return;