From ca1ace2987bf35ce2c97af0d7e7663a9ae0f2fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Bene=C5=A1?= Date: Fri, 13 Nov 2026 09:57:34 +0000 Subject: [PATCH] "Notify when" is offered and sent only where the instance has Reports An instance before 2.0.0-beta.12 knows other values for notify and would refuse the new ones; the form asks for the reports route first. Co-Authored-By: Claude Fable 5.2 --- CHANGELOG.md | 3 ++- .../llembas/android/ui/scheduled/ScheduledScreens.kt | 12 ++++++++++-- app/src/test/java/eu/llembas/android/shots/Fakes.kt | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24575f8..031a7d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,8 @@ For LLeMbas server 2.0.0-beta.12 (harness spec 3.8.0); an older instance works a report, and it is not among your chats. - **Notify when** on a scheduled task's form: *Every run* (the model writes a report every time, also when nothing was found), *When…* (only when your own words hold; "something needs - my attention" to start from) or *Never* (runs are kept in the task's history only). + my attention" to start from) or *Never* (runs are kept in the task's history only). Offered + where the instance has Reports. - A task's runs show the run's own note -- what it found, or why it filed no report -- and a way to its report when it filed one. The run's working chat can still be opened from the run. diff --git a/app/src/main/java/eu/llembas/android/ui/scheduled/ScheduledScreens.kt b/app/src/main/java/eu/llembas/android/ui/scheduled/ScheduledScreens.kt index 0cabe06..6dd3c43 100644 --- a/app/src/main/java/eu/llembas/android/ui/scheduled/ScheduledScreens.kt +++ b/app/src/main/java/eu/llembas/android/ui/scheduled/ScheduledScreens.kt @@ -795,6 +795,8 @@ data class EditState( /** Notify when (spec 3.8.0): `always`, `when` or `never`, and the person's words for `when` (empty: the default). */ val notify: String = "when", val notifyWhen: String = "", + /** Whether the instance has Reports (LLeMbas 2.0.0-beta.12): an older one is neither shown nor sent "notify when". */ + val reports: Boolean = false, ) class ScheduleEditViewModel(app: Application) : AndroidViewModel(app) { @@ -808,6 +810,12 @@ class ScheduleEditViewModel(app: Application) : AndroidViewModel(app) { if (started) return started = true editing = id + // "Notify when" belongs to an instance that files reports; one that has no such route + // would refuse the new values, so it is asked first. + viewModelScope.launch { + val has = runCatching { getApplication().api().reports(unread = true) }.isSuccess + _state.update { it.copy(reports = has) } + } if (id == null) return viewModelScope.launch { runCatching { getApplication().api().schedule(id) }.onSuccess { s -> @@ -849,7 +857,7 @@ class ScheduleEditViewModel(app: Application) : AndroidViewModel(app) { compiled, now.words.trim(), editing, - notify = now.notify, + notify = now.notify.takeIf { now.reports }, notifyWhen = now.notifyWhen, ) then(saved.id) @@ -939,7 +947,7 @@ fun ScheduleEditContent( if (state.unsupported) Text(stringResource(R.string.scheduled_unsupported), color = palette.inkMuted) state.error?.let { Text(it, color = palette.danger, style = MaterialTheme.typography.bodyMedium) } state.compiled?.let { Understood(it) } - NotifyWhen(state.notify, state.notifyWhen, onNotify, onNotifyWhen) + if (state.reports) NotifyWhen(state.notify, state.notifyWhen, onNotify, onNotifyWhen) Spacer(Modifier.height(24.dp)) } } diff --git a/app/src/test/java/eu/llembas/android/shots/Fakes.kt b/app/src/test/java/eu/llembas/android/shots/Fakes.kt index 66d438a..eec711c 100644 --- a/app/src/test/java/eu/llembas/android/shots/Fakes.kt +++ b/app/src/test/java/eu/llembas/android/shots/Fakes.kt @@ -725,7 +725,7 @@ object Fakes { ) /** The form with "When…" chosen and the person's own words in it. */ - val editingNotify: EditState get() = editing.copy(notify = "when", notifyWhen = "a tender for storage opens or closes") + val editingNotify: EditState get() = editing.copy(reports = true, notify = "when", notifyWhen = "a tender for storage opens or closes") val editing = EditState( words = "Every weekday at 7:30, sum up the news about renewable energy in five points",