patrickyin / clean-architecture-android-kotlin Goto Github PK
View Code? Open in Web Editor NEWUsing Uncle Bob's clean architecture with Kotlin language and the latest Android technologies(Rx, Dagger2 etc.).
License: Apache License 2.0
Using Uncle Bob's clean architecture with Kotlin language and the latest Android technologies(Rx, Dagger2 etc.).
License: Apache License 2.0
Would be nice to have fragment implementation
Does it violate dependency rule of clean architecture?
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
override fun buildUseCaseSingle(params: Unit?): Single<List
> = articlesRepository.articles()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
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
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
@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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.