async def require_confirm_change_autolock_delay(ctx, delay_ms): await confirm_action( ctx, "set_autolock_delay", "Auto-lock delay", description="Do you really want to auto-lock your device after {}?", description_param=format_duration_ms(delay_ms), br_code=ButtonRequestType.ProtectCall, )
def test_format_duration_ms(self): VECTORS = [ (0, "0 milliseconds"), (1, "1 millisecond"), (999, "999 milliseconds"), (1000, "1 second"), (2345, "2 seconds"), (59999, "59 seconds"), (60 * 1000, "1 minute"), (119 * 1000, "1 minute"), (120 * 1000, "2 minutes"), (59 * 60 * 1000, "59 minutes"), (60 * 60 * 1000, "1 hour"), (119 * 60 * 1000, "1 hour"), (3 * 60 * 60 * 1000, "3 hours"), (48 * 60 * 60 * 1000, "48 hours"), ] for v in VECTORS: self.assertEqual(strings.format_duration_ms(v[0]), v[1])
async def require_confirm_change_autolock_delay(ctx, delay_ms): text = Text("Auto-lock delay", ui.ICON_CONFIG, new_lines=False) text.normal("Do you really want to", "auto-lock your device", "after") text.bold("{}?".format(format_duration_ms(delay_ms))) await require_confirm(ctx, text, ButtonRequestType.ProtectCall)