File: JVE.AppStore.pas Inheritance: TComponent ⬅ Inner Class ⬅ TJVEAppStore
This component allows the user to view an app in the app store (could be used for cross promotions, for example). In case the app is available for several platforms, the component can choose the best app to suggest. The following properties are exposed:
- iOSIdentifier and MacIdentifier – Apple ID of the app in the iOS / Mac Apple store.
- AndroidIdentifier – Play Market app identifier (for example jvesoft.app).
- iOSURL, MacURL and AndroidURL – URL of the app in the iOS / Mac Apple Store or Play Market. This will force the component to use web fallback, instead of native functionality.
- WindowsURL – URL of the Windows version of the app.
- Embed – if web fallback is used (or on Windows), indicates whether the URL should be opened embedded or in external browser.
- AppScheme and ExistsAction – see below for the treatment in relation to already installed apps.
This component also exposes an OnFallback event: when you ask this component to present an app, if it is not available on the current platform, the component will call this event to query for a fallback platform (return spNone to skip presentation entirely). If you don’t implement this event, the component will cycle through all the available platforms.
While no events are exposed, the following methods are available:
- Open – opens the app store with the product requested.
- ActivePlatform – this function returns the platform, for which the component will open the store, when Open function is called (this function might call OnFallback event).
It should be noted that due to platform limitations, it is impossible to open a Mac App Store to view an app while running in iOS. Since App Store is not fully available in iOS Simulator (and because of other limitations – see source code), this component is not fully functional in the iOS Simulator, to view iOS apps (it will open a blank browser, but won’t fail beyond that).
Since you would not normally present app store for an app, already installed by the user, this component can check whether the app to be advertised is already installed. To use this feature the target app should register some (unique) URL scheme it supports.
The component then checks whether there is an app supporting this scheme (you set the scheme to check using the AppScheme property). If an app is installed, the component uses the ExistsAction property to decide what to do: open app store (saStore), open the app itself (saOpen) or do nothing (saIgnore).
While showing an app from another platform, the component will always use a browser (embedded or external), but on Apple platforms it will present an app store, if it can. Example presentations are as follows: