DI: make app Hilt injectable
This commit is contained in:
parent
65741a7e64
commit
564b095427
|
|
@ -5,6 +5,7 @@
|
|||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:name=".revamp.KleidiLlamaApplication"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
|
|
@ -20,8 +21,6 @@
|
|||
android:exported="true"
|
||||
android:theme="@style/Theme.LlamaAndroid">
|
||||
<intent-filter>
|
||||
<!-- <action android:name="android.intent.action.MAIN" />-->
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package com.example.llama.revamp
|
||||
|
||||
import android.app.Application
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
|
||||
@HiltAndroidApp
|
||||
class KleidiLlamaApplication : Application()
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.example.llama.revamp.di
|
||||
|
||||
import android.content.Context
|
||||
import com.example.llama.revamp.data.preferences.UserPreferences
|
||||
import com.example.llama.revamp.data.repository.SystemPromptRepository
|
||||
import com.example.llama.revamp.engine.InferenceEngine
|
||||
import com.example.llama.revamp.monitoring.PerformanceMonitor
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
object AppModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideInferenceEngine() = InferenceEngine()
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun providePerformanceMonitor(@ApplicationContext context: Context) = PerformanceMonitor(context)
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideUserPreferences(@ApplicationContext context: Context) = UserPreferences(context)
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideSystemPromptRepository(@ApplicationContext context: Context) = SystemPromptRepository(context)
|
||||
}
|
||||
Loading…
Reference in New Issue