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:
ConfigurationManager
updates configuration based on locationLocationManager
provides location updatesPrefManager
persists user dataAppNotificationManager
manages device notifications and in-app messagesConnectionStateManager
listens 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:
LongPollingManager
listens to LP eventsPendingEventsManager
works with cached data which must be sent when connection restoredConfigurationManager
updates configuration based on locationDriverLocationManager
sends location updates based on current state and configuration settingsRideRequestManager
provides data about request types which driver is eligible to work withAirportQueueManager
keeps track of driver's position in airport queuePrefManager
persists user dataAppNotificationManager
manages device notifications and in-app messagesConnectionStateManager
listens to network and server reachabilityDataManager
stores session data and encapsulates networking
Distributed under the MIT license. See LICENSE for more information.