Showing the changes to interface/src/ConnectionMonitor.cpp (1 of 3 files). Show all
Unified · Split
| @@ -18,11 +18,15 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <DomainHandler.h> |
| 19 | 19 | #include <AddressManager.h> |
| 20 | 20 | #include <NodeList.h> |
| 21 | +#include <SettingHandle.h> | |
| 21 | 22 | |
| 22 | 23 | // Because the connection monitor is created at startup, the time we wait on initial load |
| 23 | 24 | // should be longer to allow the application to initialize. |
| 24 | 25 | static const int ON_INITIAL_LOAD_REDIRECT_AFTER_DISCONNECTED_FOR_X_MS = 10000; |
| 25 | 26 | static const int REDIRECT_AFTER_DISCONNECTED_FOR_X_MS = 5000; |
| 27 | +static const int ON_INITIAL_LOAD_DISPLAY_AFTER_DISCONNECTED_FOR_X_MS = 10000; | |
| 28 | +static const int DISPLAY_AFTER_DISCONNECTED_FOR_X_MS = 5000; | |
| 29 | +Setting::Handle<bool> enableInterstitialMode{ "enableInterstitialMode", false }; | |
| 26 | 30 | |
| 27 | 31 | void ConnectionMonitor::init() { |
| 28 | 32 | // Connect to domain disconnected message |
| @@ -37,20 +41,36 @@ void ConnectionMonitor::init() { · 8 unmodified lines | ||
| 37 | 41 | |
| 38 | 42 | _timer.setSingleShot(true); |
| 39 | 43 | if (!domainHandler.isConnected()) { |
| 40 | − _timer.start(ON_INITIAL_LOAD_REDIRECT_AFTER_DISCONNECTED_FOR_X_MS); | |
| 44 | + if (enableInterstitialMode.get()) { | |
| 45 | + _timer.start(ON_INITIAL_LOAD_REDIRECT_AFTER_DISCONNECTED_FOR_X_MS); | |
| 46 | + } else { | |
| 47 | + _timer.start(ON_INITIAL_LOAD_DISPLAY_AFTER_DISCONNECTED_FOR_X_MS); | |
| 48 | + } | |
| 41 | 49 | } |
| 42 | 50 | |
| 43 | 51 | connect(&_timer, &QTimer::timeout, this, [this]() { |
| 44 | − qDebug() << "ConnectionMonitor: Redirecting to 404 error domain"; | |
| 45 | 52 | // set in a timeout error |
| 46 | − emit setRedirectErrorState(REDIRECT_HIFI_ADDRESS, 5); | |
| 53 | + if (enableInterstitialMode.get()) { | |
| 54 | + qDebug() << "ConnectionMonitor: Redirecting to 404 error domain"; | |
| 55 | + emit setRedirectErrorState(REDIRECT_HIFI_ADDRESS, 5); | |
| 56 | + } else { | |
| 57 | + qDebug() << "ConnectionMonitor: Showing connection failure window"; | |
| 58 | + DependencyManager::get<DialogsManager>()->setDomainConnectionFailureVisibility(true); | |
| 59 | + } | |
| 47 | 60 | }); |
| 48 | 61 | } |
| 49 | 62 | |
| 50 | 63 | void ConnectionMonitor::startTimer() { |
| 51 | − _timer.start(REDIRECT_AFTER_DISCONNECTED_FOR_X_MS); | |
| 64 | + if (enableInterstitialMode.get()) { | |
| 65 | + _timer.start(REDIRECT_AFTER_DISCONNECTED_FOR_X_MS); | |
| 66 | + } else { | |
| 67 | + _timer.start(DISPLAY_AFTER_DISCONNECTED_FOR_X_MS); | |
| 68 | + } | |
| 52 | 69 | } |
| 53 | 70 | |
| 54 | 71 | void ConnectionMonitor::stopTimer() { |
| 55 | 72 | _timer.stop(); |
| 73 | + if (!enableInterstitialMode.get()) { | |
| 74 | + DependencyManager::get<DialogsManager>()->setDomainConnectionFailureVisibility(false); | |
| 75 | + } | |
| 56 | 76 | } |