feat: Email sending delays#2908
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a “send delay / cancel send” flow: when sending a draft, the API can return a cancel_resource URL allowing the app to show a cancellable “Email sent” snackbar for the configured cancellation period, and scheduled/sending items are reflected in the thread UI and settings.
Changes:
- Add
cancel_resourcesupport to send-draft results and propagate it through the drafts worker pipeline to the UI. - Add a configurable cancellation period in Settings and apply it to draft sending (
Draft.delay). - Update thread UI to better handle “scheduled message” vs “draft” states and show a “Sending…” indicator.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/res/values/strings.xml | Adds “Sending…” and “Send cancelled” strings. |
| app/src/main/res/values-sv/strings.xml | Swedish translations for new send-delay UI strings. |
| app/src/main/res/values-pt/strings.xml | Portuguese translations for new send-delay UI strings. |
| app/src/main/res/values-pl/strings.xml | Polish translations for new send-delay UI strings. |
| app/src/main/res/values-nl/strings.xml | Dutch translations for new send-delay UI strings. |
| app/src/main/res/values-nb/strings.xml | Norwegian Bokmål translations for new send-delay UI strings. |
| app/src/main/res/values-it/strings.xml | Italian translations for new send-delay UI strings. |
| app/src/main/res/values-fr/strings.xml | French translations for new send-delay UI strings. |
| app/src/main/res/values-fi/strings.xml | Finnish translations for new send-delay UI strings. |
| app/src/main/res/values-es/strings.xml | Spanish translations for new send-delay UI strings. |
| app/src/main/res/values-el/strings.xml | Greek translations for new send-delay UI strings. |
| app/src/main/res/values-de/strings.xml | German translations for new send-delay UI strings. |
| app/src/main/res/values-da/strings.xml | Danish translations for new send-delay UI strings. |
| app/src/main/res/navigation/main_navigation.xml | Adds navigation action to the cancel-delay setting screen from Settings. |
| app/src/main/res/layout/item_message.xml | Adds a hidden “Sending…” TextView to show progress for scheduled/sending messages. |
| app/src/main/res/layout/fragment_settings.xml | Adds the cancellation period row to the Settings screen. |
| app/src/main/java/com/infomaniak/mail/workers/MailActionsManager.kt | Captures cancel_resource from send response and returns it in worker output data. |
| app/src/main/java/com/infomaniak/mail/workers/DraftsActionsWorker.kt | Adds a new worker output key for cancel_resource. |
| app/src/main/java/com/infomaniak/mail/ui/newMessage/NewMessageViewModel.kt | Applies the configured cancel delay to drafts when sending. |
| app/src/main/java/com/infomaniak/mail/ui/MainViewModel.kt | Adds unsendDraft() API call and refresh/snackbar handling after cancel. |
| app/src/main/java/com/infomaniak/mail/ui/MainActivity.kt | Displays a cancellable “Email sent” snackbar with a custom duration based on cancel delay. |
| app/src/main/java/com/infomaniak/mail/ui/main/thread/ThreadAdapter.kt | Adjusts draft/scheduled message UI behaviors and shows “Sending…” state. |
| app/src/main/java/com/infomaniak/mail/ui/main/SnackbarManager.kt | Extends snackbar events to carry a custom duration. |
| app/src/main/java/com/infomaniak/mail/ui/main/settings/SettingsFragment.kt | Shows cancellation period subtitle + navigates to cancel-delay setting. |
| app/src/main/java/com/infomaniak/mail/ui/main/settings/send/CancelDelaySettingFragment.kt | Persists selected cancellation delay value. |
| app/src/main/java/com/infomaniak/mail/data/models/message/Message.kt | Treats scheduled messages differently in expansion rules. |
| app/src/main/java/com/infomaniak/mail/data/models/draft/SendDraftResult.kt | Adds nullable cancel_resource field to send-draft result. |
| app/src/main/java/com/infomaniak/mail/data/cache/mailboxContent/ThreadController.kt | Avoids treating scheduled messages as drafts for draft-local-uuid linking. |
| app/src/main/java/com/infomaniak/mail/data/cache/mailboxContent/refreshStrategies/ThreadRecomputations.kt | Excludes scheduled messages from “has drafts” recomputation. |
| app/src/main/java/com/infomaniak/mail/data/cache/mailboxContent/MessageController.kt | Updates “not draft” query to include scheduled messages. |
| app/src/main/java/com/infomaniak/mail/data/api/ApiRepository.kt | Adds unsendDraft() API call. |
Comments suppressed due to low confidence (1)
app/src/main/java/com/infomaniak/mail/ui/main/settings/SettingsFragment.kt:55
- These imports appear unused in this file (
SendSettingsFragmentDirections,animatedNavigation). Please remove them to keep the file warning-free and avoid lint/ktlint failures.
import com.infomaniak.mail.ui.main.settings.send.SendSettingsFragmentDirections
import com.infomaniak.mail.utils.AccountUtils
import com.infomaniak.mail.utils.MyKSuiteDataUtils
import com.infomaniak.mail.utils.UiUtils.saveFocusWhenNavigatingBack
import com.infomaniak.mail.utils.extensions.animatedNavigation
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cd97a97 to
00924d5
Compare
37016e3 to
6b63b99
Compare
6b63b99 to
b10e15a
Compare
Pull request was converted to draft
b10e15a to
645c5cc
Compare
c9fac96 to
90f1602
Compare
90f1602 to
de2ac54
Compare
de2ac54 to
023d26a
Compare
…present and not currently being sent
023d26a to
4db3b03
Compare
4db3b03 to
34582c2
Compare
|



No description provided.