|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.example.what_the_fantasy.ui.screens
|
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
|
|
|
import android.util.Log
|
|
|
|
|
import androidx.compose.foundation.background
|
|
|
|
|
import androidx.compose.foundation.clickable
|
|
|
|
|
import androidx.compose.foundation.layout.*
|
|
|
|
@ -20,6 +21,8 @@ import androidx.compose.ui.unit.sp
|
|
|
|
|
import com.example.what_the_fantasy.R
|
|
|
|
|
import com.example.what_the_fantasy.data.local.DailyQuoteStub
|
|
|
|
|
import com.example.what_the_fantasy.data.model.Quote
|
|
|
|
|
import com.example.what_the_fantasy.data.model.SrcLanguage
|
|
|
|
|
import com.example.what_the_fantasy.data.model.SrcType
|
|
|
|
|
import com.example.what_the_fantasy.data.services.IServices
|
|
|
|
|
import com.example.what_the_fantasy.ui.components.NavBar
|
|
|
|
|
import com.example.what_the_fantasy.ui.components.QuoteLittle
|
|
|
|
@ -43,9 +46,12 @@ fun AccueilPage(
|
|
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
//val dailyQuote = services.getDalyQuote(currentUserState.langage)
|
|
|
|
|
|
|
|
|
|
val dailyQuote = DailyQuoteStub.dailyQuote
|
|
|
|
|
val coroutineScope = rememberCoroutineScope()
|
|
|
|
|
val dailyQuote = Quote(-1,"",0,SrcLanguage.vo,"","","",SrcType.Movie,0)
|
|
|
|
|
coroutineScope.launch {
|
|
|
|
|
val dailyQuote = services.getDalyQuote(currentUserState.langage)
|
|
|
|
|
}
|
|
|
|
|
//val dailyQuote = DailyQuoteStub.dailyQuote
|
|
|
|
|
|
|
|
|
|
val titleDalyQuote = stringResource(R.string.TitleHomeDailyQuote)
|
|
|
|
|
val titleSuggestion = stringResource(R.string.TitleHomeSuggestion)
|
|
|
|
@ -65,6 +71,7 @@ fun AccueilPage(
|
|
|
|
|
isLoading.value = true
|
|
|
|
|
delay(500)
|
|
|
|
|
val newQuotes = services.getSomeQuotes(15, page.intValue)
|
|
|
|
|
Log.d("Accueil",newQuotes.toString())
|
|
|
|
|
val uniqueQuotes = newQuotes.filterNot { new -> quotes.any { it.id == new.id } }
|
|
|
|
|
|
|
|
|
|
if (uniqueQuotes.isNotEmpty()) {
|
|
|
|
@ -93,6 +100,7 @@ fun AccueilPage(
|
|
|
|
|
.background(MaterialTheme.colorScheme.background)
|
|
|
|
|
) {
|
|
|
|
|
LazyColumn(modifier = Modifier.weight(1f), state = state) {
|
|
|
|
|
if(dailyQuote.id!=-1) {
|
|
|
|
|
item {
|
|
|
|
|
Column(Modifier.clickable { navQuote(dailyQuote.id) }) {
|
|
|
|
|
Text(
|
|
|
|
@ -107,6 +115,7 @@ fun AccueilPage(
|
|
|
|
|
QuoteLittle(dailyQuote)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
text = titleSuggestion,
|
|
|
|
|
color = MaterialTheme.colorScheme.onBackground,
|
|
|
|
@ -117,7 +126,7 @@ fun AccueilPage(
|
|
|
|
|
textAlign = TextAlign.Center
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
items(quotes) { quote ->
|
|
|
|
|
if (quote.language == currentUserState.langage) {
|
|
|
|
|
Column(Modifier.clickable { navQuote(quote.id ) }) {
|
|
|
|
|