Skip to content

somranizaineb/WeatherTestPSA

Repository files navigation

NOTICE

This project is a test.


WeatherTestPSA

This app performs basic REST call to obtain weather information from (https://openweathermap.org/api/one-call-api) API, with the idea to showcase some Android architecture and coding patterns.

Code constraints

  • Kotlin.
  • SDK min 23
  • Coroutines.
  • Dependency injection with dagger.
  • Retrofit + Moshi.
  • Architecture Components.
  • clean Architecture
  • Modularization.
  • Unit Testing mockito .

App Modules

- lib                  (M: model Retrofit , room )
  | - data repository  (communicate with local and remote)
  | - domain use case  (Use case communicatae with repository)

- app                  (VVM : view + viewModel)

Describing the component : Lib

The :lib module is an com.android.library for serving network requests or accessing to the database. Providing the data source for app to display it. So to retrieve the data from the lib module we must inject usecase which comes from the lib module and which is responsible for communicating with the repository

Architecture components + clean Architecture + Modular Architecture diagram

The communication between the different layers follow the diagram below using the reactive paradigm, observing changes on components without need of callbacks.

graph

Describing API used:

- URL : https://openweathermap.org/api/one-call-api
- Params :
  | - lat  latitude of the selected town, her type is double
  | - lon  longitude of the selected town, her type is double
  | - exclude ={part} (optional parameter) by using this parameter you can exclude some parts of the weather data from the API response. It should be a comma-delimited list (without spaces).
               Available values:
               current
               minutely
               hourly
               daily
               In this case i exclude minutely,hourly to dipslay only the current waether and the forecasts of 8 next days
  | - appid  unique API key (you can always find it on the account page, on the "API key" tab)
  | - units  metric to get temperature in Celsius


- Response : WeatherTownResponse
     | - current: Current weather data API response
     | - daily: Daily forecast for 7 days
    

Dependencies

  • Jetpack:
    • Android KTX - provide concise, idiomatic Kotlin to Jetpack and Android platform APIs.
    • AndroidX - major improvement to the original Android Support Library, which is no longer maintained.
    • Lifecycle - perform actions in response to a change in the lifecycle status of another component, such as activities and fragments.
    • LiveData - lifecycle-aware, meaning it respects the lifecycle of other app components, such as activities, fragments, or services.
    • Room - persistence library provides an abstraction layer over SQLite to allow for more robust database access while harnessing the full power of SQLite.
    • ViewModel - designed to store and manage UI-related data in a lifecycle conscious way. The ViewModel class allows data to survive configuration changes such as screen rotations.
  • Coroutines - managing background threads with simplified code and reducing needs for callbacks.
  • Dagger2 - dependency injector for replacement all FactoryFactory classes.
  • Retrofit - type-safe HTTP client.
  • Moshi - makes it easy to parse JSON into Kotlin objects.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published