Coder Social home page Coder Social logo

akoufa / coolweather Goto Github PK

View Code? Open in Web Editor NEW
195.0 195.0 20.0 6.79 MB

Weather App that uses Android best practices. Android Jetpack, clean architecture. Written in Kotlin

License: Apache License 2.0

Kotlin 100.00%
android android-app android-architecture android-development architecture-components clean-architecture coroutines databinding glide gradle hilt hilt-android java jetpack kotlin mvvm retrofit2 room viewmodel

coolweather's People

Contributors

akoufa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coolweather's Issues

Not sure why you don't need `withContext(Dispatchers.IO){ }` when invoke UseCase method

I see in WeatherViewModel, here is the method to show weather:

fun showWeather() = viewModelScope.launch {
	showLoading()
	val weatherResult = weatherUseCase()
	val tempUnit = getTemperatureUnit()
        ...

Since weatherUseCase() is a method to get weather which should be run in network thread, I wonder why don't you wrap it inside withContext(Dispatchers.IO) { }, like this:

fun showWeather() = viewModelScope.launch {
	showLoading()
	val weatherResult = withContext(Dispatchers.IO) {  weatherUseCase() }
	val tempUnit = getTemperatureUnit()
        ...

Add error handling

For the moment when a request is not successful the datastore returns an error observable of throwable. TODO: Improve this wrapping the datastore return type to a custom Result object that has the entity and the states of the request response cycle namely: idle, loading, error, and the entity

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.