From 50b494cef3f91656f371beba18c1367a5e5da5c6 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Sat, 17 Aug 2019 13:50:41 -0500 Subject: [PATCH] Convert AppModule to Kotlin --- .../wbrawner/simplemarkdown/AppModule.java | 29 ------------------- .../com/wbrawner/simplemarkdown/AppModule.kt | 24 +++++++++++++++ 2 files changed, 24 insertions(+), 29 deletions(-) delete mode 100644 app/src/main/java/com/wbrawner/simplemarkdown/AppModule.java create mode 100644 app/src/main/java/com/wbrawner/simplemarkdown/AppModule.kt diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/AppModule.java b/app/src/main/java/com/wbrawner/simplemarkdown/AppModule.java deleted file mode 100644 index 6085a49..0000000 --- a/app/src/main/java/com/wbrawner/simplemarkdown/AppModule.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.wbrawner.simplemarkdown; - -import com.wbrawner.simplemarkdown.presentation.MarkdownPresenter; -import com.wbrawner.simplemarkdown.presentation.MarkdownPresenterImpl; -import com.wbrawner.simplemarkdown.utility.CrashlyticsErrorHandler; -import com.wbrawner.simplemarkdown.utility.ErrorHandler; - -import javax.inject.Singleton; - -import dagger.Module; -import dagger.Provides; - -/** - * Created by billy on 8/22/17. - */ - -@Module -public class AppModule { - @Provides @Singleton - public MarkdownPresenter provideMarkdownPresenter(ErrorHandler errorHandler) { - return new MarkdownPresenterImpl(errorHandler); - } - - @Provides - @Singleton - ErrorHandler provideErrorHandler() { - return new CrashlyticsErrorHandler(); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/AppModule.kt b/app/src/main/java/com/wbrawner/simplemarkdown/AppModule.kt new file mode 100644 index 0000000..58c73fa --- /dev/null +++ b/app/src/main/java/com/wbrawner/simplemarkdown/AppModule.kt @@ -0,0 +1,24 @@ +package com.wbrawner.simplemarkdown + +import com.wbrawner.simplemarkdown.presentation.MarkdownPresenter +import com.wbrawner.simplemarkdown.presentation.MarkdownPresenterImpl +import com.wbrawner.simplemarkdown.utility.CrashlyticsErrorHandler +import com.wbrawner.simplemarkdown.utility.ErrorHandler +import dagger.Module +import dagger.Provides +import javax.inject.Singleton + +@Module +class AppModule { + @Provides + @Singleton + fun provideMarkdownPresenter(errorHandler: ErrorHandler): MarkdownPresenter { + return MarkdownPresenterImpl(errorHandler) + } + + @Provides + @Singleton + internal fun provideErrorHandler(): ErrorHandler { + return CrashlyticsErrorHandler() + } +} \ No newline at end of file