Open gestrich opened 11 months ago
Just an implementation idea thinking about this..
NightscoutDataSource
, store the lastUsedOTP after each succesful OTP usage. credentialService.otpCode
, we could have a throwing convenience method in NightscoutDataSource
like the following:
func getValidOTP() throws -> String {
//Get the current code from credentialService.otpCode
//If it matches the last one sent, throw a presentable LocalizedError. That will propagate back to the client UI and show
//otherwise, return the OTP
}
One UI concept I’ve dreamed of has been a visual countdown/timer showing the current OTP and its TTL. Once a command is sent with that OTP, it could be visually marked to show “you need to wait for the next one.”
Not sure how much OTP info is available (specifically, TTL) but I supposed the “status” of the OTP (already used by this device) could be at least helpful to see.
Loop will not allow an OTP to be reused. When submitting bolus + carbs, you need to send 2 OTPs. Rather than Caregivers needing to remember to wait between commands and not knowing until it fails on the Loop side, it would be nice if we showed an error as soon as we detect they are reusing an OTP.
ex: "You have already used the current OTP code. Wait at least 30 seconds between commands.."