goaaats / xl-authenticator

Android/iOS OTP authenticator app for XIVLauncher built in Flutter
GNU General Public License v3.0
38 stars 12 forks source link

Fix and improve the sendOtp for loop #21

Open Berna-L opened 1 year ago

Berna-L commented 1 year ago

Currently, the sendOtp loop is using the ips string's length to loop, which is wrong.

I took the opportunity and changed up the code so it's cleaner (I think?) and doesn't hang if one of the hosts isn't reachable (which will be 99% of the time if the user configured more than one IP address): now, the app will shoot the OTP code to all configured clients and use the first reply received as the condition to autoclose or not.

Since any client that's actually waiting for the code will be quick to reply (while the other clients won't be running at all), this will make it feel like the current (mono-IP) version in which the app quickly opens and closes. If the user opened the app without any client running, it'll timeout all requests in five seconds and not autoclose.