Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Seek indicators get stuck as mounted but invisible #752

Closed
wants to merge 1 commit into from

Conversation

refi64
Copy link
Contributor

@refi64 refi64 commented Mar 28, 2024

The usual double-tap-to-seek code flow is:

  1. The user double-taps the screen, which sets _mountSeek[...]Button to true (mounting the indicator and starting its animation) and starts a submission timer.
  2. The animation to display the seek indicator ends.
  3. The timer calls onSubmitted, which sets _hideSeek[...]Button to true.
  4. Next time build() runs, _hideSeek[...]Button causes the animation to be restarted, now going backwards and hiding the indicator.
  5. The animation ends, sees _hide[...]Button is true, and sets it and _mountSeek[...]Button to false, completely unmounting the indicator.

However, if between steps 3 and 5, the user double-taps again, a new timer will be started. If that timer then invokes onSubmitted after step 5, _hide[...]Button will be set to true while _mountSeek[...]Button is false. This means that, next time the user double-taps the screen, the animation will be run with a start and end point of 0.0, resulting in onEnd never being called to unmount the indicator. Thus, the indicator stays mounted and still responds to touch events, but it's now completely invisible.

In order to fix this, if a double-tap occurs while hiding the indicator, we can just set _hideSeek[...]Button back to false, essentially re- starting the entire flow. This allows the user to safely interact with the indicator during the entire period that it's visible on-screen.

The usual double-tap-to-seek code flow is:

1. The user double-taps the screen, which sets `_mountSeek[...]Button`
   to `true` (mounting the indicator and starting its animation) and
   starts a submission timer.
2. The animation to display the seek indicator ends.
3. The timer calls `onSubmitted`, which sets `_hideSeek[...]Button` to
   `true`.
4. Next time `build()` runs, `_hideSeek[...]Button` causes the animation
   to be restarted, now going backwards and hiding the indicator.
5. The animation ends, sees `_hide[...]Button` is `true`, and sets it
   and `_mountSeek[...]Button` to `false`, completely unmounting the
   indicator.

However, if between steps 3 and 5, the user double-taps again, a new
timer will be started. If that timer then invokes `onSubmitted` *after*
step 5, `_hide[...]Button` will be set to `true` while
`_mountSeek[...]Button` is `false`. This means that, next time the user
double-taps the screen, the animation will be run with a start *and* end
point of `0.0`, resulting in `onEnd` never being called to unmount the
indicator. Thus, the indicator stays mounted and still responds to touch
events, but it's now completely invisible.

In order to fix this, if a double-tap occurs while hiding the indicator,
we can just set `_hideSeek[...]Button` back to `false`, essentially re-
starting the entire flow. This allows the user to safely interact with
the indicator during the entire period that it's visible on-screen.
@abdelaziz-mahdy
Copy link
Member

i have fixed that in a previous pr
#640

but leave this open since it looks cleaner, but further testing will show which one is more stable

@abdelaziz-mahdy
Copy link
Member

since #640 is merged i guess this should be closed

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.

None yet

2 participants