Coder Social home page Coder Social logo

devmcgann / weatherapp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from odaridavid/weatherapp

0.0 0.0 0.0 769 KB

A weather app built with Jetpack Compose , MVI , Unit Testing , Hilt and Location Services

Home Page: https://youtu.be/O7fBOOVa3Do

License: Apache License 2.0

Kotlin 100.00%

weatherapp's Introduction

Weather App

Build Status codecov

Summary

A simple weather app that gets your location and displays the forecast for the current day and a few days after that.

API : OpenWeatherMap

Reason for choosing mentioned API :

  • 1000 free api calls per day, good for a small project.
  • Ability to specify different units in requests and receive a formatted response based on the unit i.e imperial/metric etc.
  • Api response can also be modified to include the amount of needed data all with one call , contains icons for different conditions and has multilingual support if adopting for a wider audience is ever needed.
  • They have a large user base and handle millions of requests, if the app were ever to scale, there's confidence on the api providing high availability.
  • Has capabilities for alerts for severe weather conditions

More info on how to make an api call here.

Pre-requisite ๐Ÿ“

In your local.properties you will need to add your Open Weather API key and copy the urls in.

OPEN_WEATHER_API_KEY = YOUR KEY
OPEN_WEATHER_BASE_URL=https://api.openweathermap.org
OPEN_WEATHER_ICONS_URL= http://openweathermap.org/img/wn/

Check for one under Api Keys

Environment

  • Built on A.S Hedgehog
  • JDK 17

Design/Architectural decisions ๐Ÿ“

The project makes use of common android patterns in modern android codebases.

Project Structure

The folders are split into 4 boundaries:

  • Core:

    Contains the models/data classes that are independent of any framework specific dependencies and represent the business logic. In a Clean Arch world you can consider these as your domain classes and interfaces.

  • Data:

    Contains data sources , local or remote, this is where the implementation for such is kept. All data related actions and formatting happens in this layer as well. It may contain framework related dependencies to orchestrate and create instances of data stores like a database or shared preference etc. One common pattern used in this area is the repository pattern, which mediates data sources and acts as a source of truth to the consumer.

  • DI:

    This acts as the glue between the core ,data and UI.The UI relies on the core models and interfaces which are implemented in data.

  • UI:

    Contains the presentation layer of the app, the screen components and viewmodels. Framework specific dependencies are best suited for this layer. In this layer MVI is also used, it looks similar to MVVM but the difference is the actions from a screen a.k.a intents e.g HomeScreenIntent are predefined and are finite,making the the screen state a bit more predictable and it's easier to scan through what actions are possible from a given screen.

    The screen state e.g HomeScreenViewState is also modelled as a class with immutable properties and makes state management way easier by reducing the state whenever their is a new update received. Some design patterns that can be seen here are the Observer pattern when consuming the flow -> state flows in the composables and provides a reactive app.

Add flow diagram here

Testing

The data layer is unit tested by mocking out external dependencies and the ui layer on the viewmodels, an integration test is written that makes use of fake,so as to mimic the real scenario as much as possible over using mocks, which would also turn it to a unit test.

Technologies ๐Ÿ”จ

Language : Kotlin

Libraries :

UI

LICENSE

   Copyright 2023 David Odari

   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.
   

Screenshots ๐Ÿ“ฑ

Home (Light Theme) Home (Dark Theme)
Settings
Error

weatherapp's People

Contributors

odaridavid avatar calebkl avatar chege4179 avatar chepsi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.