Skip to content

feat: Improve UX creating, editing, and deleting drafts#2221

Merged
nikclayton merged 24 commits into
pachli:mainfrom
nikclayton:draft-repository
Apr 11, 2026
Merged

feat: Improve UX creating, editing, and deleting drafts#2221
nikclayton merged 24 commits into
pachli:mainfrom
nikclayton:draft-repository

Conversation

@nikclayton

Copy link
Copy Markdown
Contributor

Previously, ComposeActivity was started with an optional
ComposeOptions and used that to create a draft as needed. The contents
of the draft (but not the draft itself) were sent to SendStatusService
which constructed and sent the final status.

Change this to pass a draft as part of the ComposeOptions, so it's the
responsibility of the calling code to create the initial draft. This
draft might be constructed from an existing saved draft, or created
specifically to send in ComposeOptions.

ComposeViewModel explicitly saves the draft before passing it to
SendStatusService, which now constructs the status to send from the
draft. SendStatusService is responsible for deleting the draft if it
is sent successfully, otherwise the draft is updated to record the
failure reason.

Access drafts through a new DraftRepository and obsolete DraftHelper.

If a status fails to send the reason is recorded in DraftEntity and a
normal Android notification is shown. Tapping the notification launches
DraftsActivity.

This obsoletes all the DraftsAlert code, which has been removed.

User visible changes

  • Instead of setting the cursor position at only the start or end of
    the content, record the cursor position when saving a draft and restore
    it when loading a draft.
  • All notifications about a status failing to send and creating a draft
    are cancelled when the user opens the drafts screen.
  • More details about the sending failure are shown in the drafts screen.
  • A draft can only be edited in one window at a time. If you try and edit
    the same draft twice the existing editor window will be brought to the
    front.
  • Deleting a draft is no longer a one-tap action. The user has to
    (1) select the draft (possibly selecting multiple drafts), (2) tap a
    "delete" button, and (3) confirm the deletion in a dialog.
  • Send a post using a "Quick Reply" creates a draft first, so if the post
    can't be sent the draft is kept.

Comment thread app/src/main/res/layout/item_draft.xml Fixed
This depends on breaking the link between network types and everything
else.
wip: Send draft as ComposeOption, save draft in ComposeViewModel

Make ComposeOptions mandatory

Cleanup

Use viewmodel's copy of content and contentwarning
- Use notifications to warn user if a draft has failed to send
- Clear these notifications in DraftsActivity
- Show any sending errors with more space, below the draft
- Show the specific error message instead of a generic
If a ComposeActivity exists for a draft move it to the front when re-editing
- Provide checkboxes to select drafts
- Selecting 1-N drafts switches to action mode
  - Shows count of selected drafts
  - Shows menu item to delete selected drafts
- Deleting drafts with menu item shows alertdialog to confirm
Ensure the scheduled status ID is cleared properly if deleting a scheduled
status before updating it.
@nikclayton nikclayton merged commit 8d0bcd1 into pachli:main Apr 11, 2026
28 checks passed
@nikclayton nikclayton deleted the draft-repository branch April 11, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants