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

Some clicks can be missed #4

Open
TkachenkoViacheslav opened this issue Sep 3, 2024 · 2 comments
Open

Some clicks can be missed #4

TkachenkoViacheslav opened this issue Sep 3, 2024 · 2 comments

Comments

@TkachenkoViacheslav
Copy link

Steps to reproduce (it's hard and not always reproducible):

  1. disableSystemVolumeHandler = true
  2. with a delay about 1-2 seconds click "up" -> "down" -> "up" -> "down" -> ...
  3. On some time, pressing on the up/down button won't result in firing blocks, In code inside "public override func observeValue(...)" we are getting into the next If block:
if disableSystemVolumeHandler && newVolume == Float(initialVolume) {
                // Resetting volume, skip blocks
                we are here!
                return
} else { ... 

but in fact button press was detected and newVolume != oldValue

@TkachenkoViacheslav
Copy link
Author

TkachenkoViacheslav commented Sep 3, 2024

Solution:

  1. the condition above should be changed to the:
if disableSystemVolumeHandler && newVolume == oldVolume {
                // Resetting volume, skip blocks
                return
} else { ... 
  1. at the end of function "public override func observeValue(...)" the "Reset volume method" should be wrapped in an If statement:
// Reset volume
if newVolume != Float(initialVolume) {
            setSystemVolume(initialVolume)
}

This was referenced Sep 3, 2024
@TkachenkoViacheslav
Copy link
Author

I'm sorry, my solution is wrong. But the bug is actual

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

No branches or pull requests

1 participant