t4-weather-detail-native-module
v1.11.14
Published
TODO
Downloads
23
Readme
t4-weather-detail-native-module
Prerequests
node
& yarn
setup
Getting started
$ npm install t4-weather-detail-native-module --save
Mostly automatic installation
$ react-native link t4-weather-detail-native-module
Usage in RN
import WeatherDetailNativeModule from 't4-weather-detail-native-module';
WeatherDetailNativeModule;
Native Android Weather Detail Page module
This RN module created to show weather detail screen in a native way and already published to npm
and current version is 1.11.*
. By using yarn publish
command, new changes can be re-deployed.
Here is the screenshot of Native Android Weather Detail page:
Architecture
- MVVM is used as a design pattern.
- ViewModel provides WeatherDetailModel data with the RxJava to UI
- Created usecase layer which can be used several times and is responsible small piece of job to work on the background thread, including application business rules which is isolated from network and UI layer.
- Repository has created to fetch entities from the network and it mediates between data source and use case layer.
- RxJava used to update UI and network operations with different threads.
Dependency Injection
- Koin is used as a Dependency injection framework.
Network Layer
- Created different module which is called weatherapi for api calls.
- Error handling and callback were done in this layer.
- Moshi and Retrofit libraries are used to fetch data/upload JSON from network.
Snackbar is shown if any kind of error happens
1- Connection Error:
2- Timeout:
when user clicks the retry, it triggers new network request.
UI
- There is Activity to start the fragment transaction.
WeatherDetailFragment
which shows weather detail information as a full-screen window- Grouped relevant weather detail in the use-case layer to show them in the card view.
- Added Swipe Refresh mechanism.
- Created custom view which called
WeatherDetailCardView
, it can be reusable several times.
Unit Testing
- Repository, UseCase, ViewModel are unit tested by using Mockito and Junit
CI
- Integrated CircleCI for the Android module.
- Added simple job rules in the config file.
- CI checks the Android unit tests and builds. Once the jobs succeed, accordingly, Badge status will be updated on the Readme file.
Additional Info
- Android module has it's own README file. Please also check other README file to get more information about weatherapi module. Link