feat(widget): implement home screen widget and fix Google Sheets range synchronization

- Add SatieaAppWidgetProvider with last meal recap, daily summary, and 1-tap logging shortcuts
- Implement reactive UDF quick-log action in MealViewModel and MainActivity
- Safeguard widget updates against concurrency with debounced SupervisorJob scope
- Migrate Google Sheets tab names automatically and encode range URLs per RFC 3986
- Add unit tests for widget UI model formatting and range encoding
This commit is contained in:
bleackstorm committed 2026-11-11 09:48:50 +01:00
1 parent 3d1d0f43e7
commit 1d6e9a3752
17 files changed
+708 -23

No files matched your search

@@ -146,6 +146,18 @@ class MealViewModel(application: Application) : AndroidViewModel(application) {
private val _themeMode = MutableStateFlow(AppThemeMode.DARK)
val themeMode: StateFlow<AppThemeMode> = _themeMode.asStateFlow()
// Quick Log Action triggered from Widget or Notification
private val _quickLogMealRequest = MutableStateFlow<MealType?>(null)
val quickLogMealRequest: StateFlow<MealType?> = _quickLogMealRequest.asStateFlow()
fun requestQuickLogMeal(mealType: MealType) {
_quickLogMealRequest.value = mealType
}
fun consumeQuickLogMealRequest() {
_quickLogMealRequest.value = null
}
private val _sheetsUiState = MutableStateFlow<GoogleSheetsUiState>(
if (sheetsPrefs.lastSyncTimestamp > 0 && sheetsPrefs.spreadsheetUrl != null) {
GoogleSheetsUiState.Success(