You.i Engine
yi::deprecated::CYIWebViewBridge Class Referenceabstract

Detailed Description

Utility to open a web view from within the application. This is in contrast to a CYIWebBrowserBridge which can be used to open a web page in another process.

Deprecated:
This class has been deprecated and may be removed in a future release. The CYIWebViewController class should be used instead.

This bridge is available on all mobile platforms.

A simple example of the usage of CYIWebViewBridge which delays the display of the web view until the content is loaded so as to avoid displaying an empty screen while the content loads.

class WebViewGoogle : public CYISignalHandler
{
public:
WebViewGoogle() :
m_pWebViewBridge(nullptr)
{
}
void InitWebView()
{
// Get pointer to the web view bridge
if (m_pWebViewBridge != nullptr)
{
// Connect to web view bridge signals
m_pWebViewBridge->WebViewLoadFinished.Connect(*this, &WebViewGoogle::OnLoadFinished);
m_pWebViewBridge->WebViewLoadError.Connect(*this, &WebViewGoogle::OnLoadFailed);
// Specify the resource for the web view to load
m_pWebViewBridge->SetResource("https://www.google.com", yi::deprecated::CYIWebViewBridge::WEB_VIEW_HTTP_URL);
// Configure the web view so that it loads in the background
m_pWebViewBridge->SetDisplayWebView(false);
}
}
void OnButtonClicked()
{
if (m_pWebViewBridge != nullptr)
{
m_pWebViewBridge->StartWebView();
}
}
void OnLoadFinished()
{
// Show the web view now that it has some content to show
m_pWebViewBridge->ShowWebView();
}
void OnLoadFailed()
{
m_pWebViewBridge->StopWebView();
// The WebView content failed to load, so show the user an error message
ShowErrorDialog();
}
void ShowErrorDialog()
{
// Display an error message to the user
}
void ShowProgressIndicator()
{
// Display a progress indicator while the web view loads
}
private:
};

#include <deprecated/YiWebViewBridge.h>

Public Types

enum  RESOURCE_TYPE {
  WEB_VIEW_HTTP_URL,
  WEB_VIEW_FILE_URL,
  WEB_VIEW_HTML_DOC
}
 
enum  WEBVIEW_EVENT {
  WEB_VIEW_LOAD_STARTED,
  WEB_VIEW_LOAD_FINISHED,
  WEB_VIEW_LOAD_ERROR,
  WEB_VIEW_DISMISSED
}
 

Public Member Functions

 CYIWebViewBridge ()
 
virtual ~CYIWebViewBridge ()
 
virtual bool StartWebView ()=0
 
virtual void StopWebView ()=0
 
virtual void ShowWebView ()=0
 
virtual void HideWebView ()=0
 
virtual void ClearCachedData ()=0
 
virtual void SetResource (const CYIString &rResource, RESOURCE_TYPE eResourceType)=0
 
virtual const CYIStringGetResource () const =0
 
virtual RESOURCE_TYPE GetResourceType () const =0
 
virtual void SetTitle (const CYIString &rTitle)=0
 
virtual const CYIStringGetTitle () const =0
 
virtual const CYIStringGetLastRequestUrl () const =0
 
virtual void SetDisplayWebView (bool bDisplayWebView)=0
 
virtual bool ShouldDisplayWebView () const =0
 
virtual void SetDisplayNavigationBar (bool bDisplayNavigationBar)=0
 
virtual bool ShouldDisplayNavigationBar () const =0
 
virtual void SetNavigationBarBackButtonText (const CYIString &text)=0
 
virtual const CYIStringGetNavigationBarBackButtonText () const =0
 
virtual void Authenticate (const CYIString &rUserName, const CYIString &rPassword)=0
 
virtual void CancelAuthentication ()=0
 

Public Attributes

CYISignal< const CYIString &, const CYIString & > AuthenticationRequired
 
CYISignal< const CYIString & > WebViewLoadStarted
 
CYISignal< const CYIString & > WebViewLoadFinished
 
CYISignal< const CYIString & > WebViewLoadError
 
CYISignal WebViewDismissed
 

Member Enumeration Documentation

Enumerator
WEB_VIEW_HTTP_URL 

Is a URL

WEB_VIEW_FILE_URL 

Is a local file

WEB_VIEW_HTML_DOC 

Is an HTML string

Enumerator
WEB_VIEW_LOAD_STARTED 

A web page started loading

WEB_VIEW_LOAD_FINISHED 

A web page finished loading

WEB_VIEW_LOAD_ERROR 

A web page threw an error or didn't load

WEB_VIEW_DISMISSED 

The web view is dismissed

Constructor & Destructor Documentation

yi::deprecated::CYIWebViewBridge::CYIWebViewBridge ( )
inline
virtual yi::deprecated::CYIWebViewBridge::~CYIWebViewBridge ( )
inlinevirtual

Member Function Documentation

virtual void yi::deprecated::CYIWebViewBridge::Authenticate ( const CYIString rUserName,
const CYIString rPassword 
)
pure virtual

Authenticates with a rUserName and a rPassword. Call after receiving a CYIWebViewBridge::AuthenticationRequired signal.

virtual void yi::deprecated::CYIWebViewBridge::CancelAuthentication ( )
pure virtual

Cancels the authentication and releases resources being used for the authentication. Call after receiving a CYIWebViewBridge::AuthenticationRequired signal to cancel the authentication.

virtual void yi::deprecated::CYIWebViewBridge::ClearCachedData ( )
pure virtual

Clear any cached data and cookies associated with this web view

virtual const CYIString& yi::deprecated::CYIWebViewBridge::GetLastRequestUrl ( ) const
pure virtual

Returns the last URL requested by this web view.

virtual const CYIString& yi::deprecated::CYIWebViewBridge::GetNavigationBarBackButtonText ( ) const
pure virtual
virtual const CYIString& yi::deprecated::CYIWebViewBridge::GetResource ( ) const
pure virtual
virtual RESOURCE_TYPE yi::deprecated::CYIWebViewBridge::GetResourceType ( ) const
pure virtual
virtual const CYIString& yi::deprecated::CYIWebViewBridge::GetTitle ( ) const
pure virtual
virtual void yi::deprecated::CYIWebViewBridge::HideWebView ( )
pure virtual

Hides the web view. The web view should already be started.

virtual void yi::deprecated::CYIWebViewBridge::SetDisplayNavigationBar ( bool  bDisplayNavigationBar)
pure virtual

Optionally display a navigation bar on top of the web view. Not supported on all platforms.

Note
The navigation bar will not be displayed if ShouldDisplayWebView returns false. The default value is false.
See also
SetDisplayWebView
ShouldDisplayWebView
virtual void yi::deprecated::CYIWebViewBridge::SetDisplayWebView ( bool  bDisplayWebView)
pure virtual

Toggles the display of the web view. This allows a client to use a web view for communicating with a web API without actually displaying the web view, for instance if no user interaction is required. The default value is true.

virtual void yi::deprecated::CYIWebViewBridge::SetNavigationBarBackButtonText ( const CYIString text)
pure virtual

Set the text to display on the back button of the navigation bar. Not supported on all platforms. If left unchanged, the default text is "Back".

Note
This has no affect if CYIWebViewBridge::ShouldDisplayNavigationBar returns false.
See also
GetNavigationBarBackButtonText
SetDisplayNavigationBar
ShouldDisplayNavigationBar
virtual void yi::deprecated::CYIWebViewBridge::SetResource ( const CYIString rResource,
RESOURCE_TYPE  eResourceType 
)
pure virtual

Sets the rResource and the eResourceType.

virtual void yi::deprecated::CYIWebViewBridge::SetTitle ( const CYIString rTitle)
pure virtual

Sets the rTitle on the web view, if applicable.

virtual bool yi::deprecated::CYIWebViewBridge::ShouldDisplayNavigationBar ( ) const
pure virtual
virtual bool yi::deprecated::CYIWebViewBridge::ShouldDisplayWebView ( ) const
pure virtual
virtual void yi::deprecated::CYIWebViewBridge::ShowWebView ( )
pure virtual

Shows the web view. The web view should already be started.

virtual bool yi::deprecated::CYIWebViewBridge::StartWebView ( )
pure virtual

Starts the web view with the configured settings.

virtual void yi::deprecated::CYIWebViewBridge::StopWebView ( )
pure virtual

Ends the web view.

Member Data Documentation

CYISignal<const CYIString & , const CYIString & > yi::deprecated::CYIWebViewBridge::AuthenticationRequired

Fired when the resource being loaded requires authentication to view. Users should respond to this signal by calling either Authenticate() or CancelAuthentication().

CYISignal yi::deprecated::CYIWebViewBridge::WebViewDismissed

Fired when the web view has been dimissed

CYISignal<const CYIString & > yi::deprecated::CYIWebViewBridge::WebViewLoadError

Fired when the web view has encountered an error while laoding the specified resource

CYISignal<const CYIString & > yi::deprecated::CYIWebViewBridge::WebViewLoadFinished

Fired when the web view has finished loading the specified resource

CYISignal<const CYIString & > yi::deprecated::CYIWebViewBridge::WebViewLoadStarted

Fired when the web view begins loading the specified resource


The documentation for this class was generated from the following file: