mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Issue #369 - Use repository pattern for bluetooth state
(cherry picked from commit b3878a4240)
This commit is contained in:
parent
1294eee8e3
commit
c0fe9213f1
11 changed files with 224 additions and 109 deletions
|
|
@ -3,6 +3,9 @@ package com.geeksville.mesh
|
|||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.ProcessLifecycleOwner
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
|
|
@ -15,4 +18,14 @@ object ApplicationModule {
|
|||
fun provideSharedPreferences(application: Application): SharedPreferences {
|
||||
return application.getSharedPreferences("ui-prefs", Context.MODE_PRIVATE)
|
||||
}
|
||||
|
||||
@Provides
|
||||
fun provideProcessLifecycleOwner(): LifecycleOwner {
|
||||
return ProcessLifecycleOwner.get()
|
||||
}
|
||||
|
||||
@Provides
|
||||
fun provideProcessLifecycle(processLifecycleOwner: LifecycleOwner): Lifecycle {
|
||||
return processLifecycleOwner.lifecycle
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue