Skip to content

Commit

Permalink
Merge pull request #77 from anrouxel/fixingCode
Browse files Browse the repository at this point in the history
Fixing code
  • Loading branch information
anrouxel committed Feb 27, 2024
2 parents 6545b2a + 3538705 commit b6a2fa5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/src/main/assets/ai
Submodule ai updated from 28db52 to b7d81a
5 changes: 0 additions & 5 deletions app/src/main/java/fr/medicapp/medicapp/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ import fr.medicapp.medicapp.ui.theme.MedicAppTheme
*/
class MainActivity : ComponentActivity() {

/**
* Indique si les données ont été téléchargées.
*/


/**
* Crée l'activité. Cette méthode est appelée lorsque l'activité est créée.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import fr.medicapp.medicapp.ui.screen.root.RootRoute
*/
@RequiresApi(Build.VERSION_CODES.Q)
@Composable

fun HomeNavGraph(
navController: NavHostController,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import fr.medicapp.medicapp.viewModel.SharedUserEditViewModel
* Cette fonction construit le graphe de navigation pour l'écran utilisateur.
*
* @param navController Le contrôleur de navigation.
* @param onThemeChange La fonction de changement de thème.
*/
@RequiresApi(Build.VERSION_CODES.O)
fun NavGraphBuilder.userNavGraph(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fr.medicapp.medicapp.ui.screen.prescription

import android.content.Context
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -47,6 +48,10 @@ fun PrescriptionHome(
var alertRedondantOpen by remember { mutableStateOf(false) }
var isReportModalOpen by remember { mutableStateOf(false) }
val context = LocalContext.current
val sharedPrefs = context.getSharedPreferences("medicapp", Context.MODE_PRIVATE)
val isNewMedicationAdded = sharedPrefs
.getBoolean("isNewMedicationAdded", false)

Home(
title = "Prescriptions",
floatingActionButtons = {
Expand Down Expand Up @@ -90,13 +95,14 @@ fun PrescriptionHome(
prescription.medication?.medicationCompositions?.any {
it.substanceCode in (lastMedocCompo ?: emptyList())
} == true
}
} && isNewMedicationAdded

}
PrescriptionList(
prescriptions = prescriptions,
onPrescriptionClick = onPrescriptionClick
)

}

else -> {
Expand All @@ -117,7 +123,13 @@ fun PrescriptionHome(
content = "Attention, le médicament que vous venez de rajouter contient le même principe actif qu'un déjà présent dans vos traitements",
dismissText = "",
confirmText = "Compris",
onConfirm = { alertRedondantOpen = false }
onConfirm = {
alertRedondantOpen = false
with(sharedPrefs.edit()) {
putBoolean("isNewMedicationAdded", false)
apply()
}
}
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ class SharedPrescriptionEditViewModel(
)
addToNotificationManager(context)
_sharedState.value.removeAt(0)
context.getSharedPreferences("medicapp", Context.MODE_PRIVATE).edit()
.putBoolean("isNewMedicationAdded", true).apply()
}
}

Expand Down

0 comments on commit b6a2fa5

Please sign in to comment.