https://kotlinlang.org logo
#compose-wear
Title
# compose-wear
f

FEDUSS

03/31/2024, 10:24 PM
SwipeToReveal.kt -->
Hi, i was wondering why the onFullSwipe action is executed only when the lastActionType is None. This prevents from doing two or more full swipe actions in a row. Maybe this behavior has been designed only for destructive actions like deleting. A workaround i found to bypass this behavior is to manually change this action type to None at the end of full swipe.
a

Ankit

04/01/2024, 6:06 AM
The idea behind that logic was that full swipe can only be performed manually without interacting with the primary or secondary actions. This means that the action type will be
None
. You are right, when resetting the state to
Covered
(back to the non-swiped state), ideally the
lastActionType
should also be reset to
None
to denote that the
SwipeToReveal
has been reset. If you feel the documentation or the API was not clear enough for this, please feel free to file a bug. The API is still experimental and feedback of this sort can definitely help us improve it and make it stable.
1
f

FEDUSS

04/01/2024, 9:28 AM
Unfortunately, at least with last stable compose version 1.3.0, the action type is set to PrimaryAction (see the first screenshot for the logs, i have 3 visibile *SwipeToRevealCard*s in my screen). So, i have to manually set the state to Covered and the last action to None to "fix" this issue (see the second screenshot for the logs). If i'm not clear enough to help you, i can create a repro and open a a bug ticket...or i can try with the last compose alpha 🙂
a

Ankit

04/01/2024, 10:16 AM
Yes, a code snippet to repro in the bug will be very helpful. :)
So, i have to manually set the state to Covered and the last action to None to "fix" this issue (see the second screenshot for the logs).
Yes, this seems kind of expected. When you swipe, the state goes to
Revealed
. This seems to be the an implementation detail about the
lastActionType
being set to
PrimaryAction
(this is when you use the material version of
SwipeToReveal
, which is the recommended one). It seems to me that we lack in documentation where we don't explicitly mention about the expectations. Please feel free to file a bug and we can discuss in more details. For now, I would suggest its safe to assume that every time some full swipes, you need to reset the
lastActionType
when you reset the state back to
Covered
.
🔝 1
f

FEDUSS

04/01/2024, 10:52 AM
ok thanks 😄! I'm going to open a public issue. I will also write about other problems i found during the implementation.
Here is the ticket --> https://issuetracker.google.com/issues/332050426 Let me know if i can help you further :)
Update: the issue of this morning has the wrong component id. The correct issue is this one --> https://issuetracker.google.com/issues/332050433