diff options
author | Allan Wang <me@allanwang.ca> | 2019-05-01 14:33:51 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-05-01 14:33:51 -0700 |
commit | f10b71944725e507a9e1ba14cef33030b0ebaf9e (patch) | |
tree | 09aaaf20983316ccb386ab943eb0bbf0ed13bca6 /app/src/main/kotlin/com/pitchedapps | |
parent | da93672c2ed6b54e0e7119a6b55715185112df3e (diff) | |
download | frost-f10b71944725e507a9e1ba14cef33030b0ebaf9e.tar.gz frost-f10b71944725e507a9e1ba14cef33030b0ebaf9e.tar.bz2 frost-f10b71944725e507a9e1ba14cef33030b0ebaf9e.zip |
Update koin
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
3 files changed, 14 insertions, 7 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt index 41c6ff4b..0c762b41 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt @@ -45,7 +45,9 @@ import com.raizlabs.android.dbflow.config.DatabaseConfig import com.raizlabs.android.dbflow.config.FlowConfig import com.raizlabs.android.dbflow.config.FlowManager import com.raizlabs.android.dbflow.runtime.ContentResolverNotifier -import org.koin.android.ext.android.startKoin +import org.koin.android.ext.koin.androidContext +import org.koin.android.ext.koin.androidLogger +import org.koin.core.context.startKoin import java.util.Random import kotlin.reflect.KClass @@ -134,7 +136,12 @@ class FrostApp : Application() { L.d { "Activity ${activity.localClassName} created" } } }) - startKoin(this, listOf(FrostDatabase.module(this))) + startKoin { + if (BuildConfig.DEBUG) + androidLogger() + androidContext(this@FrostApp) + modules(FrostDatabase.module(this@FrostApp)) + } } private fun initBugsnag() { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/db/Database.kt b/app/src/main/kotlin/com/pitchedapps/frost/db/Database.kt index 67372e23..cd5fce02 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/db/Database.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/db/Database.kt @@ -21,8 +21,8 @@ import androidx.room.Database import androidx.room.Room import androidx.room.RoomDatabase import com.pitchedapps.frost.BuildConfig -import org.koin.dsl.module.module -import org.koin.standalone.StandAloneContext +import org.koin.core.context.GlobalContext +import org.koin.dsl.module interface FrostPrivateDao { fun cookieDao(): CookieDao @@ -101,6 +101,6 @@ class FrostDatabase(private val privateDb: FrostPrivateDatabase, private val pub * Get from koin * For the most part, you can retrieve directly from other koin components */ - fun get(): FrostDatabase = StandAloneContext.getKoin().koinContext.get() + fun get(): FrostDatabase = GlobalContext.get().koin.get() } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt b/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt index 594da00a..66176aba 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt @@ -47,8 +47,8 @@ import com.pitchedapps.frost.services.NotificationContent import com.pitchedapps.frost.services.NotificationType import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.toReadableTime -import org.koin.standalone.KoinComponent -import org.koin.standalone.inject +import org.koin.core.KoinComponent +import org.koin.core.inject class NotificationWidget : AppWidgetProvider() { |