committing requested changes

This commit is contained in:
Wayne Chen 2018-09-19 14:26:30 -07:00
parent a43799fffa
commit 7e796f7e7f
4 changed files with 13 additions and 15 deletions

View file

@ -18,7 +18,6 @@
#include <DomainHandler.h>
#include <AddressManager.h>
#include <NodeList.h>
#include <SettingHandle.h>
// Because the connection monitor is created at startup, the time we wait on initial load
// should be longer to allow the application to initialize.
@ -40,8 +39,7 @@ void ConnectionMonitor::init() {
_timer.setSingleShot(true);
if (!domainHandler.isConnected()) {
Setting::Handle<bool> enableInterstitialMode{ "enableInterstitialMode", false };
if (enableInterstitialMode.get()) {
if (_enableInterstitialMode.get()) {
_timer.start(ON_INITIAL_LOAD_REDIRECT_AFTER_DISCONNECTED_FOR_X_MS);
} else {
_timer.start(ON_INITIAL_LOAD_DISPLAY_AFTER_DISCONNECTED_FOR_X_MS);
@ -50,8 +48,7 @@ void ConnectionMonitor::init() {
connect(&_timer, &QTimer::timeout, this, [this]() {
// set in a timeout error
Setting::Handle<bool> enableInterstitialMode{ "enableInterstitialMode", false };
if (enableInterstitialMode.get()) {
if (_enableInterstitialMode.get()) {
qDebug() << "ConnectionMonitor: Redirecting to 404 error domain";
emit setRedirectErrorState(REDIRECT_HIFI_ADDRESS, 5);
} else {
@ -62,8 +59,7 @@ void ConnectionMonitor::init() {
}
void ConnectionMonitor::startTimer() {
Setting::Handle<bool> enableInterstitialMode{ "enableInterstitialMode", false };
if (enableInterstitialMode.get()) {
if (_enableInterstitialMode.get()) {
_timer.start(REDIRECT_AFTER_DISCONNECTED_FOR_X_MS);
} else {
_timer.start(DISPLAY_AFTER_DISCONNECTED_FOR_X_MS);
@ -72,8 +68,7 @@ void ConnectionMonitor::startTimer() {
void ConnectionMonitor::stopTimer() {
_timer.stop();
Setting::Handle<bool> enableInterstitialMode{ "enableInterstitialMode", false };
if (!enableInterstitialMode.get()) {
if (!_enableInterstitialMode.get()) {
DependencyManager::get<DialogsManager>()->setDomainConnectionFailureVisibility(false);
}
}

View file

@ -15,6 +15,8 @@
#include <QObject>
#include <QTimer>
#include <SettingHandle.h>
class QUrl;
class QString;
@ -32,6 +34,7 @@ private slots:
private:
QTimer _timer;
Setting::Handle<bool> _enableInterstitialMode{ "enableInterstitialMode", false };
};
#endif // hifi_ConnectionMonitor_h
#endif // hifi_ConnectionMonitor_h

View file

@ -14,7 +14,6 @@
#include <math.h>
#include <PathUtils.h>
#include <SettingHandle.h>
#include <QtCore/QJsonDocument>
#include <QtCore/QDataStream>
@ -486,9 +485,8 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
#if defined(Q_OS_ANDROID)
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
#else
Setting::Handle<bool> enableInterstitialMode{ "enableInterstitialMode", false };
if (enableInterstitialMode.get()) {
if (_enableInterstitialMode.get()) {
if (reasonCode == ConnectionRefusedReason::ProtocolMismatch || reasonCode == ConnectionRefusedReason::NotAuthorized) {
// ingest the error - this is a "hard" connection refusal.
setRedirectErrorState(_errorDomainURL, (int)reasonCode);
@ -496,8 +494,7 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
}
_lastDomainConnectionError = (int)reasonCode;
}
else {
} else {
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
}
#endif

View file

@ -19,6 +19,8 @@
#include <QtCore/QUrl>
#include <QtNetwork/QHostInfo>
#include <SettingHandle.h>
#include "HifiSockAddr.h"
#include "NetworkPeer.h"
#include "NLPacket.h"
@ -221,6 +223,7 @@ private:
NetworkPeer _icePeer;
bool _isConnected { false };
bool _isInErrorState { false };
Setting::Handle<bool> _enableInterstitialMode{ "enableInterstitialMode", false };
QJsonObject _settingsObject;
QString _pendingPath;
QTimer _settingsTimer;