DarkerWaters / flic_button

A flutter plugin for the Flic2 Button iOS and Android
BSD 3-Clause "New" or "Revised" License
8 stars 8 forks source link

[Android] OnScanCompleted callback when starting scan #5

Closed komaxx closed 1 year ago

komaxx commented 1 year ago

When I use the plugin to start a Flic button scan on Android, I immediately get a callback to onScanCompleted. I can work around that by keeping track myself and only consider scanning active if there was a onScanStarted callback before the onScanCompleted - but I'd still consider this a bug.

Desired behavior: Only call onScanCompleted if there was actually a scan that finished.

butterbrain commented 1 year ago

Thanks Matthias,

I changed it a bit so the Flic2 plugin tries to cancel the connections each time it starts (as flic handles the running state itself and might be more robust if it fails for some reason) but only sends the completed message if your added flag is true.

Thanks for that - I published 1.1.1 if you want to update and use the official version in your code.

It's lovely that someone is using my plugin - very rewarding (O:

On Fri, 4 Aug 2023 at 17:16, Matthias Schicker @.***> wrote:

When I use the plugin to start a Flic button scan on Android, I immediately get a callback to onScanCompleted. I can work around that by keeping track myself and only consider scanning active if there was a onScanStarted callback before the onScanCompleted - but I'd still consider this a bug.

Desired behavior: Only call onScanCompleted if there was actually a scan that finished.

— Reply to this email directly, view it on GitHub https://github.com/DarkerWaters/flic_button/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKMPQH47EPXJ2BQBLKGLEDXTUN6JANCNFSM6AAAAAA3ENJ3A4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

komaxx commented 1 year ago

Hi Douglas, thank you for the merge and for improving on the PR!