Git Product home page Git Product logo

clean-architecture-android-kotlin's Issues

Fragments

Would be nice to have fragment implementation

Memory leak

Because your modules didn't support custom scopes so memory leak is existing
Example:
class GetArticlesListUseCase @Inject constructor(private val articlesRepository: ArticlesRepository,
subscribeScheduler: Scheduler,
postExecutionScheduler: Scheduler) : UseCase<List

, Unit>(subscribeScheduler, postExecutionScheduler) {

override fun buildUseCaseSingle(params: Unit?): Single<List

> = articlesRepository.articles()
.map {
it.map { Article(it.title, it.pubDate, it.link) }
}
//I added some code at here to check memory leak by Profiler of Android Studio
var test: ByteArray? = null
init {
test = ByteArray(1024102450)
}

fun test() {
    if (test != null) {

    }
}

}

//Java memory in MEMORY tab from Profiler increases 50KB->100KB->150KB... whenever the app opens the activity which is using GetArticlesListUseCase

Suggest a new structure

Hi Patrickyin,

With current structure, when the app has a new activity or a new fragment, it takes more time of developer for creating classes, modules and creating references between them.

Usecases in domain layer don't have many useful. It cannot do business logic, because data from apis are sent to Observers, all code logic is being implemented in Observers or Presenters.

So, I'm suggesting that we should restructure the project, move Presenter and Observer to domain layer, remove Usecase from domain layer. Presenter will not call UseCase, it will call directly Services in data layer, data will return to Observer.

The new structure will reduce 2 classes and references relate to "Usecase" and "UseCaseModule".

Thanks,
Duy

The build was falling after the build engine has been upgraded D8

Gradle log:

AGPBI: {"kind":"error","text":"Static interface methods are only supported starting with Android N (--min-api 24): okhttp3.Request okhttp3.Authenticator.lambda$static$0(okhttp3.Route, okhttp3.Response)","sources":[{}],"tool":"D8"}
AGPBI: {"kind":"error","text":"Static interface methods are only supported starting with Android N (--min-api 24): okhttp3.Request okhttp3.Authenticator.lambda$static$0(okhttp3.Route, okhttp3.Response)","sources":[{}],"tool":"D8"}

> Task :ui:mergeExtDexDevelopmentDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':ui:developmentDebugRuntimeClasspath'.
> Failed to transform file 'jetified-okhttp-3.14.0.jar' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=21} using transform DexingTransform
   > Error while dexing.
> Failed to transform file 'jetified-okhttp-3.14.0.jar' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=21} using transform DexingTransform
   > Error while dexing

Singleton UseCase?

    @Provides
    @Singleton
    internal fun provideGetArticlesListUseCase(articlesRepository: ArticlesRepository, @Named("ioScheduler") ioScheduler: Scheduler, @Named("mainThreadScheduler") mainThreadScheduler: Scheduler): GetArticlesListUseCase =
            GetArticlesListUseCase(articlesRepository, ioScheduler, mainThreadScheduler)

I think the @Singleton annotation is superfluous, because onDestroy we do a dispose of CompositeDisposable, therefore we can not perform the request again.

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.