Foreground service which listens to ride status changes.
Application will keep RideStatusService alive (using startForeground and STICKY mode) during the ride.
When there is no active ride service is shut down.
Keeps track of current ride and unrated ride (if any).
Exposes reactive API for publish-subscribe pattern. Model in MVVM.
StateManager is bound to Android Application's lifecycle.
Stores session data and encapsulates networking.
Exposes reactive API for publish-subscribe pattern. Model in MVVM.
DataManager is bound to Android Application's lifecycle.
UI-related part uses MVVM pattern with data binding.
Views and ViewModels both bound to Android Activity/Fragment lifecycle.
Views are recreated on configuration changes, ViewModels - mostly not.
Approach is similar to Android Architecture Components
There is a bunch of specialized managers which names are mostly self-explaining:
- ConfigurationManagerupdates configuration based on location
- LocationManagerprovides location updates
- PrefManagerpersists user data
- AppNotificationManagermanages device notifications and in-app messages
- ConnectionStateManagerlistens to network and server reachability
Entry point which starts main application's components.
When driver is online or in ride, application will keep EngineService alive (using startForeground and STICKY mode).
When driver is offline, service will run no longer than any visible activity.
Application uses state machine to manage driver states.
StateManager's responsibilities are:
- switching states
- synchronizing with server state
- utilizing server events
StateManager lifecycle is bound to EngineService
Driver state representation eg. OnlineState, PendingAcceptState, AcceptedState etc.
Each state is responsible for actions specific to this state:
- using local and third-party services (location, tracking, direction)
- invoking server API requests (go online, accept ride, etc)
- caching data during network failures
EngineState can be treated as data model.
Each state has corresponding UI strategy, which reflects data changes on screen.
UIStrategy is bound to Android lifecycle and is only active during onStart/onStop.
There is a bunch of specialized managers which names are mostly self-explaining:
- LongPollingManagerlistens to LP events
- PendingEventsManagerworks with cached data which must be sent when connection restored
- ConfigurationManagerupdates configuration based on location
- DriverLocationManagersends location updates based on current state and configuration settings
- RideRequestManagerprovides data about request types which driver is eligible to work with
- AirportQueueManagerkeeps track of driver's position in airport queue
- PrefManagerpersists user data
- AppNotificationManagermanages device notifications and in-app messages
- ConnectionStateManagerlistens to network and server reachability
- DataManagerstores session data and encapsulates networking
Distributed under the MIT license. See LICENSE for more information.