Use AndroidAppContext.get() in android implementation to make DB fully platform independent
This commit is contained in:
@@ -87,15 +87,10 @@ import app.klottr.util.SettingsStore
|
||||
import app.klottr.util.UUID
|
||||
import app.klottr.util.formatCoords
|
||||
import app.klottr.util.formatDistance
|
||||
import coil3.ImageLoader
|
||||
import coil3.request.ImageRequest
|
||||
import coil3.request.SuccessResult
|
||||
import coil3.toBitmap
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.IO
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.File
|
||||
import kotlin.collections.component1
|
||||
import kotlin.collections.component2
|
||||
import kotlin.collections.iterator
|
||||
@@ -125,7 +120,7 @@ fun KlottrAppShell(
|
||||
|
||||
// Initiera SQLDelight-databasen med hjälp av DatabaseFactory.
|
||||
val db = remember {
|
||||
val driver = app.klottr.db.DatabaseFactory(context).createDriver()
|
||||
val driver = app.klottr.db.DatabaseFactory.createDriver()
|
||||
app.klottr.db.KlottrDatabase(driver)
|
||||
}
|
||||
|
||||
|
||||
@@ -45,9 +45,10 @@ class MainActivity : ComponentActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// Initiera SQLDelight-databasen
|
||||
val driver = DatabaseFactory(this).createDriver()
|
||||
val database = KlottrDatabase(driver)
|
||||
val notesQueries = database.notesQueries
|
||||
//OH: Dessa verkar inte användas?
|
||||
// val driver = DatabaseFactory(this).createDriver()
|
||||
// val database = KlottrDatabase(driver)
|
||||
// val notesQueries = database.notesQueries
|
||||
|
||||
KLog.setEnabled(BuildConfig.KLLOG_DEBUG) // Styr loggnivå via buildflagga
|
||||
app.klottr.prefs.KvPrefs.init(applicationContext)
|
||||
|
||||
Reference in New Issue
Block a user