Add link between lexiconDetail and questDetail

This commit is contained in:
Thomas Andres Gomez 2023-08-02 11:00:24 +02:00
parent b17eefac39
commit 4967989315
3 changed files with 23 additions and 5 deletions

View file

@ -1,9 +1,7 @@
package com.pixelized.rplexicon.repository
import android.net.Uri
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.core.net.toUri
import com.google.api.client.extensions.android.http.AndroidHttp
import com.google.api.client.json.gson.GsonFactory
import com.google.api.services.sheets.v4.Sheets
@ -42,6 +40,10 @@ class LexiconRepository @Inject constructor(
private val _data = MutableStateFlow<List<Lexicon>>(emptyList())
val data: StateFlow<List<Lexicon>> get() = _data
fun findId(name: String?): Int? {
return name?.let { _data.value.firstOrNull { item -> item.name == it }?.id }
}
@Throws(ServiceNotReady::class, IncompatibleSheetStructure::class, Exception::class)
suspend fun fetchLexicon() {
val service = sheetService