Table of Contents

Class GooglePlayAppUpdaterProvider

Namespace
VpnHood.AppLib.Stores.GooglePlay
Assembly
VpnHood.AppLib.Stores.GooglePlay.Core.dll

Provides Google Play's update, which Play shows on its own screen, where the person decides.

public class GooglePlayAppUpdaterProvider : IAppUpdaterProvider
Inheritance
GooglePlayAppUpdaterProvider
Implements
Inherited Members

Remarks

A failed query throws. The update flow's own result is not read, so a flow Play ends with a failure completes as one that ended.

Properties

HasOwnScreen

Gets a value indicating whether a store's own screen shows the update, where the person decides: the check opens it by itself after a delay, the store's offer keeps the feed's notice away, and its "none" before a connect waits for the connect; otherwise, the app's notice offers the update, which starts at the person's press, or by itself where the channel's automatic update is on (IsAutomaticUpdateSupported).

public bool HasOwnScreen { get; }

Property Value

bool

Remarks

It is true: Play's own screen shows the update.

IsAutomaticUpdateSupported

Gets a value indicating whether the app turns the channel's automatic update on and off, as a desktop's own updater does; a store's is the store's own setting.

public bool IsAutomaticUpdateSupported { get; }

Property Value

bool

Remarks

It is false: Play keeps its own automatic update setting.

IsInstalling

Gets a value indicating whether an install the app runs itself, and waits on, is under way, which stops the app once it puts the new version in; the app refuses connects meanwhile.

public bool IsInstalling { get; }

Property Value

bool

Remarks

It is a desktop's: a store's install and Android's package installer are the system's, which stops the app itself.

Methods

Check(AppRelease?, IUiContext?, CancellationToken)

Asks the channel for an update now, which may take the network.

public Task<AppUpdateState> Check(AppRelease? feedRelease, IUiContext? uiContext, CancellationToken cancellationToken)

Parameters

feedRelease AppRelease

The feed's newer release, or null.

uiContext IUiContext

The app's window, or null where none is open.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<AppUpdateState>

A task whose result is the update as it stands.

Remarks

It asks Play, within 15 seconds, and gives since when Play has known the update. It needs the window, as Play's update flow shows over it.

Exceptions

UiContextNotAvailableException

uiContext is null, and the channel needs a window, as a store's.

TimeoutException

The store did not answer its query in time, as Google Play's.

NotSupportedException

The store needs a desktop window, which the UI context is not, as the Microsoft Store's.

OperationCanceledException

cancellationToken was canceled.

CompleteUpdate(AppRelease?, IUiContext?, CancellationToken)

Installs the downloaded update: the person's Install, where the channel stops after the download.

public Task CompleteUpdate(AppRelease? feedRelease, IUiContext? uiContext, CancellationToken cancellationToken)

Parameters

feedRelease AppRelease

The feed's newer release, or null.

uiContext IUiContext

The app's window, or null where none is open.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that completes once the install has started, or, where the system must first let the app install apps (IsInstallPermissionNeeded), once the system's page for it is open.

Remarks

It always throws NotSupportedException: Play installs on its own screen.

Exceptions

NotSupportedException

The channel has no such step.

InvalidOperationException

There is no newer version, or its update is not downloaded.

UiContextNotAvailableException

The channel needs a compatible UI context, as Android's, and uiContext is null or not one.

OperationCanceledException

cancellationToken was canceled.

GetState(AppRelease?)

Gets the update as it stands, which the notice reads whenever it refreshes: it takes no network. With no release, what an earlier one left behind goes.

public AppUpdateState GetState(AppRelease? feedRelease)

Parameters

feedRelease AppRelease

The feed's newer release, or null.

Returns

AppUpdateState

The update's state; none where the channel does not update this copy, whose notice keeps the feed's link.

Remarks

It gives the last check's state.

IsAutomaticUpdateOn(CancellationToken)

Gets whether the automatic update is on, read where the platform keeps it each time, as its installer and its own tools change it too.

public Task<bool> IsAutomaticUpdateOn(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<bool>

A task whose result is true where it is on.

Remarks

It always throws NotSupportedException.

Exceptions

NotSupportedException

The channel has no such switch.

OperationCanceledException

cancellationToken was canceled.

ResumeUpdate(IUiContext, CancellationToken)

Brings back the screen of an update the person started and left before it finished; the app asks it with a window in front, apart from the checks' interval.

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

Parameters

uiContext IUiContext

The app's window.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<bool>

A task whose result is false where there is no such update.

Remarks

It brings back Play's screen for an update the person started and left before it finished, as Google's guide for immediate updates asks.

Exceptions

TimeoutException

The store did not answer its query in time, as Google Play's.

OperationCanceledException

cancellationToken was canceled.

SetAutomaticUpdate(bool, CancellationToken)

Turns the automatic update on or off; off stops only the automatic update, as the person's check, Update and Install still work.

public Task SetAutomaticUpdate(bool isOn, CancellationToken cancellationToken)

Parameters

isOn bool

true to turn it on.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that completes once it is set.

Remarks

It always throws NotSupportedException.

Exceptions

NotSupportedException

The channel has no such switch.

InvalidOperationException

The platform's command failed, as Linux's systemctl.

OperationCanceledException

cancellationToken was canceled.

StartUpdate(AppRelease?, IUiContext?, CancellationToken)

Starts the update: the person's Update, or the store's screen the check opens.

public Task StartUpdate(AppRelease? feedRelease, IUiContext? uiContext, CancellationToken cancellationToken)

Parameters

feedRelease AppRelease

The feed's newer release, or null.

uiContext IUiContext

The app's window, or null where none is open.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that completes at the channel's own stage: once the download has begun, where the app downloads the update; once the store's page is open, as the App Store's; once the store's update flow has ended, installed or dismissed, as Google Play's; or once the store's own download and install have ended, as the Microsoft Store's.

Remarks

It starts Play's immediate update flow over the window, and completes once the flow has ended, installed, dismissed or failed: its completing does not tell that the update was installed.

Exceptions

InvalidOperationException

There is no newer version to update to, the store has none to show, the store's update failed, or the release's package is not on https, as the desktop's refuses.

NotSupportedException

This copy cannot take the release, as the website's APK refuses a package that is not on https, or the store needs a desktop window, which the UI context is not, as the Microsoft Store's.

TimeoutException

The store did not answer its query in time, as Google Play's.

UiContextNotAvailableException

uiContext is null, and the channel needs a window, as a store's.

OperationCanceledException

cancellationToken was canceled.

InvalidOperationException

Play has no update to show.