Loading repository data…
Loading repository data…
andremion / repository
A sample of Unidirectional Data Flow ♺ usage. Bike data are fetched from CityBikes API. 🚴🏻♂️
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A sample of Unidirectional Data Flow usage.
Shows a map with markers in cities that have some bike sharing service. When you click in any of those cities, the app will show all the bike sharing stations with current status of bike availability. The app will initially try to position in the current user city obtained from location services.
The abstract class UdfViewModel is a ViewModel subclass that delegates its UdfDispatcher implementation to UdfDispatcherImpl in order to handle all the Unidirectional Data Flow.
Each UdfViewModel should have one instance of UdfDispatcherImpl using specific UdfProcessor and UdfReducer implementations that basically do:
Processes each Action in UdfProcessor emitting a Result or ViewEffect. (Action => Result / ViewEffect)
Action, process some operation (fetching/saving from/to network or database) and returns an LiveData of Result that will be used by UdfReducer.ViewEffect that means that it should be emitted but not kept as state such as: Showing a Snackbar, Navigating to another screen, etc.Reduce the current cached ViewState taking Result in consideration by UdfReducer. (Current ViewState + Result => New ViewState)
Result from UdfProcessor and takes the current ViewState to produce another ViewState that will be cached.Bike data are fetched from CityBikes API, a project that provides bike sharing data for apps, research and projects to use.
Copyright 2019 André Mion
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.