Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[auth] Improve code formatting

Neeraj Gupta0a4d4159507c
diff --git a/auth/lib/ui/code_widget.dart b/auth/lib/ui/code_widget.dart
index 8b2d28167b..f63e3c418b 100644
--- a/auth/lib/ui/code_widget.dart
+++ b/auth/lib/ui/code_widget.dart
@@ -683,10 +683,18 @@ class _CodeWidgetState extends State<CodeWidget> {
// replace all digits with β€’
code = code.replaceAll(RegExp(r'\S'), 'β€’');
}
- if (code.length == 6) {
- return "${code.substring(0, 3)} ${code.substring(3, 6)}";
+ switch (code.length) {
+ case 6:
+ return "${code.substring(0, 3)} ${code.substring(3, 6)}";
+ case 7:
+ return "${code.substring(0, 3)} ${code.substring(3, 4)} ${code.substring(4, 7)}";
+ case 8:
+ return "${code.substring(0, 3)} ${code.substring(3, 5)} ${code.substring(5, 8)}";
+ case 9:
+ return "${code.substring(0, 3)} ${code.substring(3, 6)} ${code.substring(6, 9)}";
+ default:
+ return code;
}
- return code;
}
}