-
Notifications
You must be signed in to change notification settings - Fork 21
6. Native Components
NativeCommunicator
service is the main gateway for assessing functionality that is natively handled for the operating system. It uses MethodChannel
to access the native implementations. The native implementations themself reside in AppDelegate
for iOS and MainActivity
for Android.
NativeCommunicator
exposes the following APIs:
This API is used internally by NativeCommunicator
and it is called when the service is initialized. It passes all SDK keys, tokens, etc. to the native sites that are responsible to initialize the various SDKs at application launch.
Launches a Map
controller/activity containing embedded map view and displaying specific location.
Launches a Map
controller/activity containing embedded map view and allowing the user to select location in that map. Used in CreateEventPanel for selecting event's location on a map.
Launch a Map
controller/activity containing embedded map view and presenting navigation directions from current user's location to given explore target: event
, dining
, laundry
, etc.
This API is for iOS use only where the native iOS application creates its own launch screen on application:didFinishLaunchingWithOptions:
notification. The Flutter application calls this method when all services get initialized and the application is ready to display its UI.
This API notifies the native side to present a status text while the application is initializing. This API is used in debug or dev builds to provide visual indication for each service initialization.
This API is for iOS use only for adding pass to iOS Wallet app. This API was intended to add user's iCard to the Wallet app but did not actually get used.
Gets or sets the currently enabled interface orientations. This API is used to force landscape mode when playing a video tutorial.
Generates a barcode (incl. QR) image with given content. Used by WalletPanel to generate the library card's barcode. The library card interface is currently disabled in FlexUI service so this API is not currently used by the application.
This is native API placeholder for test purposes, currently not used in the application.
NativeCommunicator
handles the following notifications from native sides and fires a corresponding notification in Flutter side:
Fired by MapWidget native implementation when the user selects a marker of an explore item. Typically the embedding panel presents a popup with explore item details and commands.
Fired by MapWidget native implementation when the user selects a location outside a marker of an explore item. Used to clear the popup for currently selected explore item.
Fired by Map
controller/activity with navigation directions inside when the navigation starts. Used for analytics purposes.
Fired by Map
controller/activity with navigation directions inside when the navigation finishes. Used for analytics purposes.
Initializes different modules with keys that come from the server. Such modules are: MapsIndoors
SDK or Meridian
SDK.
Displays MapActivity
that represents Google map. It can take two arguments - target and options.
- target represents where the camera will be positioned based on latitude, longitude and zoom level.
-
options contains only two fields -
hideLevels
andshowDebugLocation
. IfhideLevels
is true, floor levels ofMapsIndoors
SDK will be hidden, otherwise - visible. IfshowDebugLocation
is true, the label with location is displayed, false - not displayed.MapActivity
also has the ability to show user location on the map based on positioning from android core location services andMeridian
SDK.
Displays SelectLocationActivity
. It represents a map where user can select location for a event in create event UI flow.
The main components that SelectLocationActivity
embeds are SupportMapFragment
(GoogleMaps
) and MapControl
(MapsIndoors
). It accepts JSONObject location arguments on initialization. If such location parameter exist, then it is visualized on the map as marker and the camera is centered on it. Otherwise no marker is displayed and the camera is centered at the default camera position.
When the user taps on a specific position, a marker is added on that position and the user is allowed to save it as an event location. If the user choose to save it, the location is returned to flutter code and SelectLocationActivity
is closed.
Displays MapDirectionsActivity
. It represents a map where the user could navigate between his/hers location and the chosen location in different travel modes.
The main components that MapDirectionsActivity
embeds are SupportMapFragment
(GoogleMaps
) and MapControl
(MapsIndoors
). MapDirectionsActivity
takes explore
string as argument which can be a single explore object or multiple explore objects that persist on the same location.
It presents explore location on the map as custom marker and searches for route between the user location and the marker. User location is determined based on Meridian
SDK for indoors handling and built-in Android location services for outdoors handling. The route between explore location and user location is processed by MapsIndoors
SDK based on the selected travel mode (walk, bicycle, drive and transit).
Also the floor of the current MapsIndoors
building is changed based on the current navigation step.
The user can:
- navigate step by step
- change travel mode and recalculate the route based on the newly selected mode
- autofocus camera on the current location
- recalculate the route based on the current location.
This API is not supported in Android.
Displays launch screen status (if available) as toast.
This API is not supported in Android.
Enables and sets specified device screen orientations and returns previously set device orientations.
Generates barcode image as encoded base64 string based on the input parameters - height, width and format.
Handled with an empty processing at the moment.
Initializes third party SDKs and service. In a typical iOS app this would be performed on application:didFinishLaunchingWithOptions:
notification. However, because some SDK keys and secrets come from Flutter's Config service, this method is invoked on application launch to initialize the third party SDKs and services: Meridian
, GoogleMaps
and MapsIndoors
.
Displays MapController
on specified target or the current user location, if available.
Used to get location from CreateEventPanel in Flutter side. Presents MapLocationPickerController
. It embeds GMSMapView
and MPMapControl
inside. On creation it initializes GMSMapView
with predefined camera position as set in kInitialCameraLocation
. When the user clicks on a given position it adds a marker on that position. If the user confirms this position the controller is dismissed and it is returned to Flutter side as event location.
Presents MapDirectionsController
. It embeds GMSMapView
and MPMapControl
inside. On create it initializes GMSMapView
with predefined camera position as set in kInitialCameraLocation
.
It takes as an input parameter a single explore (event or dining) item’s JSON. It adds Google marker at this explore position that uses MapMarkerView
as a custom marker view. It searches for a route from current user location to this explore marker (location) using MapsIndoors
MPDirectionsService
. MapDirectionsController
exposes UI for travel mode selection (MPTravelMode
). Once the route is generated it can be browsed step by step displaying navigation instructions on each step.
Current user position is always presented on the map. MapDirectionsController
is a location provider (MPPositionProvider
) for MPMapControl
. It uses Meridian
SDK for indoor location handling and built-in CoreLocation
service for outdoor location handling. MapDirectionsController
combines both services to always provide current user location to MPMapControl
, that displays it as a blue dot. While browsing the route the user is always able to focus the camera on the current location by clicking on navAutoUpdateButton
button.
Removes the custom launch screen presented on app launch. This API is called from Flutter side when the initialization process on startup has finished.
Updates statusText
property of LaunchScreenView
, if available.
Presents PKAddPassesViewController
with pass data supplied as parameter to this API.
Sets enabled interface orientations. Used to force application rotation in order display video tutorial content in landscape orientation, and to restore default portrait orientation when this panel gets closed.
Generates a barcode image from source data using the ZXing
library. The input parameters take image width and height, as well as the barcode image format.
This is native API placeholder for test purposes, currently not used in the application.
MapWidget
is a custom widget with platform specific implementation. It displays a map inside using the native GoogleMaps
view.
Implements Android part for the MapView
flutter widget.
Represents google map view with integrated indoors map for specific building/s that shows custom markers. It is a FrameLayout
that implements Google maps OnMapReadyCallback
and embeds GoogleMap
(GoogleMaps
) and MapControl
(MapsIndoors
).
MapView
provides the following public interfaces:
-
applyExplores - takes JSONArray of explores and
JSONObject
of options as arguments.MapView
displays these explores on the map as custom markers. The marker could be single or group. The single marker represents single explore and is visualized in different color based on the explore type. The group marker represents multiple explores located on the same or close location and is visualized as orange circle with the number of the explores on it.- explores could be three types - events, dinings or laundry rooms.
- options has just field at the moment -
LocationThresoldDistance
. It represents how close to each other could be two explores so that to be grouped in group marker.
-
enableMyLocation - takes one boolean argument. Based on it, MapView displays or hides my location button in
GoogleMap
.
Registers MapView
in PlatformViewRegistry
in terms of flutter framework.
Serves bridge between flutter and native code for method channel of MapView. It handles the following method calls:
-
placePOIs
- callsapplyExplores
method ofMapView
; -
enable
- not implemented. It is used only for iOS part; -
enableMyLocation
- callsenableMyLocation
method ofMapView
.
Enum that defines different marker types. It could be SINGLE
, GROUP
or UNKNOWN
. Based on that, markers on the map take a different look and feel.
MapView
plugin implements iOS part of Flutter's MapWidget custom widget. It uses FlutterPluginRegistrar
model to register for this plugin type. The implementation is located in MapView
class
Inherits UIView
. Embeds GMSMapView
and MPMapControl
inside. On create it initializes GMSMapView with predefined camera position as set in kInitialCameraLocation
. It handles the following methods from flutter side:
-
placePOIs: takes a JSON list of explore (event or dinings) items as input parameter. Groups explore items by their locations, places markers in
GMSMapView
on these result locations, and focuses the camera to cover all markers. When multiple items fall into the same location the marker is orange circle with number of items inside. A single item is represented by standardGoogleMaps
marker. -
enable: Enables/Disables
MapView
content by adding/removingGMSMapView
from UIView hierarchy. This was needed due to scroll performance issues in iOS when Flutter ListView with ExploreCards inside overlapped MapView plugin content. -
enableMyLocation: Enables myLocation button in
GMSMapView
. This is not enabled by default because the plugin does not have the knowledge whether my location should be enabled since it depends on privacy level and location services status.
When a marker is clicked MapView
sends a MetodChannel
notification to Flutter side named map_select_explore
passing item(s) JSON representation. When the user clicks anywhere on the map MapView
sends map_clear_explore
notification to Flutter side, that is used to hide the popup presented on map_select_explore
notification.
MapMarkerView
inherits UIView and serves as a custom marker view in GMSMapView
. It supports three display modes:
-
plain: only the marker's icon (
UIImageView
) is displayed. -
title: A title label (
UILabel
) is displayed in addition under the icon. -
extended: A description label (
UILabel
) is displayed in addition under the title. When the user increases zoom level inGMSMapView
,MapView
increases display mode towards more verbose (plain -> title -> extended).
Android Native Utilities are defined in a single java file Utils.java
.
Displays an AlertDialog
with up to two buttons/options.
Provides functionality for parsing Date
from string and formatting Date to string.
Provides helper utility methods for retrieving explore properties from a HashMap
and for manipulating marker options and appearance.
Provides functionality for calculating the distance between two locations (LatLng
).
Provides functionality for retrieving values from a Map
object based on the key path.
Helpers for converting bytes to string, string to bytes, checking if a given string is empty and returning null if a given string is empty.
Helpers for converting UUID to bytes and bytes to UUID.
Helpers for encoding bytes to base64 string and decoding base64 string to bytes.
Provides helpers for retrieving and saving boolean values from / to application’s Shared Preferences.
Provides helpers for retrieving and saving string values from / to application’s Encrypted Shared Preferences.
Most of the iOS native utilities are implemented as class categories.
Helpers for accessing explore (event or dining) properties. Used by MapMarkerView, MapView or MapDirectionsController
.
Helpers for accessing config data applied on init API. It supports different values for the same key depending on current platform - Android/iOS.
Helper for formating event time.
Provides a helper for AES encryption.
Provides helpers to access the secure device storage.
Helpers on CBPeripheral
level. Currently it implements serviceWithUuid
which retrieves a service for the specified Uuid and clear which clears all resources for the desired periphere
Helpers on CBService
level. Currently it implements characteristicWithUuid
which finds and returns characteristic by Uuid
Helpers on CBCharacteristic
level. Currently it implements descriptorWithUUid
which finds and returns descriptor by Uuid
Contains CGSize
scaling utilities.
Calculates distance between two location coordinates (CLLocationCoordinate2D
).
NSDate
parsing/formatting utilities.
NSData
helper - inaHexString
converts NSData
to a hexadecimal string.
NSData
helper - inaDataFromHex
converts hexadecimal string to NSData
.
Type check/conversion helpers for retrieving JSON values from NSDictionary.
Helpers for accessing nested NSDictionary
objects identified by URI-like paths.
Type check/conversion helpers for retrieving JSON values from NSArray
.
Type check helpers for JSON decoding from NSString
.
Helpers for JSON encoding to NSString
.
Type check/conversion helpers for retrieving values from NSUserDefaults
.
UIColor
parsing utility from hexadecimal color representation.
Helpers for retrieving color JSON entries from NSDictionary
.
Helpers for calculating text size in UILabel
.
Preprocessor helper definitions.