Open Joao-Neves opened 7 months ago
Hey @Joao-Neves thanks for logging this. I wasn't able to reproduce this during my testing. I've made tiny changes in the code that I feel would be improvements and perhaps will fix what you're experiencing. If it doesn't, would you mind explaining a bit more in detail exactly how it occurs? Are you pressing the up/down buttons really fast? When the issue occurs, does the volume actually change or does it stay the same? Are you seeing the volume view (white bar) to the left of the screen when you use it?
@Joao-Neves the latest version is 1.1.1 if you'd like to try it out
Hey @kaanselhep. Thank you for the quick reply. I put it in the title but I forgot to explain in the body. This only happens if I have the volume at maximum (1.0) before I start using the app that uses this lib.
I'll test the latest version and I'll come back to you to see if the issue has been fixed or not.
@kaanselhep With the current changes I no longer get duplicated or wrong calls but as soon as the volume hits the maximum the upBlock
stops being called.
It doesn't matter if the volume starts at maximum or if it gets there while after pressing the Volume Up button enough times.
I hope this helps!
Hi @Joao-Neves ,
Ok understood! This is by design but I think it'd be nice to have a callback in this case you're mentioning too.
I'll make another release tonight and it'll have 2 styles of callbacks:
Volume increased will only be called when volume actually increases. And similar idea for volume decrease
But the upBlock and downBlock will always be called upon pressing the up/down buttons (even if volume is at max or min).
How does that sound? It should solve your issue 😃
Cheers!
@kaanselhep That sounds great! That's exactly what I need thank you 🙇.
I've just tested version 1.1.1 and it seems that it still has the same issue with the upBlock not being called when the volume reaches the maximum value. I also can't find the volumeIncreased & volumeDecreased callbacks. Perhaps there was some change that wasn't commited?
Hi @Joao-Neves Sorry didn't have time yesterday so didn't make those changes yet but will ping you once I do. Should be quick and easy. Released with 1.1.2
Hi @Joao-Neves , Actually maybe I was wrong. I looked into implementing what's needed and it seems it's more difficult than we thought. Because the library works by checking the outputVolume and attaching an observer to its changes, we are able to capture a Up/Down volume rocker tap but because the outputVolume doesn't actually change when it's at max or min volume, the observer isn't getting notified and as a result we don't know if the user tapped the up/down button.
When I open the app that I'm developing that uses this library there seems to be an error. Sometimes when I press the Volume Up button the downBlock gets called and sometimes I get 2 blocks called in a row with just one button press.
This is with iPhone 11 and iOS 17.4