Skip to content
Last updated

Capacitor version

Currently supported capacitor version is v5.*

Supported capacitor plugins

  1. Capacitor Http and Capacitor Cookies are enabled by default as part of @capacitor/core package
  2. @capacitor/app
  3. @capacitor/haptics
  4. @capacitor/keyboard
  5. @capacitor/geolocation
  6. @capacitor/camera
  7. @capacitor/status-bar
  8. @capacitor/preferences
  9. @capacitor/browser
  10. @capacitor/share
  11. @capacitor/filesystem
  12. @capacitor/clipboard
  13. @capacitor/device
  14. @capacitor-community/sqlite
  15. @capacitor/local-notifications

Initial Context

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 NameAttribute TypeDescription
urlStringURL of the partner backend environment used by application to fetch and update data
authTokenStringauth token issued to mobile app user that should be used to authenticate web application requests to the partner backend
languageStringUser locale. Default is “en-US”
startingRouteStringInitial 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
StringColor 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
exerciserUuidUUIDExerciser Id
gymLocationUUIDId 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
dateOfBirthYYYY-MM-DDExerciser's date of birth
emailtest@mailinator.comExerciser's email
linkingExample:
{
...,
"linking": {
"status": "linked",
"egymEmail": "test@mailinator.com",
},
...
}
EGYM ID linking
preferencesExample:
{
...,
"preferences": {
"localizedTitle": {
en: "hello",
de: "hallo",
...
},
"showLogWorkoutButton": true,
},
...
}
Preferences for the MWA widget set in BMA dynamic feature framework config. Fields provided only if they configured in the DFF config
mwaProtocolVersion1.0version of Native<->MWA interface communication useful for resolving backward compatibility issues

Native <-> web interface/commands

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 TypeDescriptionRequest Data (publish)Response Details (subscribe)
authTokenRequest authentication token for app user, can be used for refresh token functionality
data: {
"type": "authToken",
"data": null,
},
User identity token that can be used to authenticate user in partner backend
exerciserInfoRequest exerciser profile data
data: {
"type": "exerciserInfo",
"data": null,
},
Exerciser profile as described in data model section
openFeatureNavigate to web app feature by tapping on a widgetPayload should include relative feature URL opened in web app
data: {
"type": "openFeature",
"data": {
"startingRoute": "/classes/:id:"
}
}
openNativeFeatureNavigate to a native app feature inside of BMA applicationPayload should include unique feature identifier
data: {
"type": "openNativeFeature",
"data": {
"featureId": "advancedChallenges"
}
}
openWebViewDisplay 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 sectionPayload should include starting URL and URL patterns checked for redirect chain
data: {
"type": "openWebView",
"data": {
"url": "https://example.com/",
"endFlowUrlPatterns": [
"https://example.com/success",
"https://example.com/failure"
]
}
}
URL matching to one or multiple requested patterns
openUrlExternallyOpen passed URL in native browser and send back a configuration whether user navigated to that URLURL to be opened in native browser
data: {
"type": "openUrlExternally",
"data": {
"url": "https://example.com/"
}
}
Boolean indicating if URL was opened in native browser
trackEventRequest native app to track Analytics eventPayload should include event name (required) and parameters (optional)
data: {
"type": "trackEvent",
"data": {
"name": "Book_A_Class",
"parameters": [
"source": "classes_list",
"trainer_details_available": "true"
]
}
}
dismissRequest native app to close MWA screen
data: {
"type": "dismiss",
},
contentLoadingDidFinishRequest native app to hide skeleton loader on custom MWA widget
data: {
"type": "contentLoadingDidFinish",
},
setWidgetHeightSet widget height dynamically
data: {
"type": "setWidgetHeight",
"data": {
height: 200
}
},
linkingRequest native app to provide EGYM ID linking details
data: {
"type": "linking",
},
Subsciption to "linking" event - returns the same data structure as in the initial context -
"linking": {          
"status": "linked",
"egymEmail": "test@mailinator.com",
},
refreshNotify MWA that the webview was reactivated, e.g. device went back from background, user returned back to BMA dashboardOnly 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.

Exerciser Profile Data

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 NameAttribute TypeDescription
gymLocationIdUUIDIdentifier of exerciser’s gym location.
emailStringUser email
firstNameStringUser first name
lastNameStringUser last name
userLocaleStringLocale of user
tenantLocaleStringLocale of gym brand
userPictureStringURL of profile image specified by user
membershipSubTypeStringType of the user membership as defined in gym membership system
membershipStatusStringStatus of user membership in gym membership system
startOfContractTimestampStart date of membership contract
endOfContractTimestampEnd date of membership contract