Giter VIP home page Giter VIP logo

Comments (5)

Zhuinden avatar Zhuinden commented on May 22, 2024 1

It's so much easier if UseCase class doesn't exist, then you don't have to add a Params object just to have a function that has more than 1 argument.

Not to mention, UseCase does nothing except call featureAuthRepo, so why even have the featureAuthRepo at all.

from android-cleanarchitecture-kotlin.

jmcaldera avatar jmcaldera commented on May 22, 2024

Why don't you pass these params to the remoteDataSource which will be responsible for creating theLoginParamsclass and pass it to the service to perform the POST request?

I don't see the problem of the Repository creating the LoginParams instance tho.

from android-cleanarchitecture-kotlin.

UriAbadAtabix avatar UriAbadAtabix commented on May 22, 2024

Cause remoteDataSource already have an implementation of LoginApi. I didn't know how to expose LoginParams class to remoteDataSource through his implementation.

from android-cleanarchitecture-kotlin.

aaghan avatar aaghan commented on May 22, 2024

@UriAbadAtabix
Have you looked onto the Either and Usecase class?

for reference, I've used this for post api
class DoLogin

@Inject constructor(private val featureAuthRepo: FeatureAuthRepo):UseCase<LoginResponse,DoLogin.Params>(){

    data class Params(val mac:String, val pass:String)

    override suspend fun run(params: Params): Either<Failure, LoginResponse> = featureAuthRepo.doLogin(params.mac,params.pass)
}

I've sent params object

from android-cleanarchitecture-kotlin.

aaghan avatar aaghan commented on May 22, 2024

@Zhuinden Yes I agree on you, but for the startup on going through clean-architecture and to find all the functionalities without going through all the project, I found it easier to understand and hence kept this more class for each one.

from android-cleanarchitecture-kotlin.

Related Issues (20)

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.