You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-07-17 15:47:54 +02:00
Better caching for mobile (#521)
* Use custom caches in all modules * Cache Settings * Fix wrong key * Create custom cache repository based on hive * Show cache usage in settings * Show cache sizes * Change settings ranges and default value * Handle cache clear by operating system * Resolve review comments
This commit is contained in:
15
mobile/lib/utils/bytes_units.dart
Normal file
15
mobile/lib/utils/bytes_units.dart
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
String formatBytes(int bytes) {
|
||||
if (bytes < 1000) {
|
||||
return "$bytes B";
|
||||
} else if (bytes < 1000000) {
|
||||
final kb = (bytes / 1000).toStringAsFixed(1);
|
||||
return "$kb kB";
|
||||
} else if (bytes < 1000000000) {
|
||||
final mb = (bytes / 1000000).toStringAsFixed(1);
|
||||
return "$mb MB";
|
||||
} else {
|
||||
final gb = (bytes / 1000000000).toStringAsFixed(1);
|
||||
return "$gb GB";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user