mirror of
https://github.com/bleackstorm/satiea.git
synced 2026-12-03 07:41:56 +01:00
feat: support meal photo URIs and improve UI events
- Add `photoUris` field to `MealEntry` and update Firestore rules. - Implement `UiEvent` handling in `MainActivity` for navigation/links. - Remove sensitive email data from error logs and clean up manifest.
This commit is contained in:
1 parent
f0487453c9
commit
87bbb448c2
34 files changed
+2026
-1170
No files matched your search
@@ -3,8 +3,9 @@ package com.example.util
|
||||
import com.example.data.model.HungerSatietyScale
|
||||
import com.example.data.model.MealEntry
|
||||
import com.example.data.model.MealType
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.time.Instant
|
||||
import java.time.ZoneId
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.Locale
|
||||
|
||||
object GoogleSheetsDataFormatter {
|
||||
@@ -22,10 +23,10 @@ object GoogleSheetsDataFormatter {
|
||||
"Photos jointes"
|
||||
)
|
||||
|
||||
fun formatMealsToRows(meals: List<MealEntry>): List<List<Any>> {
|
||||
val dateFormat = SimpleDateFormat("dd/MM/yyyy", Locale.FRENCH)
|
||||
val timeFormat = SimpleDateFormat("HH:mm", Locale.FRENCH)
|
||||
private val dateFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy", Locale.FRENCH)
|
||||
private val timeFormatter = DateTimeFormatter.ofPattern("HH:mm", Locale.FRENCH)
|
||||
|
||||
fun formatMealsToRows(meals: List<MealEntry>, zoneId: ZoneId = ZoneId.systemDefault()): List<List<Any>> {
|
||||
val rows = mutableListOf<List<Any>>()
|
||||
// Header row
|
||||
rows.add(HEADERS)
|
||||
@@ -34,15 +35,15 @@ object GoogleSheetsDataFormatter {
|
||||
val sortedMeals = meals.sortedByDescending { it.mealTimestamp }
|
||||
|
||||
for (meal in sortedMeals) {
|
||||
val dateObj = Date(meal.mealTimestamp)
|
||||
val dateStr = dateFormat.format(dateObj)
|
||||
val timeStr = timeFormat.format(dateObj)
|
||||
val zonedDateTime = Instant.ofEpochMilli(meal.mealTimestamp).atZone(zoneId)
|
||||
val dateStr = dateFormatter.format(zonedDateTime)
|
||||
val timeStr = timeFormatter.format(zonedDateTime)
|
||||
val mealTypeLabel = MealType.fromString(meal.mealType).displayName
|
||||
val hungerLabel = HungerSatietyScale.getHungerLabel(meal.hungerBefore)
|
||||
val satietyLabel = HungerSatietyScale.getSatietyLabel(meal.satietyAfter)
|
||||
val foodsFormatted = meal.parsedFoodItems().joinToString(" ; ") { it.displayCsv() }
|
||||
val cleanNote = meal.note.replace("\r\n", " ").replace("\n", " ").trim()
|
||||
val photosCount = meal.photosBase64.size
|
||||
val photosCount = meal.displayPhotoUris.size
|
||||
|
||||
rows.add(
|
||||
listOf(
|
||||
|
||||
Reference in new issue
Block a user