2-Migrate-Persistence-Layer-from-JSON-Files-to-Room-Database #4

Merged
hmalik144 merged 3 commits from 2-Migrate-Persistence-Layer-from-JSON-Files-to-Room-Database into main 2026-04-09 19:14:04 +01:00
2 changed files with 4 additions and 2 deletions
Showing only changes of commit d868c532b7 - Show all commits

View File

@@ -2,6 +2,7 @@ package dev.dettmer.simplenotes.di
import android.content.Context
import androidx.room.Room
import dev.dettmer.simplenotes.MainViewModel
import dev.dettmer.simplenotes.storage.AppDatabase
import dev.dettmer.simplenotes.storage.NotesStorage
import dev.dettmer.simplenotes.ui.main.MainViewModel
@@ -29,5 +30,5 @@ val appModule = module {
single { NotesStorage(androidContext(), get()) }
viewModel { MainViewModel(get(), get()) }
viewModel { MainViewModel(get(), get(), get()) }
}

View File

@@ -211,7 +211,8 @@ class MainViewModel(
val pendingIds = _pendingDeletions.value
val filteredNotes = allNotes.filter { it.id !in pendingIds }.map { Note(
id = it.id,
content = it.content
content = it.content,
) }
withContext(Dispatchers.Main) {