refactor(di): Introduce @ProcessLifecycle qualifier for di (#3978)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2025-12-12 08:23:35 -06:00 committed by GitHub
parent 1bbb4aca62
commit d2b15c73b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 44 additions and 17 deletions

View file

@ -27,6 +27,7 @@ import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import org.meshtastic.core.common.BuildConfigProvider
import org.meshtastic.core.di.ProcessLifecycle
import org.meshtastic.core.service.MeshServiceNotifications
import javax.inject.Singleton
@ -37,10 +38,13 @@ interface ApplicationModule {
@Binds fun bindMeshServiceNotifications(impl: MeshServiceNotificationsImpl): MeshServiceNotifications
companion object {
@Provides fun provideProcessLifecycleOwner(): LifecycleOwner = ProcessLifecycleOwner.get()
@Provides @ProcessLifecycle
fun provideProcessLifecycleOwner(): LifecycleOwner = ProcessLifecycleOwner.get()
@Provides
fun provideProcessLifecycle(processLifecycleOwner: LifecycleOwner): Lifecycle = processLifecycleOwner.lifecycle
@ProcessLifecycle
fun provideProcessLifecycle(@ProcessLifecycle processLifecycleOwner: LifecycleOwner): Lifecycle =
processLifecycleOwner.lifecycle
@Singleton
@Provides