All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WebConnectivityErrorHandler.h
1 // Copyright eeGeo Ltd (2016), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Web.h"
6 #include "AlertBox.h"
7 #include "IEegeoErrorHandler.h"
8 #include "ICallback.h"
9 #include "ISingleOptionAlertBoxDismissedHandler.h"
10 #include <string>
11 
12 namespace Eegeo
13 {
14  namespace Web
15  {
16  /*
17  Type to observe the WebConnectivityValidator and handles invalid states.
18  For most states it will simply notify you, but for Capitive Wifi portals it will kill
19  the app due to potentially unreliable caching + responses.
20  */
22  {
23  public:
24 
25  WebConnectivityErrorHandler(WebConnectivityValidator& webConnectivityValidator,
26  IEegeoErrorHandler* pErrorHandler,
27  UI::NativeAlerts::IAlertBoxFactory& alertBoxFactory);
29 
30  const bool AwaitingAlertBoxResponse() const { return m_handlingAlertBox; }
31 
32  private:
33 
34  void HandleConnectivityChanged();
35  void NotifyWarning(const std::string& message);
36  void NotifyFatalError(const std::string& message);
37  void HandleWarningDismissed();
38  void HandleFatalErrorDismissed();
39 
40  WebConnectivityValidator& m_webConnectivityValidator;
41  IEegeoErrorHandler* m_pErrorHandler;
42  UI::NativeAlerts::IAlertBoxFactory& m_alertBoxFactory;
43  Helpers::TCallback0<WebConnectivityErrorHandler> m_connectivityChangedHandler;
44 
45  bool m_handlingAlertBox;
46 
49 
50  };
51  }
52 }