Skip to content

Add configurable conversation swipe actions - #409

Open
sizzlesloth wants to merge 1 commit into
GrapheneOS:mainfrom
sizzlesloth:configurable-swipe-actions
Open

sizzlesloth wants to merge 1 commit into
GrapheneOS:mainfrom
sizzlesloth:configurable-swipe-actions

Conversation

@sizzlesloth

@sizzlesloth sizzlesloth commented Oct 3, 2026 •

Copy link
Copy Markdown

What is this?

This PR allows the left and right conversation swipe actions to be customised via the app's settings page.

Changes

  • Use two separate enums for configurable swipe options vs all swipe kinds (this is because 'Unarchive' is a swipe action only available on the 'Archive' page, so not realistically configurable...)
  • Implement a mapper to convert ConversationSwipeSettings (data model) to ConversationSwipeSpec (UI)
  • Implement repo methods for getting the swipe (enum) pref values
  • Add ConversationSwipePref prefs stuff (the application settings themselves are encapsulated under ConversationSwipeSettings
  • Allow deleting conversations as a swipe option (this is primarily why I wanted to do this)
    • Note that swiping to delete a conversation will show the deletion dialogue, since there is no 'Trash' functionality and an accidental swipe would be pretty bad.
  • Use a list of conversation IDs, rather than a bool to determine whether to show the deletion dialog. This allows us to share a lot of logic for deleting stuff via long press and selection vs swiping
  • Refactor the set read/unread logic to do the same as the above
  • Add tests to ensure custom options result in prefs being written to, null/unknown values returning safe defaults, etc.... basically in line with the existing app boolean prefs tests.

Note: Most of my experience is with Java, so I am very new to Kotlin (and Jetpack compose). I found understanding the flow for deletion and other actions quite difficult, but I have tried my best to conform to how the existing archive and set read/unread behaviours work.

Tested on an emulator and on my Pixel 8 Pro. With both main and this branch, I get performance issues on the conversations screen, so I doubt these changes are the cause.

Thanks!

mentions #351
closes #329

@RankoR
RankoR self-requested a review October 3, 2026 09:23

@RankoR RankoR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix CI and add tests for the new code.

@sizzlesloth

sizzlesloth commented Oct 3, 2026 •

Copy link
Copy Markdown
Author

@RankoR the CI/CD failures seem like an AVD graphics issue, rather than an issue with my changes? Tests have also been added. Suppose I could add an additional test for the mapper if useful?

@RankoR

RankoR commented Oct 4, 2026

Copy link
Copy Markdown
Member

@sizzlesloth no, there were failing tests:

  • debugSection_shownWhenDebugEnabled
  • dumpSmsToggle_delegatesToScreenModel
  • licensesClick_delegatesToScreenModel

They happen only on CI because of CI emu's screen size (320x640, 160 dpi).

Also, please cleanup commits history:

  • Drop "retrigger" commit
  • Rewrite history with the fixes for the tests, formatting, etc
  • Rebase instead of 60b1ff8

@sizzlesloth
sizzlesloth force-pushed the configurable-swipe-actions branch from 00ef5b8 to b7ef644 Compare October 4, 2026 22:11
@sizzlesloth

Copy link
Copy Markdown
Author

Thanks @RankoR , that's good to know. The Failed to find ColorBuffer messages threw me off a bit. I've fixed the tests and rebased from main into one commit. Let me know if there's anything else I need to do!

@sizzlesloth
sizzlesloth requested a review from RankoR October 4, 2026 22:40
@sizzlesloth
sizzlesloth force-pushed the configurable-swipe-actions branch from 850dd08 to 04a01a3 Compare October 5, 2026 21:04
Combine swipe and selection flow for read/unread.
Add jetpack stuff for the settings view.
Add repo stuff for conversation swipe options.
Split enums for ConversationSwipeOption and ConversationSwipeKind (model and UI).
Impl mapper class.
Use enum for conversation swipe prefs.
Add tests and fix regressions.

Formatting.
Put block conversation ID and destination into dataclass.
(the block ID and destination are always modified together, so easy win to pass detekt).
@sizzlesloth
sizzlesloth force-pushed the configurable-swipe-actions branch from 8fca009 to 8555740 Compare October 5, 2026 21:48
@RankoR

RankoR commented Oct 5, 2026

Copy link
Copy Markdown
Member

Please add tests to the changed paths. See coverage report (for both unit and instrumented tests) for the new/changed code to find what should be tested.


import androidx.compose.runtime.Immutable
import com.android.messaging.data.appsettings.model.ConversationSwipeSettings
import com.android.messaging.ui.conversationlist.chats.mapper.toSwipeSpec

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Model should not import from mapper. One fix option is to extract that extension to a proper place.

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.

Configurable swipe actions

2 participants