refactor: migrate from Hilt to Koin and expand KMP common modules (#4746)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2026-03-09 20:19:46 -05:00 committed by GitHub
parent a5390a80e7
commit 875cf1cff2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
440 changed files with 3738 additions and 3508 deletions

View file

@ -1,7 +1,7 @@
# `:core:di`
## Overview
The `:core:di` module defines the core Dagger Hilt modules and provides standard dependencies that are shared across all other modules.
The `:core:di` module defines the core Koin modules and provides standard dependencies that are shared across all other modules.
## Key Components
@ -12,7 +12,7 @@ Defines bindings for application-wide singletons like `Application`, `Context`,
Provides a wrapper for standard Kotlin `CoroutineDispatchers` (`IO`, `Default`, `Main`), allowing for easy mocking in unit tests.
### 3. `ProcessLifecycle.kt`
Exposes the application's global process lifecycle as a Hilt binding, enabling components to react to the app entering the foreground or background.
Exposes the application's global process lifecycle as a Koin binding, enabling components to react to the app entering the foreground or background.
## Module dependency graph

View file

@ -15,7 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
plugins { alias(libs.plugins.meshtastic.kmp.library) }
plugins {
alias(libs.plugins.meshtastic.kmp.library)
id("meshtastic.koin")
}
kotlin {
@Suppress("UnstableApiUsage")

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025-2026 Meshtastic LLC
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -14,10 +14,16 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.meshtastic.core.di
package org.meshtastic.core.di.di
import javax.inject.Qualifier
import kotlinx.coroutines.Dispatchers
import org.koin.core.annotation.Module
import org.koin.core.annotation.Single
import org.meshtastic.core.di.CoroutineDispatchers
@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class ProcessLifecycle
@Module
class CoreDiModule {
@Single
fun provideCoroutineDispatchers(): CoroutineDispatchers =
CoroutineDispatchers(io = Dispatchers.IO, main = Dispatchers.Main, default = Dispatchers.Default)
}