diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 39c8fb2b..57fcafb7 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -94,7 +94,7 @@ dependencies { implementation(platform(libs.firebase.bom)) implementation(libs.firebase.analytics) implementation(libs.firebase.messaging.ktx) - implementation(libs.onesignal) +// implementation(libs.onesignal) implementation(libs.androidx.paging.runtime.ktx) implementation(libs.androidx.paging.compose) implementation(libs.bundles.roomdb) diff --git a/app/src/main/java/com/pwhs/quickmem/App.kt b/app/src/main/java/com/pwhs/quickmem/App.kt index 0ef74e71..9c17b363 100644 --- a/app/src/main/java/com/pwhs/quickmem/App.kt +++ b/app/src/main/java/com/pwhs/quickmem/App.kt @@ -2,13 +2,11 @@ package com.pwhs.quickmem import android.app.Application import com.google.firebase.messaging.FirebaseMessaging -import com.onesignal.OneSignal -import com.onesignal.debug.LogLevel as OneSignalLogLevel import com.pwhs.quickmem.core.datastore.AppManager import com.pwhs.quickmem.core.datastore.TokenManager import com.pwhs.quickmem.data.dto.notification.DeviceTokenRequestDto import com.pwhs.quickmem.data.remote.ApiService -import com.revenuecat.purchases.LogLevel as RevenueCatLogLevel +import com.revenuecat.purchases.LogLevel import com.revenuecat.purchases.Purchases import com.revenuecat.purchases.PurchasesConfiguration import dagger.hilt.android.HiltAndroidApp @@ -38,16 +36,13 @@ class App : Application() { if (BuildConfig.DEBUG) { Timber.plant(Timber.DebugTree()) } - Purchases.logLevel = RevenueCatLogLevel.DEBUG - OneSignal.Debug.logLevel = OneSignalLogLevel.VERBOSE - OneSignal.initWithContext(this, BuildConfig.ONESIGNAL_APP_ID) + Purchases.logLevel = LogLevel.DEBUG Purchases.configure( PurchasesConfiguration.Builder( context = this, apiKey = BuildConfig.REVENUECAT_API_KEY, ).build() ) - Purchases.sharedInstance.setOnesignalID(OneSignal.User.onesignalId) // Get FCM token getFCMToken() } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/material/CardDetail.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/material/CardDetail.kt index fb830c03..d0ae3e25 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/material/CardDetail.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/material/CardDetail.kt @@ -3,7 +3,6 @@ package com.pwhs.quickmem.presentation.app.study_set.detail.material import android.speech.tts.TextToSpeech import androidx.compose.animation.AnimatedContent import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -19,16 +18,14 @@ import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme.colorScheme -import androidx.compose.material3.MaterialTheme.typography import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect +import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue -import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.ui.Alignment +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment.Companion.CenterVertically import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -36,11 +33,10 @@ import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import com.pwhs.quickmem.R -import com.pwhs.quickmem.presentation.component.ViewImageDialog +import com.pwhs.quickmem.presentation.component.ShowImageDialog import kotlinx.coroutines.delay import kotlinx.coroutines.launch import java.util.Locale @@ -78,7 +74,6 @@ fun CardDetail( startTTS = false } - // Function to start/stop TTS fun toggleSpeech() { if (isSpeaking) { @@ -198,7 +193,7 @@ fun CardDetail( // Image Viewer Dialog if (isImageViewerOpen) { - ViewImageDialog( + ShowImageDialog( definitionImageUri = definitionImageUri, onDismissRequest = { isImageViewerOpen = false 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 266ef185..2bc5b434 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 @@ -40,6 +40,7 @@ import androidx.compose.ui.Alignment.Companion.CenterHorizontally import androidx.compose.ui.Alignment.Companion.CenterVertically import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight.Companion.Bold import androidx.compose.ui.text.style.TextAlign @@ -85,6 +86,7 @@ fun MaterialTabScreen( var explanation by remember { mutableStateOf("") } var showGetAllDialog by remember { mutableStateOf(false) } var learningMode by remember { mutableStateOf(LearnMode.NONE) } + val context = LocalContext.current Scaffold { innerPadding -> Box( @@ -162,7 +164,7 @@ fun MaterialTabScreen( ) ) { Text( - text = "Make a copy", + text = stringResource(R.string.txt_make_a_copy), style = typography.titleMedium.copy( color = colorScheme.background ) @@ -170,7 +172,7 @@ fun MaterialTabScreen( } Text( - text = "You can now edit this study set,just create a copy of it.", + text = stringResource(R.string.txt_you_can_not_edit_this_study_set_just_create_a_copy_of_it), style = typography.bodyMedium.copy( color = colorScheme.onSurface ), @@ -289,9 +291,14 @@ fun MaterialTabScreen( onToggleStarClick(flashCards.id, isStarred) }, onMenuClick = { - hint = flashCards.hint ?: "There is no hint for this flashcard." - explanation = flashCards.explanation - ?: "There is no explanation for this flashcard." + (flashCards.hint + ?: context.getString(R.string.txt_there_is_no_hint_for_this_flashcard)).also { + hint = it + } + (flashCards.explanation + ?: context.getString(R.string.txt_there_is_no_explanation_for_this_flashcard)).also { + explanation = it + } showMenu = true studySetId = flashCards.id onFlashCardClick(flashCards.id) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/UnfinishedLearningBottomSheet.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/UnfinishedLearningBottomSheet.kt index d1f45873..e777cbf9 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/UnfinishedLearningBottomSheet.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/UnfinishedLearningBottomSheet.kt @@ -65,12 +65,11 @@ fun UnfinishedLearningBottomSheet( TextButton( onClick = onEndSessionClick, colors = ButtonDefaults.outlinedButtonColors( - contentColor = colorScheme.primary, - containerColor = Color.Transparent + contentColor = colorScheme.error, + containerColor = Color.Transparent, ), modifier = Modifier - .padding(top = 4.dp) - .fillMaxWidth(), + .padding(top = 4.dp), shape = shapes.medium ) { Text( diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/FlipFlashCardFinish.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/FlipFlashCardFinish.kt index 5c132a25..c2817336 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/FlipFlashCardFinish.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/FlipFlashCardFinish.kt @@ -76,7 +76,6 @@ fun FlipFlashCardFinish( horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier .fillMaxSize() - .padding(top = 20.dp) .padding(16.dp) ) { item { @@ -84,14 +83,14 @@ fun FlipFlashCardFinish( text = stringResource(R.string.txt_you_re_doing_great_keep_it_up), style = MaterialTheme.typography.titleLarge.copy( fontWeight = FontWeight.Bold - ) + ), + modifier = Modifier.padding(16.dp) ) } item { StudySetDonutChart( modifier = Modifier - .size(200.dp) - .padding(16.dp), + .size(200.dp), studySetsStillLearn = countStillLearning.coerceAtLeast(0), studySetsMastered = countKnown.coerceAtLeast(0), color = studySetColor @@ -222,7 +221,8 @@ fun FlipFlashCardFinish( }, modifier = Modifier .fillMaxWidth() - .padding(16.dp), + .padding(top = 16.dp) + .padding(horizontal = 16.dp), shape = MaterialTheme.shapes.small, colors = ButtonDefaults.buttonColors( containerColor = studySetColor, @@ -252,13 +252,14 @@ fun FlipFlashCardFinish( } } item { - if (isGetAll) { + if ( isEndOfList) { Button( onClick = { onRestartClicked() }, modifier = Modifier .fillMaxWidth() + .padding(top = 16.dp) .padding(horizontal = 16.dp), shape = MaterialTheme.shapes.small, colors = ButtonDefaults.buttonColors( @@ -283,7 +284,8 @@ fun FlipFlashCardFinish( fontSize = 18.sp, ), textAlign = TextAlign.Center, - modifier = Modifier.padding(16.dp) + modifier = Modifier + .padding(16.dp) ) } } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizViewModel.kt index 274f7bd0..02b3676a 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizViewModel.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizViewModel.kt @@ -51,6 +51,7 @@ class LearnByQuizViewModel @Inject constructor( init { val studySetId = savedStateHandle.get("studySetId") ?: "" + val isGetAll = savedStateHandle.get("isGetAll") ?: false val studySetTitle = savedStateHandle.get("studySetTitle") ?: "" val studySetDescription = savedStateHandle.get("studySetDescription") ?: "" val studySetColorId = savedStateHandle.get("studySetColorId") ?: 0 @@ -58,6 +59,7 @@ class LearnByQuizViewModel @Inject constructor( _uiState.update { it.copy( studySetId = studySetId, + isGetAll = isGetAll, studySetTitle = studySetTitle, studySetDescription = studySetDescription, studySetColor = ColorModel.defaultColors[studySetColorId], diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/LearnQuizCardAnswer.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/LearnQuizCardAnswer.kt index a38c557c..1c4a969a 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/LearnQuizCardAnswer.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/LearnQuizCardAnswer.kt @@ -25,7 +25,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import com.pwhs.quickmem.core.data.states.RandomAnswer -import com.pwhs.quickmem.presentation.component.ViewImageDialog +import com.pwhs.quickmem.presentation.component.ShowImageDialog @Composable fun LearnQuizCardAnswer( @@ -107,7 +107,7 @@ fun LearnQuizCardAnswer( // Image Viewer Dialog if (isImageViewerOpen) { - ViewImageDialog( + ShowImageDialog( definitionImageUri = definitionImageUri, onDismissRequest = { isImageViewerOpen = false diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizFlashCardFinish.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizFlashCardFinish.kt index 4e52834d..7b2f2168 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizFlashCardFinish.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizFlashCardFinish.kt @@ -50,7 +50,7 @@ import com.airbnb.lottie.compose.rememberLottieComposition import com.pwhs.quickmem.R import com.pwhs.quickmem.core.data.states.WrongAnswer import com.pwhs.quickmem.presentation.app.study_set.detail.progress.StudySetDonutChart -import com.pwhs.quickmem.presentation.component.ViewImageDialog +import com.pwhs.quickmem.presentation.component.ShowImageDialog import com.pwhs.quickmem.ui.theme.correctColor import com.pwhs.quickmem.ui.theme.incorrectColor import com.pwhs.quickmem.util.toStringTime @@ -100,19 +100,18 @@ fun QuizFlashCardFinish( horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier .fillMaxSize() - .padding(top = 20.dp) .padding(16.dp) ) { Text( text = encouragementMessage, style = MaterialTheme.typography.titleLarge.copy( fontWeight = FontWeight.Bold - ) + ), + modifier = Modifier.padding(16.dp) ) StudySetDonutChart( modifier = Modifier - .size(200.dp) - .padding(16.dp), + .size(200.dp), studySetsStillLearn = wrongAnswerCount.coerceAtLeast(0), studySetsMastered = correctAnswerCount.coerceAtLeast(0), color = studySetColor @@ -232,7 +231,8 @@ fun QuizFlashCardFinish( }, modifier = Modifier .fillMaxWidth() - .padding(16.dp), + .padding(top = 16.dp) + .padding(horizontal = 16.dp), shape = MaterialTheme.shapes.small, colors = ButtonDefaults.buttonColors( containerColor = studySetColor, @@ -271,6 +271,7 @@ fun QuizFlashCardFinish( }, modifier = Modifier .fillMaxWidth() + .padding(top = 16.dp) .padding(horizontal = 16.dp), shape = MaterialTheme.shapes.small, colors = ButtonDefaults.buttonColors( @@ -295,7 +296,8 @@ fun QuizFlashCardFinish( fontSize = 18.sp, ), textAlign = TextAlign.Center, - modifier = Modifier.padding(16.dp) + modifier = Modifier + .padding(16.dp) ) } } @@ -375,7 +377,7 @@ fun QuizFlashCardFinish( // Image Viewer Dialog if (isImageViewerOpen) { - ViewImageDialog( + ShowImageDialog( definitionImageUri = definitionImageUri, onDismissRequest = { isImageViewerOpen = false diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseScreen.kt index 01a964a8..2a66e80c 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseScreen.kt @@ -53,7 +53,7 @@ import com.pwhs.quickmem.presentation.app.study_set.studies.component.Unfinished import com.pwhs.quickmem.presentation.app.study_set.studies.true_false.component.TrueFalseButton import com.pwhs.quickmem.presentation.app.study_set.studies.true_false.component.TrueFalseFlashcardFinish import com.pwhs.quickmem.presentation.component.LoadingOverlay -import com.pwhs.quickmem.presentation.component.ViewImageDialog +import com.pwhs.quickmem.presentation.component.ShowImageDialog import com.pwhs.quickmem.ui.theme.QuickMemTheme import com.pwhs.quickmem.util.toColor import com.ramcosta.composedestinations.annotation.Destination @@ -366,7 +366,7 @@ fun LearnByTrueFalse( LoadingOverlay(isLoading = isLoading) // Image Viewer Dialog if (isImageViewerOpen) { - ViewImageDialog( + ShowImageDialog( definitionImageUri = definitionImageUri, onDismissRequest = { isImageViewerOpen = false diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseViewModel.kt index 2890e194..491ea690 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseViewModel.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseViewModel.kt @@ -50,6 +50,7 @@ class LearnByTrueFalseViewModel @Inject constructor( init { val studySetId = savedStateHandle.get("studySetId") ?: "" + val isGetAll = savedStateHandle.get("isGetAll") ?: false val studySetTitle = savedStateHandle.get("studySetTitle") ?: "" val studySetDescription = savedStateHandle.get("studySetDescription") ?: "" val studySetColorId = savedStateHandle.get("studySetColorId") ?: 0 @@ -57,6 +58,7 @@ class LearnByTrueFalseViewModel @Inject constructor( _uiState.update { it.copy( studySetId = studySetId, + isGetAll = isGetAll, studySetTitle = studySetTitle, studySetDescription = studySetDescription, studySetColor = ColorModel.defaultColors[studySetColorId], diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/component/TrueFalseFlashcardFinish.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/component/TrueFalseFlashcardFinish.kt index 115fa45a..32db5399 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/component/TrueFalseFlashcardFinish.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/component/TrueFalseFlashcardFinish.kt @@ -50,7 +50,7 @@ import com.airbnb.lottie.compose.rememberLottieComposition import com.pwhs.quickmem.R import com.pwhs.quickmem.presentation.app.study_set.detail.progress.StudySetDonutChart import com.pwhs.quickmem.presentation.app.study_set.studies.true_false.TrueFalseQuestion -import com.pwhs.quickmem.presentation.component.ViewImageDialog +import com.pwhs.quickmem.presentation.component.ShowImageDialog import com.pwhs.quickmem.ui.theme.correctColor import com.pwhs.quickmem.ui.theme.incorrectColor import com.pwhs.quickmem.util.toStringTime @@ -100,19 +100,18 @@ fun TrueFalseFlashcardFinish( horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier .fillMaxSize() - .padding(top = 20.dp) .padding(16.dp) ) { Text( text = encouragementMessage, style = MaterialTheme.typography.titleLarge.copy( fontWeight = FontWeight.Bold - ) + ), + modifier = Modifier.padding(16.dp) ) StudySetDonutChart( modifier = Modifier - .size(200.dp) - .padding(16.dp), + .size(200.dp), studySetsStillLearn = wrongAnswerCount.coerceAtLeast(0), studySetsMastered = correctAnswerCount.coerceAtLeast(0), color = studySetColor @@ -233,7 +232,8 @@ fun TrueFalseFlashcardFinish( }, modifier = Modifier .fillMaxWidth() - .padding(16.dp), + .padding(top = 16.dp) + .padding(horizontal = 16.dp), shape = MaterialTheme.shapes.small, colors = ButtonDefaults.buttonColors( containerColor = studySetColor, @@ -254,13 +254,14 @@ fun TrueFalseFlashcardFinish( ) } } - if (isGetAll) { + if (isGetAll && isEndOfList) { Button( onClick = { onRestartClicked() }, modifier = Modifier .fillMaxWidth() + .padding(top = 16.dp) .padding(horizontal = 16.dp), shape = MaterialTheme.shapes.small, colors = ButtonDefaults.buttonColors( @@ -285,7 +286,8 @@ fun TrueFalseFlashcardFinish( fontSize = 18.sp, ), textAlign = TextAlign.Center, - modifier = Modifier.padding(16.dp) + modifier = Modifier + .padding(16.dp) ) } } @@ -365,7 +367,7 @@ fun TrueFalseFlashcardFinish( // Image Viewer Dialog if (isImageViewerOpen) { - ViewImageDialog( + ShowImageDialog( definitionImageUri = definitionImageUri, onDismissRequest = { isImageViewerOpen = false diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteScreen.kt index fea8de87..f1b0c504 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteScreen.kt @@ -66,7 +66,7 @@ import com.pwhs.quickmem.domain.model.flashcard.FlashCardResponseModel import com.pwhs.quickmem.presentation.app.study_set.studies.component.UnfinishedLearningBottomSheet import com.pwhs.quickmem.presentation.app.study_set.studies.write.component.WriteFlashcardFinish import com.pwhs.quickmem.presentation.component.LoadingOverlay -import com.pwhs.quickmem.presentation.component.ViewImageDialog +import com.pwhs.quickmem.presentation.component.ShowImageDialog import com.pwhs.quickmem.ui.theme.QuickMemTheme import com.pwhs.quickmem.util.rememberImeState import com.pwhs.quickmem.util.toColor @@ -413,7 +413,7 @@ fun LearnByWrite( LoadingOverlay(isLoading = isLoading) // Image Viewer Dialog if (isImageViewerOpen) { - ViewImageDialog( + ShowImageDialog( definitionImageUri = definitionImageUri, onDismissRequest = { isImageViewerOpen = false diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteViewModel.kt index f3af890a..920a5f4e 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteViewModel.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteViewModel.kt @@ -50,12 +50,14 @@ class LearnByWriteViewModel @Inject constructor( init { val studySetId = savedStateHandle.get("studySetId") ?: "" + val isGetAll = savedStateHandle.get("isGetAll") ?: false val studySetTitle = savedStateHandle.get("studySetTitle") ?: "" val studySetDescription = savedStateHandle.get("studySetDescription") ?: "" val studySetColorId = savedStateHandle.get("studySetColorId") ?: 0 val studySetSubjectId = savedStateHandle.get("studySetSubjectId") ?: 0 _uiState.update { it.copy( + isGetAll = isGetAll, studySetId = studySetId, studySetTitle = studySetTitle, studySetDescription = studySetDescription, diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/component/WriteFlashcardFinish.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/component/WriteFlashcardFinish.kt index 3372b428..99033934 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/component/WriteFlashcardFinish.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/component/WriteFlashcardFinish.kt @@ -50,7 +50,7 @@ import com.airbnb.lottie.compose.rememberLottieComposition import com.pwhs.quickmem.R import com.pwhs.quickmem.presentation.app.study_set.detail.progress.StudySetDonutChart import com.pwhs.quickmem.presentation.app.study_set.studies.write.WriteQuestion -import com.pwhs.quickmem.presentation.component.ViewImageDialog +import com.pwhs.quickmem.presentation.component.ShowImageDialog import com.pwhs.quickmem.ui.theme.correctColor import com.pwhs.quickmem.ui.theme.incorrectColor import com.pwhs.quickmem.util.toStringTime @@ -100,19 +100,18 @@ fun WriteFlashcardFinish( horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier .fillMaxSize() - .padding(top = 20.dp) .padding(16.dp) ) { Text( text = encouragementMessage, style = MaterialTheme.typography.titleLarge.copy( fontWeight = FontWeight.Bold - ) + ), + modifier = Modifier.padding(16.dp) ) StudySetDonutChart( modifier = Modifier - .size(200.dp) - .padding(16.dp), + .size(200.dp), studySetsStillLearn = wrongAnswerCount.coerceAtLeast(0), studySetsMastered = correctAnswerCount.coerceAtLeast(0), color = studySetColor @@ -232,7 +231,8 @@ fun WriteFlashcardFinish( }, modifier = Modifier .fillMaxWidth() - .padding(16.dp), + .padding(top = 16.dp) + .padding(horizontal = 16.dp), shape = MaterialTheme.shapes.small, colors = ButtonDefaults.buttonColors( containerColor = studySetColor, @@ -264,6 +264,7 @@ fun WriteFlashcardFinish( }, modifier = Modifier .fillMaxWidth() + .padding(top = 16.dp) .padding(horizontal = 16.dp), shape = MaterialTheme.shapes.small, colors = ButtonDefaults.buttonColors( @@ -288,7 +289,8 @@ fun WriteFlashcardFinish( fontSize = 18.sp, ), textAlign = TextAlign.Center, - modifier = Modifier.padding(16.dp) + modifier = Modifier + .padding(16.dp) ) } } @@ -377,7 +379,7 @@ fun WriteFlashcardFinish( // Image Viewer Dialog if (isImageViewerOpen) { - ViewImageDialog( + ShowImageDialog( definitionImageUri = definitionImageUri, onDismissRequest = { isImageViewerOpen = false diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/auth/login/email/LoginWithEmailViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/auth/login/email/LoginWithEmailViewModel.kt index 290854bd..2473c92d 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/auth/login/email/LoginWithEmailViewModel.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/auth/login/email/LoginWithEmailViewModel.kt @@ -4,7 +4,6 @@ import android.app.Application import android.widget.Toast import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.viewModelScope -import com.onesignal.OneSignal import com.pwhs.quickmem.core.data.enums.AuthProvider import com.pwhs.quickmem.core.datastore.AppManager import com.pwhs.quickmem.core.datastore.TokenManager @@ -161,9 +160,6 @@ class LoginWithEmailViewModel @Inject constructor( } ) } - OneSignal.login(login.data?.id ?: "") - OneSignal.User.addEmail(login.data?.email ?: "") - Purchases.sharedInstance.setOnesignalUserID(OneSignal.User.externalId) _uiState.update { it.copy(isLoading = false) } _uiEvent.trySend(LoginWithEmailUiEvent.LoginSuccess) } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/auth/verify_email/VerifyEmailViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/auth/verify_email/VerifyEmailViewModel.kt index 25b94b16..8dd90a33 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/auth/verify_email/VerifyEmailViewModel.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/auth/verify_email/VerifyEmailViewModel.kt @@ -4,7 +4,6 @@ import android.app.Application import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.viewModelScope -import com.onesignal.OneSignal import com.pwhs.quickmem.core.datastore.AppManager import com.pwhs.quickmem.core.datastore.TokenManager import com.pwhs.quickmem.core.utils.Resources @@ -153,9 +152,6 @@ class VerifyEmailViewModel @Inject constructor( } ) } - OneSignal.login(resource.data?.id ?: "") - OneSignal.User.addEmail(resource.data?.email ?: "") - Purchases.sharedInstance.setOnesignalUserID(OneSignal.User.externalId) _uiEvent.send(VerifyEmailUiEvent.VerifySuccess) } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/component/ViewImageDialog.kt b/app/src/main/java/com/pwhs/quickmem/presentation/component/ShowImageDialog.kt similarity index 99% rename from app/src/main/java/com/pwhs/quickmem/presentation/component/ViewImageDialog.kt rename to app/src/main/java/com/pwhs/quickmem/presentation/component/ShowImageDialog.kt index 6287ef73..43a57160 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/component/ViewImageDialog.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/component/ShowImageDialog.kt @@ -23,7 +23,7 @@ import androidx.compose.ui.window.Dialog import coil.compose.AsyncImage @Composable -fun ViewImageDialog( +fun ShowImageDialog( modifier: Modifier = Modifier, definitionImageUri: String, onDismissRequest: () -> Unit, diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 25d454ea..233995a6 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -430,4 +430,7 @@ Chờ đã, đừng đi vội! Bạn sẽ bỏ lỡ việc hoàn thành bộ học này! Tiếp tục học Kết thúc phần học + Bây giờ bạn không thể chỉnh sửa hoặc học bộ học này, chỉ cần tạo một bản sao của nó. + Không có gợi ý cho thẻ ghi nhớ này. + Không có giải thích nào cho thẻ ghi nhớ này \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1d5a44ae..928d67d3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -433,4 +433,7 @@ Wait, don\'t go yet! You\'ll miss out on completing this study set! Keep Learning End Session + You can not edit or learn this study set,just create a copy of it. + There is no hint for this flashcard. + There is no explanation for this flashcard. \ No newline at end of file