Table of Contents

Class NullDeviceUiProvider

Namespace
VpnHood.AppLib.Abstractions.Device
Assembly
VpnHood.AppLib.Abstractions.dll

Provides a device UI provider that supports none of the features, as the base of a platform's own: each flag is false and each request throws NotSupportedException, but a web browser is taken as present.

public class NullDeviceUiProvider : IDeviceUiProvider
Inheritance
NullDeviceUiProvider
Implements
Inherited Members

Properties

IsAlwaysOnSettingsSupported

Gets a value indicating whether the app can open the system's always-on VPN setting.

public virtual bool IsAlwaysOnSettingsSupported { get; }

Property Value

bool

IsAppNotificationSettingsSupported

Gets a value indicating whether the app can open its notification settings in the system's settings.

public virtual bool IsAppNotificationSettingsSupported { get; }

Property Value

bool

IsAppSettingsSupported

Gets a value indicating whether the app can open its own page in the system's settings.

public virtual bool IsAppSettingsSupported { get; }

Property Value

bool

IsKillSwitchSettingsSupported

Gets a value indicating whether the app can open the system's kill switch setting, which blocks the connections made without the VPN.

public virtual bool IsKillSwitchSettingsSupported { get; }

Property Value

bool

IsNotificationEnabled

Gets a value indicating whether the app may show notifications, or null where the device does not say.

public virtual bool? IsNotificationEnabled { get; }

Property Value

bool?

Remarks

It is false.

IsPrivateDnsSettingsSupported

Gets a value indicating whether the device has a private DNS setting, which can take the DNS past the VPN.

public virtual bool IsPrivateDnsSettingsSupported { get; }

Property Value

bool

IsProxySettingsSupported

Gets a value indicating whether the device can tell its proxy settings.

public virtual bool IsProxySettingsSupported { get; }

Property Value

bool

IsQuickLaunchSupported

Gets a value indicating whether the device offers the app's Quick Launch: a shortcut in the system's own UI, as Android's Quick Settings tile, that connects the VPN.

public virtual bool IsQuickLaunchSupported { get; }

Property Value

bool

IsRequestNotificationSupported

Gets a value indicating whether the app can ask the person to let it show notifications.

public virtual bool IsRequestNotificationSupported { get; }

Property Value

bool

IsRequestQuickLaunchSupported

Gets a value indicating whether the app can ask the system to add its Quick Launch for the person.

public virtual bool IsRequestQuickLaunchSupported { get; }

Property Value

bool

IsSettingsSupported

Gets a value indicating whether the app can open the system's settings.

public virtual bool IsSettingsSupported { get; }

Property Value

bool

IsShareSupported

Whether the device has a share sheet, which hands a file to an app the user picks. False on a TV and a computer, where the UI copies the text instead.

public virtual bool IsShareSupported { get; }

Property Value

bool

IsWebBrowserSupported

Whether a page can be handed to an EXTERNAL browser. Not "can this app draw a page" — the UI can always render a page inside itself; this is only about leaving the app. False on a device with no browser, which is where an outbound link opens nothing at all: the UI withholds the link rather than offering a dead one.

public virtual bool IsWebBrowserSupported { get; }

Property Value

bool

Remarks

It is true: every desktop and phone platform has a browser, and a platform that does not is the one that must say so.

Methods

GetBarsInfo(IUiContext)

Gets the heights of the system bars over the app's window, for its layout to leave room.

public virtual SystemBarsInfo GetBarsInfo(IUiContext uiContext)

Parameters

uiContext IUiContext

The app's UI context.

Returns

SystemBarsInfo

The bars' heights; none where the device cannot tell them.

Remarks

It gives no height.

GetPrivateDns()

Gets the device's private DNS, which can take the DNS past the VPN.

public virtual PrivateDns? GetPrivateDns()

Returns

PrivateDns

The private DNS, or null where the device cannot tell it.

Remarks

It gives null.

GetProxySettings()

Gets the device's proxy settings.

public virtual DeviceProxySettings? GetProxySettings()

Returns

DeviceProxySettings

The settings, or null where the device has no proxy or cannot tell it.

Remarks

It gives null.

KeepScreenOn(IUiContext, bool)

Holds off the screen's idle sleep while the app is in front, for a page that is meant to stay up with nobody at the remote. An implementation that does not support it, as the Windows one, does nothing.

public virtual Task KeepScreenOn(IUiContext uiContext, bool value)

Parameters

uiContext IUiContext

The app's UI context.

value bool

true to keep the screen on; false to let it sleep again.

Returns

Task

A task that completes once it is set.

Remarks

It does nothing.

OpenAlwaysOnSettings(IUiContext)

Opens the system's VPN settings, where the person turns always-on VPN on for the app.

public virtual void OpenAlwaysOnSettings(IUiContext uiContext)

Parameters

uiContext IUiContext

The app's UI context.

Exceptions

NotSupportedException

The device cannot open them.

NotSupportedException

Always.

OpenAppNotificationSettings(IUiContext)

Opens the app's notification settings in the system's settings.

public virtual void OpenAppNotificationSettings(IUiContext uiContext)

Parameters

uiContext IUiContext

The app's UI context.

Exceptions

NotSupportedException

The device cannot open them.

NotSupportedException

Always.

OpenAppSettings(IUiContext)

Opens the app's own page in the system's settings.

public virtual void OpenAppSettings(IUiContext context)

Parameters

context IUiContext

The app's UI context.

Exceptions

NotSupportedException

The device cannot open it.

NotSupportedException

Always.

OpenKillSwitchSettings(IUiContext)

Opens the system's VPN settings, where the person turns the system's kill switch on for the app.

public virtual void OpenKillSwitchSettings(IUiContext requiredContext)

Parameters

requiredContext IUiContext

The app's UI context.

Exceptions

NotSupportedException

The device cannot open them.

NotSupportedException

Always.

OpenSettings(IUiContext)

Opens the system's settings.

public virtual void OpenSettings(IUiContext uiContext)

Parameters

uiContext IUiContext

The app's UI context.

Exceptions

NotSupportedException

The device cannot open them.

NotSupportedException

Always.

RequestNotification(IUiContext, CancellationToken)

Asks the person to let the app show notifications.

public virtual Task<bool> RequestNotification(IUiContext uiContext, CancellationToken cancellationToken)

Parameters

uiContext IUiContext

The app's UI context.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<bool>

A task whose result is true where the app may show them now.

Exceptions

NotSupportedException

The device cannot ask for it.

OperationCanceledException

cancellationToken was canceled.

NotSupportedException

Always.

RequestQuickLaunch(IUiContext, CancellationToken)

Asks the system to add the app's Quick Launch, which the person accepts or refuses.

public virtual Task<bool> RequestQuickLaunch(IUiContext uiContext, CancellationToken cancellationToken)

Parameters

uiContext IUiContext

The app's UI context.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<bool>

A task whose result is true where the Quick Launch is added, or was already.

Remarks

Android's throws its RequestQuickLaunchException where the system answers no within a second of the request.

Exceptions

NotSupportedException

The device cannot ask for it.

OperationCanceledException

cancellationToken was canceled.

NotSupportedException

Always.

ShareFile(IUiContext, string, byte[])

Hands a file to an app the person picks in the device's share sheet.

public virtual void ShareFile(IUiContext uiContext, string fileName, byte[] content)

Parameters

uiContext IUiContext

The app's UI context.

fileName string

The file's name.

content byte[]

The file's content.

Exceptions

NotSupportedException

The device has no share sheet.

InvalidOperationException

There is no window to share from, as iOS's finds none.

NotSupportedException

Always.