Giter Site home page Giter Site logo

food2fork-compose's Introduction

food2fork.ca Compose App

This is the successor to github.com/mitchtabian/MVVMRecipeApp.

It contains the same overall functionality but has additional features.

Features:

  1. Kotlin
  2. MVVM
  3. Compose navigation (one activity, zero fragments)
  4. Retrieve Network Data from API (REST API)
  5. Database caching
  6. Monitoring Network Connectivity
  7. Use cases
  8. Datastore (New Shared Preferences)
  9. Unit Tests
  10. MockWebServer (Okhttp)
  11. Kotlin Flow
  12. Dependency management with Kotlin kts

Resources

  1. Prerequisites:
    1. Jetpack Compose MVVM for Beginners
  2. Junit5
  3. Testing a Flow
  4. Datastore

food2fork-compose's People

Contributors

mitchtabian 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

food2fork-compose's Issues

No network connection issue

issue recreation process ->

Turn on both, wifi and mobile data connection,
close wifi connection (as soon as wifi is closed, the "No Internet Connection" banner will pop up, that's obvious as switching from wifi to data takes some second, and in between that there would be no connection...
but as soon as the mobile data is successfully connected the No connection banner is still there until any config changes or activity has been recreated.

I'm trying to fix it and If I can, I'll post the fix here until if @mitchtabian or anyone can help, I would be grateful.

Unresolved reference: viewModel

i get error for viewModel in stable compose version:(MainActivity)

val viewModel: RecipeListViewModel =  viewModel("RecipeListViewModel", factory)

Unresolved reference: viewModel

The effect of explicitly asserting that the isNetworkAvailable should be false (by default)

As we are defining that the 'isNetworkAvailable' boolean value should be false by default (which is a good practice though) but this leads to some issues on a few devices.

Issue -> By default the value of isNetworkAvailable is false and on some devices, before it asserts whether the user has a valid connection or not (pinging to Google and stuff) the interactor executes so as the default isNetworkAvailable value is false, the interactor doesn't query the API and hence if the cache is not empty the data get emitted but if it's the first start or the cache is empty, no data is emitted.

@mitchtabian is not experiencing this issue because for tutorial purposes he has added delay in all interactors before isNetworkAvailable line, and hence in that time the value gets asserted i.e true and the interactor queries the API.

Offline banner not shown when app opened with no network.

To reproduce

  • Turn of wifi/cellular data
  • open application
  • offline banner not shown

This is because ConnectivityManager.NetworkCallback inside /food2forkcompose/presentation/util/ConnectionLiveData.kt gets triggered only when:

  • A network connection is present (overrides onAvailable())
  • A network is lost (overrides onLost())
    and not when network is unavailable by default

issue in ConstraintLayout

so after updating ConstraintLayout in compose(which stable compose is out RN), when i try to use this in this project it has error

ConstraintLayout(
                    modifier = Modifier.align(Alignment.CenterVertically)
                ) {
                    val (menu) = createRefs()
                    IconButton(
                        modifier = Modifier
                            .constrainAs(menu) {
                                end.linkTo(parent.end)
                                linkTo(top = parent.top, bottom = parent.bottom)
                            },
                        onClick = onToggleTheme,
                    ) {
                        Icon(Icons.Filled.MoreVert, contentDescription = "Toggle Dark/Light Theme")
                    }
                }

error:
Type mismatch.
Required:
Context
Found:
() โ†’ Unit

Checking Internet connection on launch of the application

The Internet connection code works really well, but the problem is that it doesn't work if I started the app with the wifi & cellular closed, so unless I switch on the cellular or wifi first it won't check, any idea of how to resolve this, or should I just delay the code?
I've already "stackoverflowed" ๐Ÿ˜‚ my problem here

building with kotlin-gradle-plugin:1.5.10

fork2fork-compose builds with:
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30" <- via Versions.kt

However when I use the up-to-date:
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10"

I get the error:

Task :app:kaptDebugKotlin
error: [Hilt]
Unsupported metadata version. Check that your Kotlin version is >= 1.0: java.lang.IllegalStateException: Unsupported metadata version. Check that your Kotlin version is >= 1.0
[Hilt]


I'm trying to track down why my implementation of ConnectivityManager fails to ping Google (fork2fork does), and I wonder if it has anything to do with 1.4.30 versus :1.5.10


update: forgot android.permission.INTERNET <- my bad

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.