App

This integration is used to handle some basic calls to the app.

Introduction

This integration is used to handle some basic calls to the app.

Where to find: startiapp.App

Methods

isStartiappLoaded

isStartiappLoaded(): boolean

Has the app told the site it has been initialized and is ready for interaction with the site?

Note: The difference between isRunningInApp and isStartiappLoaded is that isRunningInApp is true whenever the site is loaded inside the app, but isStartiappLoaded is first set to true when the app is fully launched and ready for interaction with the site.

setAppUrl

setAppUrl: (url: string) => void

Use this method to control which URL the app load when it is initialized.

resetAppUrl

resetAppUrl(): void

Call this method to reset the startup URL of the app. After calling this method the app will load the URL it was “born” with after a restart. Please notice that this URL can be different between the test and production environment.

version

version(): Promise<string>

Returns the version number of the app (eg. 1.0.0).

requestReview

requestReview(): void

Request a review of the app.

disableScreenRotation

disableScreenRotation(): void

Locks the screen orientation to portrait.

enableScreenRotation

enableScreenRotation(): void

Unlocks the screen orientation.

disableSwipeNavigation

disableSwipeNavigation(): void

Disables the swipe navigation. (This includes the back button on some android launchers)

enableSwipeNavigation

enableSwipeNavigation(): void

Enables the swipe navigation. (This includes the back button on some android launchers)

openExternalBrowser

openExternalBrowser: (url: string) => void

Opens the given URL in the default browser.

openSettings

openSettings: () => void

Opens the app settings.

brandId

brandId(): Promise<string>

Returns the brand id of the app.

deviceId

deviceId(): Promise<string>

Returns the installation id of the device, which is unique per reinstall.

showStatusBar

showStatusBar: () => void

Show the status bar.

hideStatusBar

hideStatusBar: () => void

Hide the status bar.

setStatusBar

setStatusBar(options: SetStatusBarOptions): void;

Set the status bar. The options are found here.

setCommonScript

setCommonScript(script: string): void;

Set common script that is shared and accessible in app.

setSafeAreaBackgroundColor

setSafeAreaBackgroundColor(color: string): void

Set the background color of safe area. This is the area that is not covered by the app. The color is set in the format #RRGGBB

addEventListener

addEventListener(type: AppEvents, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void

Listen for events.

removeEventListener

removeEventListener(type: AppEvents, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void

Remove event listener.

getInternalDomains

For more info about internal domains read here.

getInternalDomains(): Promise<string[]>

Returns a list of all internal domains.

addInternalDomain

addInternalDomain(domain: string): void

Adds a domain to the list of internal domains.

removeInternalDomain

removeInternalDomain(domain: string): void

Removes a domain from the list of internal domains.

getExternalDomains

For more info about external domains read here.

getExternalDomains(): Promise<ExternalDomain[]>;

Returns a list of all external domains.

addExternalDomains

addExternalDomains(...domains: RegExp[]): void;

Adds external domain(s).

removeExternalDomains

removeExternalDomains(...domains: RegExp[]): void;

Removes external domain(s).

setSpinner

setSpinner(options: SpinnerOptions): void;

Sets options for the navigation spinner.

showSpinner

showSpinner(options?: SpinnerOptions): void;

Show the navigation spinner.

hideSpinner

hideSpinner(): void;

Hide the navigation spinner.

addDomainToHistoryExclusion

addDomainToHistoryExclusion(domain: string): void;

Add domain to history exclusion.

removeDomainFromHistoryExclusion

removeDomainFromHistoryExclusion(domain: string): void;

Remove domain from history exclusion.

addPatternToHistoryExclusion

addPatternToHistoryExclusion(pattern: RegExp): void;

Add pattern to history exclusion.

removePatternFromHistoryExclusion

removePatternFromHistoryExclusion(pattern: RegExp): void;

Remove pattern from history exclusion.

setAppIcon

This function requires the White Label module.

setAppIcon(iconName: string): void

Changes the app-icon to the specified icon.

Use the icon name default to reset the app icon to the default icon.

getCurrentIcon

This function requires the White Label module.

getCurrentIcon(): Promise<string>;

Returns the name of the current app icon.

getAvailableIcons

This function requires the White Label module.

getAvailableIcons(): Promise<string[]>;

Returns a list of all available icons.


Events

How to listen for events.

appInForeground

appInForeground

The event will be called whenever the app enters the foreground on the device and when the app starts og thus also enters the foreground on the device.