MBAutomationMessagesManager class

Main class that manages messages and triggers, responds to external events and updates the triggers.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

timer Timer?
The tmer used to check message/triggers periodically.
getter/setter pair

Static Methods

checkMessages({bool fromStartup = false}) Future<void>
Checks the saved messages and show them if they need to be showed. @param fromStartup If the check has been triggered at app startup.
eventHappened(MBAutomationEvent event) → dynamic
Function called when an event happens. It checks the saved messages and tells all the MBEventTrigger triggers that this event happened. @param event The event that happened.
locationDataUpdated(double latitude, double longitude) Future<void>
Function called when new location data is available. It checks the saved messages and tells all the MBLocationTrigger` triggers that this tag has changed. @param latitude The new latitude. @param longitude The new longitude.
messageTimerChanged({required int time}) → dynamic
Restarts the timer with a new time. @param time The time interval in seconds.
savedMessages() Future<List<MBMessage>?>
Returns the saved messages. @returns A future that completes with the list of saved messages.
saveMessages(List<MBMessage> messages, {bool fromFetch = false}) Future<void>
Save a list of messages. @param messages The list of messages that will be saved. @param fromFetch If the save has been triggered after an API call.
screenViewed(MBAutomationView view) Future<void>
Function called when a screen has been viewed. It checks the saved messages (with the MBAutomationMessagesViewManager) and tells all the MBViewTrigger triggers that this view has been viewed. @param view The screen view that the user has viewed.
setTriggersToMessages(List<MBMessage> messages) → void
Creates and initializes triggers object to the messages fetched. Messages comes from the MBMessage plugin with the var triggers as a Map, when automation is on. This variable is replaced with a MBMessageTriggers object. @param messages A list of messages that will be populated with MBMessageTriggers objects.
startMessageTimer({required int time}) → dynamic
Starts the timer to check periodically messages. @param time The time interval in seconds.
tagChanged(String tag, String? value) Future<void>
Function called when a tag changes. It checks the saved messages and tells all the MBTagChange triggers that this tag has changed. @param tag The tag that changed. @param value The new value of the tag.
triggerFromDictionary(Map<String, dynamic> dictionary) MBTrigger
Creates a MBTrigger object from the dictionary returned by the APIs, based on the type. @param jsonDictionary The API Map to convert to a trigger. @returns The corresponding MBTrigger object.
triggerFromJsonDictionary(Map<String, dynamic> jsonDictionary) MBTrigger
Creates a MBTrigger object from the JSON dictionary, based on the type. @param jsonDictionary The JSON object to convert to a trigger. @returns The corresponding MBTrigger object.