diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/add_folder/component/AddFolderToClassList.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/add_folder/component/AddFolderToClassList.kt index 375bd6c2..f3bcd887 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/add_folder/component/AddFolderToClassList.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/add_folder/component/AddFolderToClassList.kt @@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.CircleShape -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.MaterialTheme.colorScheme import androidx.compose.material3.MaterialTheme.typography @@ -35,9 +34,7 @@ import com.pwhs.quickmem.domain.model.folder.GetFolderResponseModel import com.pwhs.quickmem.presentation.ads.BannerAds import com.pwhs.quickmem.presentation.app.library.component.SearchTextField import com.pwhs.quickmem.ui.theme.QuickMemTheme -import timber.log.Timber -@OptIn(ExperimentalMaterial3Api::class) @Composable fun AddFolderToClassList( modifier: Modifier = Modifier, @@ -109,8 +106,7 @@ fun AddFolderToClassList( ) } } - items(filterFolders) { folder -> - Timber.d("List folder ID: $folderImportedIds") + items(items = filterFolders, key = {it.id}) { folder -> AddFolderToClassItem( folder = folder, onAddFolderToClass = { diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/add_study_set/component/AddStudySetToClassList.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/add_study_set/component/AddStudySetToClassList.kt index 12eba821..3508139a 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/add_study_set/component/AddStudySetToClassList.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/add_study_set/component/AddStudySetToClassList.kt @@ -36,7 +36,6 @@ import com.pwhs.quickmem.domain.model.subject.SubjectModel import com.pwhs.quickmem.domain.model.users.UserResponseModel import com.pwhs.quickmem.presentation.app.library.component.SearchTextField import com.pwhs.quickmem.ui.theme.QuickMemTheme -import timber.log.Timber @Composable fun AddStudySetToClassList( @@ -127,12 +126,10 @@ fun AddStudySetToClassList( } } } - items(filterStudySets) { studySet -> - Timber.d("Check isAdd: ${studySetImportedIds.contains(studySet.id)}") + items(items = filterStudySets, key = {it.id}) { studySet -> AddStudySetToClassItem( studySet = studySet, onAddStudySetToClass = { - Timber.d("Study set added: $it") onAddStudySetToClass(it) }, isAdded = studySetImportedIds.contains(studySet.id) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/detail/folders/FoldersTabScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/detail/folders/FoldersTabScreen.kt index c0f91000..c9b92019 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/detail/folders/FoldersTabScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/detail/folders/FoldersTabScreen.kt @@ -48,7 +48,7 @@ fun FoldersTabScreen( modifier = Modifier .fillMaxSize(), ) { - items(folder) { folders -> + items(items = folder, key = {it.id}) { folders -> FolderItem( modifier = Modifier.padding(horizontal = 16.dp), title = folders.title, diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/detail/members/MembersTabScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/detail/members/MembersTabScreen.kt index b5f7644d..34dea048 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/detail/members/MembersTabScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/detail/members/MembersTabScreen.kt @@ -46,7 +46,7 @@ fun MembersTabScreen( modifier = Modifier .fillMaxSize(), ) { - items(member) { member -> + items(items = member, key = {it.id}) { member -> ClassMemberItem( modifier = Modifier.padding(horizontal = 16.dp), classMemberModel = member, diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/detail/study_sets/StudySetsTabScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/detail/study_sets/StudySetsTabScreen.kt index d1bef4ca..838f7737 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/detail/study_sets/StudySetsTabScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/classes/detail/study_sets/StudySetsTabScreen.kt @@ -47,7 +47,7 @@ fun StudySetsTabScreen( modifier = Modifier .fillMaxSize(), ) { - items(studySets) { studySet -> + items(items = studySets, key = {it.id}) { studySet -> StudySetItem( modifier = Modifier.padding(horizontal = 16.dp), studySet = studySet, diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/explore/ExploreViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/explore/ExploreViewModel.kt index 46a5d9cd..52b305ee 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/explore/ExploreViewModel.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/explore/ExploreViewModel.kt @@ -1,6 +1,7 @@ package com.pwhs.quickmem.presentation.app.explore import android.app.Application +import android.widget.Toast import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.viewModelScope import com.pwhs.quickmem.core.data.enums.CoinAction @@ -229,6 +230,7 @@ class ExploreViewModel @Inject constructor( when (coin) { is Resources.Error -> { Timber.e("Too many requests, please wait 1 minute") + _uiEvent.send(ExploreUiEvent.Error("Too many requests, please wait 1 minute")) } is Resources.Loading -> { @@ -240,6 +242,11 @@ class ExploreViewModel @Inject constructor( _uiState.update { it.copy(coins = coin.data?.coins ?: 0) } + Toast.makeText( + getApplication(), + "You have earned 1 coin", + Toast.LENGTH_SHORT + ).show() } } } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/explore/top_streak/TopStreakScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/explore/top_streak/TopStreakScreen.kt index b7f5f69d..166e7fae 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/explore/top_streak/TopStreakScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/explore/top_streak/TopStreakScreen.kt @@ -126,7 +126,7 @@ fun TopStreakScreen( modifier = Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally ) { - items(topStreaks.size) { index -> + items(topStreaks.size, key = { it }) { index -> val topStreak = topStreaks[index] StreakItem( rank = index + 1, diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/add_study_set/component/AddStudySetToFolderList.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/add_study_set/component/AddStudySetToFolderList.kt index a7e5ab56..ada9efc2 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/add_study_set/component/AddStudySetToFolderList.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/add_study_set/component/AddStudySetToFolderList.kt @@ -36,7 +36,6 @@ import com.pwhs.quickmem.domain.model.subject.SubjectModel import com.pwhs.quickmem.domain.model.users.UserResponseModel import com.pwhs.quickmem.presentation.app.library.component.SearchTextField import com.pwhs.quickmem.ui.theme.QuickMemTheme -import timber.log.Timber @Composable fun AddStudySetToFolderList( @@ -127,12 +126,10 @@ fun AddStudySetToFolderList( } } } - items(filterStudySets) { studySet -> - Timber.d("Check isAdd: ${studySetImportedIds.contains(studySet.id)}") + items(items = filterStudySets, key = {it.id}) { studySet -> AddStudySetToFolderItem( studySet = studySet, onAddStudySetToFolder = { - Timber.d("Study set added: $it") onAddStudySetToFolder(it) }, isAdded = studySetImportedIds.contains(studySet.id) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/detail/component/FolderDetailStudySetList.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/detail/component/FolderDetailStudySetList.kt index 23052cec..2e23ff92 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/detail/component/FolderDetailStudySetList.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/detail/component/FolderDetailStudySetList.kt @@ -90,7 +90,7 @@ fun FolderDetailStudySetList( LazyColumn( horizontalAlignment = CenterHorizontally, ) { - items(studySets) { studySet -> + items(items = studySets, key = { it.id }) { studySet -> StudySetItem( studySet = studySet, onStudySetClick = { onStudySetClick(studySet.id) } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/HomeScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/HomeScreen.kt index 2b0a1f56..d2d74d67 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/HomeScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/HomeScreen.kt @@ -475,7 +475,7 @@ private fun Home( modifier = Modifier .fillMaxWidth() ) { - items(studySets) { studySet -> + items(items = studySets, key = { it.id }) { studySet -> StudySetHomeItem( studySet = studySet, onStudySetClick = { onStudySetClick(studySet) } @@ -503,7 +503,7 @@ private fun Home( modifier = Modifier .fillMaxWidth() ) { - items(folders) { folder -> + items(items = folders, key = { it.id }) { folder -> FolderHomeItem( title = folder.title, numOfStudySets = folder.studySetCount, @@ -533,7 +533,7 @@ private fun Home( modifier = Modifier .fillMaxWidth() ) { - items(classes) { classItem -> + items(items = classes, key = {it.id}) { classItem -> ClassHomeItem( classItem = classItem, onClick = { onClassClicked(classItem) } @@ -554,7 +554,7 @@ private fun Home( modifier = Modifier.padding(top = 24.dp) ) } - items(subjects, key = { it.id }) { subject -> + items(items = subjects, key = { it.id }) { subject -> SubjectItem( subject = subject, onSearchStudySetBySubject = { diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/components/NotificationListBottomSheet.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/components/NotificationListBottomSheet.kt index b7cb5725..0cde75ce 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/home/components/NotificationListBottomSheet.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/home/components/NotificationListBottomSheet.kt @@ -88,7 +88,7 @@ fun NotificationListBottomSheet( else -> { LazyColumn { - items(notifications, key = { it.id }) { notification -> + items(items = notifications, key = { it.id }) { notification -> NotificationItem( notification = notification, onMarkAsRead = { diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/library/classes/ListClassesScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/library/classes/ListClassesScreen.kt index 9a38804a..fa2cd22a 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/library/classes/ListClassesScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/library/classes/ListClassesScreen.kt @@ -142,7 +142,7 @@ fun ListClassesScreen( modifier = Modifier.padding(8.dp) ) } - items(filterClass) { classItem -> + items(items = filterClass, key = {it.id}) { classItem -> ClassItem( modifier = Modifier.padding(horizontal = 16.dp), classItem = classItem, diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/library/folder/ListFolderScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/library/folder/ListFolderScreen.kt index d2f46332..db9dcc2c 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/library/folder/ListFolderScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/library/folder/ListFolderScreen.kt @@ -142,7 +142,7 @@ fun ListFolderScreen( modifier = Modifier.padding(8.dp) ) } - items(filterFolders) { folder -> + items(items = filterFolders, key = {it.id}) { folder -> FolderItem( modifier = Modifier.padding(horizontal = 16.dp), title = folder.title, diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/library/study_set/ListStudySetScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/library/study_set/ListStudySetScreen.kt index 6ecce094..a70a9276 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/library/study_set/ListStudySetScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/library/study_set/ListStudySetScreen.kt @@ -50,7 +50,7 @@ fun ListStudySetScreen( isLoading: Boolean = false, studySets: List = emptyList(), onStudySetClick: (GetStudySetResponseModel) -> Unit = {}, - onStudySetRefresh: () -> Unit = {}, + onStudySetRefresh: () -> Unit = {}, avatarUrl: String = "", username: String = "", isOwner: Boolean = false @@ -146,7 +146,7 @@ fun ListStudySetScreen( modifier = Modifier.padding(8.dp) ) } - items(filterStudySets) { studySet -> + items(items = filterStudySets, key = { it.id }) { studySet -> StudySetItem( modifier = Modifier.padding(horizontal = 16.dp), studySet = studySet, diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/add_to_class/component/AddStudySetToClassesList.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/add_to_class/component/AddStudySetToClassesList.kt index b2b24c59..e09b14a1 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/add_to_class/component/AddStudySetToClassesList.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/add_to_class/component/AddStudySetToClassesList.kt @@ -136,7 +136,7 @@ fun AddStudySetToClassesList( ) } } - items(filterClass) { classItem -> + items(items = filterClass, key = { it.id }) { classItem -> AddStudySetToClassesItem( classItem = classItem, onAddStudySetToClasses = { diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/add_to_folder/component/AddStudySetToFoldersList.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/add_to_folder/component/AddStudySetToFoldersList.kt index d632c83b..e32d89ca 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/add_to_folder/component/AddStudySetToFoldersList.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/add_to_folder/component/AddStudySetToFoldersList.kt @@ -34,7 +34,6 @@ import com.pwhs.quickmem.domain.model.folder.GetFolderResponseModel import com.pwhs.quickmem.presentation.ads.BannerAds import com.pwhs.quickmem.presentation.app.library.component.SearchTextField import com.pwhs.quickmem.ui.theme.QuickMemTheme -import timber.log.Timber @Composable fun AddStudySetToFoldersList( @@ -107,8 +106,7 @@ fun AddStudySetToFoldersList( ) } } - items(filterFolders) { folder -> - Timber.d("List folder ID: $folderImportedIds") + items(items = filterFolders, key = { it.id }) { folder -> AddStudySetToFoldersItem( folder = folder, onAddStudySetToFolders = { diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/material/MaterialTabScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/material/MaterialTabScreen.kt index 13f15b42..00109407 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/material/MaterialTabScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/material/MaterialTabScreen.kt @@ -187,7 +187,7 @@ fun MaterialTabScreen( LazyRow( modifier = Modifier.fillMaxWidth(), ) { - items(flashCards) { flashCard -> + items(items = flashCards, key = {it.id}) { flashCard -> StudySetFlipCard( frontText = flashCard.term, backText = flashCard.definition, @@ -279,7 +279,7 @@ fun MaterialTabScreen( } } - items(flashCards) { flashCards -> + items(items = flashCards, key = {it.id}) { flashCards -> CardDetail( isOwner = isOwner, color = studySetColor,