Currently supported capacitor version is v5.*
- Capacitor Http and Capacitor Cookies are enabled by default as part of @capacitor/core package
- @capacitor/app
- @capacitor/haptics
- @capacitor/keyboard
- @capacitor/geolocation
- @capacitor/camera
- @capacitor/status-bar
- @capacitor/preferences
- @capacitor/browser
- @capacitor/share
- @capacitor/filesystem
- @capacitor/clipboard
- @capacitor/device
- @capacitor-community/sqlite
- @capacitor/local-notifications
Initial Context is an application configuration that defines the set of attributes passed to the web application upon launch and required to complete initialization.
can be retreived using getInitialContext function from @ionic/portals package
| Attribute Name | Attribute Type | Description |
|---|---|---|
| url | String | URL of the partner backend environment used by application to fetch and update data |
| authToken | String | auth token issued to mobile app user that should be used to authenticate web application requests to the partner backend |
| language | String | User locale. Default is “en-US” |
| startingRoute | String | Initial URL of web application opened after launch. The value depends on the feature presentation type (e.g. whether it is opened in fullscreen mode or as a widget, /home or /widget) |
| lightPrimaryColor primaryColor primaryTextColor secondaryColor dashboardBackgroundColor | String | Color scheme used to render application content. Support of dynamic colors allows to simplify customization to different clients and share a common look & feel between web and native parts. Represented as 6 digits HEX code starting with # (e.g. “#00C4DC”) |
| showLogger | "true" | "false" | Show or hide egym mwa logger - the logic should be implemented |
| exerciserUuid | UUID | Exerciser Id |
| gymLocation | UUID | Id of the user's home location |
| gender | "MALE" | "FEMALE" | Gender of the exerciser |
| measurementSystem | "METRIC" | "IMPERIAL" | Measurement system configured by the user in the profile settings |
| dateOfBirth | YYYY-MM-DD | Exerciser's date of birth |
| test@mailinator.com | Exerciser's email | |
| linking | Example: { | EGYM ID linking |
| preferences | Example: { | Preferences for the MWA widget set in BMA dynamic feature framework config. Fields provided only if they configured in the DFF config |
| mwaProtocolVersion | 1.0 | version of Native<->MWA interface communication useful for resolving backward compatibility issues |
The table below provides details about supported commands
Request data identifies the command has corresponding publish API, which can be sent by using publish function from @ionic/portals
Response details identifies the command has corresponding subscription API, which can be read by using subscribe function from @ionic/portals
| Command Type | Description | Request Data (publish) | Response Details (subscribe) |
|---|---|---|---|
| authToken | Request authentication token for app user, can be used for refresh token functionality | data: { | User identity token that can be used to authenticate user in partner backend |
| exerciserInfo | Request exerciser profile data | data: { | Exerciser profile as described in data model section |
| openFeature | Navigate to web app feature by tapping on a widget | Payload should include relative feature URL opened in web app data: { | |
| openNativeFeature | Navigate to a native app feature inside of BMA application | Payload should include unique feature identifier data: { | |
| openWebView | Display webview and define closing action to send redirect URL back to web application. Each redirect URL will be checked against set of patterns passed in "endFlowUrlPatterns" payload section | Payload should include starting URL and URL patterns checked for redirect chain data: { | URL matching to one or multiple requested patterns |
| openUrlExternally | Open passed URL in native browser and send back a configuration whether user navigated to that URL | URL to be opened in native browser data: { | Boolean indicating if URL was opened in native browser |
| trackEvent | Request native app to track Analytics event | Payload should include event name (required) and parameters (optional) data: { | |
| dismiss | Request native app to close MWA screen | data: { | |
| contentLoadingDidFinish | Request native app to hide skeleton loader on custom MWA widget | data: { | |
| setWidgetHeight | Set widget height dynamically | data: { | |
| linking | Request native app to provide EGYM ID linking details | data: { | Subsciption to "linking" event - returns the same data structure as in the initial context - "linking": { |
| refresh | Notify MWA that the webview was reactivated, e.g. device went back from background, user returned back to BMA dashboard | Only native to web. Only iOS. On Android use an alternative builtin method in @capacitor/app - resume event |
In case of command failure, native application will return error object as shown in the following example
{
"type": "openUrl",
"code": 404,
"url": "https://example.com/",
"message": null
}Required type attribute will identify the failed command. Optional code, url and message fields will be populated depending on a command and provide details of failed request.
In order to obtain the profile details of an authenticated app user, it is necessary to send the exerciserInfo command to the native mobile application through the Portals Plugin. The table below describes the available attributes:
| Attribute Name | Attribute Type | Description |
|---|---|---|
| gymLocationId | UUID | Identifier of exerciser’s gym location. |
| String | User email | |
| firstName | String | User first name |
| lastName | String | User last name |
| userLocale | String | Locale of user |
| tenantLocale | String | Locale of gym brand |
| userPicture | String | URL of profile image specified by user |
| membershipSubType | String | Type of the user membership as defined in gym membership system |
| membershipStatus | String | Status of user membership in gym membership system |
| startOfContract | Timestamp | Start date of membership contract |
| endOfContract | Timestamp | End date of membership contract |