mirror of
https://github.com/avinal/nikki.git
synced 2026-07-04 05:50:10 +05:30
Add dependency wiring, token storage, and app entry points
- AppDependencies: manual DI container with lazy singletons - TokenStore: DataStore-backed persistence for server URL, access token, theme preference, and accent color selection - DataStoreFactory: multiplatform DataStore creation - LocalAppDependencies: CompositionLocal for DI access in composables - App.kt: root composable with theme + Coil ImageLoader (Ktor engine) - MainActivity: creates AppDependencies, provides via CompositionLocal - Coil configured with authenticated Ktor HttpClient for private images Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.avinal.memos
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import com.avinal.memos.util.LocalAppDependencies
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
|
||||
private val deps by lazy {
|
||||
AppDependencies(
|
||||
dataStorePath = filesDir.resolve("memos_prefs.preferences_pb").absolutePath,
|
||||
platformContext = applicationContext,
|
||||
)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
deps.initialize()
|
||||
enableEdgeToEdge()
|
||||
setContent {
|
||||
CompositionLocalProvider(LocalAppDependencies provides deps) {
|
||||
App()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user