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:
bleackstorm committed 2026-11-08 19:25:03 +01:00
1 parent f0487453c9
commit 87bbb448c2
34 files changed
+2026 -1170

No files matched your search

@@ -15,7 +15,8 @@ import com.example.R
import com.example.data.model.MealType
import com.example.data.preferences.ReminderPreferencesManager
import com.example.receiver.MealReminderReceiver
import java.util.Calendar
import java.time.ZoneId
import java.time.ZonedDateTime
object MealNotificationManager {
@@ -111,55 +112,31 @@ object MealNotificationManager {
return
}
val calendar = Calendar.getInstance().apply {
timeInMillis = System.currentTimeMillis()
set(Calendar.HOUR_OF_DAY, hour)
set(Calendar.MINUTE, minute)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
if (timeInMillis <= System.currentTimeMillis()) {
add(Calendar.DAY_OF_YEAR, 1)
}
val zoneId = ZoneId.systemDefault()
val nowZoned = ZonedDateTime.now(zoneId)
var triggerZoned = nowZoned.withHour(hour).withMinute(minute).withSecond(0).withNano(0)
if (!triggerZoned.isAfter(nowZoned)) {
triggerZoned = triggerZoned.plusDays(1)
}
val triggerMillis = triggerZoned.toInstant().toEpochMilli()
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
if (alarmManager.canScheduleExactAlarms()) {
alarmManager.setExactAndAllowWhileIdle(
AlarmManager.RTC_WAKEUP,
calendar.timeInMillis,
pendingIntent
)
} else {
alarmManager.setAndAllowWhileIdle(
AlarmManager.RTC_WAKEUP,
calendar.timeInMillis,
pendingIntent
)
}
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
alarmManager.setExactAndAllowWhileIdle(
AlarmManager.RTC_WAKEUP,
calendar.timeInMillis,
pendingIntent
)
} else {
alarmManager.setExact(
AlarmManager.RTC_WAKEUP,
calendar.timeInMillis,
pendingIntent
)
}
Log.d(TAG, "Scheduled exact reminder for ${mealType.name} at ${calendar.time}")
} catch (e: SecurityException) {
Log.w(TAG, "Exact alarm permission not granted, falling back to setAndAllowWhileIdle", e)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
alarmManager.setAndAllowWhileIdle(
AlarmManager.RTC_WAKEUP,
calendar.timeInMillis,
triggerMillis,
pendingIntent
)
} else {
alarmManager.set(
AlarmManager.RTC_WAKEUP,
triggerMillis,
pendingIntent
)
}
Log.d(TAG, "Scheduled reminder for ${mealType.name} at $triggerZoned")
} catch (e: Exception) {
Log.w(TAG, "Could not schedule reminder: ${e.message}")
}
}