Class AppStoreAppUpdaterProvider
- Namespace
- VpnHood.AppLib.Stores.AppStore
- Assembly
- VpnHood.AppLib.Stores.AppStore.Core.dll
Provides the App Store's update: iOS has no in-app update API, so the check asks the iTunes Lookup API for the released store version, and the update opens the app's App Store page, where the person updates or declines.
public class AppStoreAppUpdaterProvider : IAppUpdaterProvider
- Inheritance
-
AppStoreAppUpdaterProvider
- Implements
- Inherited Members
Remarks
The lookup is keyed by the bundle ID, so the app needs no configuration of its own. It finds nothing for an app only on TestFlight or not released, which is no update; a failed lookup throws.
Constructors
AppStoreAppUpdaterProvider(Version)
Provides the App Store's update: iOS has no in-app update API, so the check asks the iTunes Lookup API for the released store version, and the update opens the app's App Store page, where the person updates or declines.
public AppStoreAppUpdaterProvider(Version appVersion)
Parameters
appVersionVersionThe installed app's version, which the store's is compared with.
Remarks
The lookup is keyed by the bundle ID, so the app needs no configuration of its own. It finds nothing for an app only on TestFlight or not released, which is no update; a failed lookup throws.
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
Remarks
It is true: the App Store's page 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
Remarks
It is false: the App Store 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
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
feedReleaseAppReleaseThe feed's newer release, or null.
uiContextIUiContextThe app's window, or null where none is open.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task<AppUpdateState>
A task whose result is the update as it stands.
Remarks
It asks the iTunes Lookup API, and compares the store's version with the installed one by their major, minor and build numbers.
Exceptions
- UiContextNotAvailableException
uiContextis 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
cancellationTokenwas canceled.- InvalidOperationException
The app's bundle ID cannot be read.
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
feedReleaseAppReleaseThe feed's newer release, or null.
uiContextIUiContextThe app's window, or null where none is open.
cancellationTokenCancellationTokenThe 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: the App Store installs on its own page.
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
uiContextis null or not one.- OperationCanceledException
cancellationTokenwas 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
feedReleaseAppReleaseThe 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
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Remarks
It always throws NotSupportedException.
Exceptions
- NotSupportedException
The channel has no such switch.
- OperationCanceledException
cancellationTokenwas 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
uiContextIUiContextThe app's window.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Remarks
It gives false: the update runs in the App Store app.
Exceptions
- TimeoutException
The store did not answer its query in time, as Google Play's.
- OperationCanceledException
cancellationTokenwas 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
isOnbooltrue to turn it on.
cancellationTokenCancellationTokenThe 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
cancellationTokenwas 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
feedReleaseAppReleaseThe feed's newer release, or null.
uiContextIUiContextThe app's window, or null where none is open.
cancellationTokenCancellationTokenThe 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 opens the app's App Store page, from the last check's lookup or a new one, and completes once the page is open.
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
uiContextis null, and the channel needs a window, as a store's.- OperationCanceledException
cancellationTokenwas canceled.- InvalidOperationException
The app's bundle ID cannot be read, the App Store has no page for the app, or iOS did not open it.