Table of Contents

Class VpnHoodAppMaui

Namespace
VpnHood.AppUi.Hosting.Maui
Assembly
VpnHood.AppUi.Hosting.Maui.dll

Provides the app under a MAUI UI.

public class VpnHoodAppMaui : Singleton<VpnHoodAppMaui>, IVpnHoodAppMaui, IDisposable
Inheritance
VpnHoodAppMaui
Implements
Inherited Members

Remarks

The platform's own start runs the app, from the same init params as every head; a UI package never starts it.

Properties

Api

Gets the app's API, the contract every UI uses, in this process.

public VpnHoodApi Api { get; }

Property Value

VpnHoodApi

Exceptions

InvalidOperationException

The app has not started or was disposed, as in an Android process other than the app's own.

Methods

Dispose(bool)

Releases the instance; with disposing and when it is the registered one, unregisters it.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true when called from Dispose().

Remarks

With disposing, it disposes the app: on Android the VPN goes on, as Android runs the VPN service itself; on Windows the head's device stops it.

Init(AppInitParams, IDevice?)

Starts the app under a MAUI UI, once per registered host: a disposed host lets another start.

public static VpnHoodAppMaui Init(AppInitParams initParams, IDevice? device = null)

Parameters

initParams AppInitParams

The head's init params.

device IDevice

On Windows, the head's device, which runs the VPN service in the app's one process, as a MAUI app there has no service; on Android, null, as Android starts the VPN service itself.

Returns

VpnHoodAppMaui

The app.

Remarks

On Android the app starts only in the app's own process. An ad provider that names countries both to include and to exclude fails the start.

Exceptions

OverflowException

A duration in a built-in access key is out of range.

InvalidDataException

A built-in access key decodes to JSON null.

JsonException

A built-in access key holds no valid access key.

NotSupportedException

A built-in access key's version is not one the app reads.

FormatException

A built-in access key is no valid Base64, or an endpoint or a duration in it is not valid.

AnotherInstanceIsRunningException

Another instance of the app holds the lock.

ArgumentException

On Android, a device is given.

ArgumentNullException

On Windows, no device is given.

PlatformNotSupportedException

The platform is neither Android nor Windows.

InvalidOperationException

The app has started already; the init params name no storage folder, or the platform has no local app data folder; or, on Android, the process's or the package's name cannot be read, Android names no cache folder or no folder kept out of backups, or, with the debug mode on, Android names no files folder or the storage folder is not directly in it.