fix: Use MB and KB instead of MiB and KiB for file sizes
This commit is contained in:
parent
c30e6c4aa2
commit
67dd7f7028
4 changed files with 7 additions and 7 deletions
|
|
@ -37,7 +37,7 @@ class SendFileDialogState extends State<SendFileDialog> {
|
|||
bool compress = true;
|
||||
|
||||
/// Images smaller than 20kb don't need compression.
|
||||
static const int minSizeToCompress = 20 * 1024;
|
||||
static const int minSizeToCompress = 20 * 1000;
|
||||
|
||||
Future<void> _send() async {
|
||||
final scaffoldMessenger = ScaffoldMessenger.of(widget.outerContext);
|
||||
|
|
@ -47,7 +47,7 @@ class SendFileDialogState extends State<SendFileDialog> {
|
|||
scaffoldMessenger.showLoadingSnackBar(l10n.prepareSendingAttachment);
|
||||
Navigator.of(context, rootNavigator: false).pop();
|
||||
final clientConfig = await widget.room.client.getConfig();
|
||||
final maxUploadSize = clientConfig.mUploadSize ?? 100 * 1024 * 1024;
|
||||
final maxUploadSize = clientConfig.mUploadSize ?? 100 * 1000 * 1000;
|
||||
|
||||
for (final xfile in widget.files) {
|
||||
final MatrixFile file;
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ import 'uia_request_manager.dart';
|
|||
|
||||
extension LocalizedExceptionExtension on Object {
|
||||
static String _formatFileSize(int size) {
|
||||
if (size < 1024) return '$size B';
|
||||
final i = (log(size) / log(1024)).floor();
|
||||
final num = (size / pow(1024, i));
|
||||
if (size < 1000) return '$size B';
|
||||
final i = (log(size) / log(1000)).floor();
|
||||
final num = (size / pow(1000, i));
|
||||
final round = num.round();
|
||||
final numString = round < 10
|
||||
? num.toStringAsFixed(2)
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
|
|||
}
|
||||
|
||||
@override
|
||||
int get maxFileSize => supportsFileStoring ? 100 * 1024 * 1024 : 0;
|
||||
int get maxFileSize => supportsFileStoring ? 100 * 1000 * 1000 : 0;
|
||||
@override
|
||||
bool get supportsFileStoring => !kIsWeb;
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ Future<MatrixSdkDatabase> _constructDatabase(Client client) async {
|
|||
return MatrixSdkDatabase(
|
||||
client.clientName,
|
||||
database: database,
|
||||
maxFileSize: 1024 * 1024 * 10,
|
||||
maxFileSize: 1000 * 1000 * 10,
|
||||
fileStorageLocation: fileStorageLocation?.uri,
|
||||
deleteFilesAfterDuration: const Duration(days: 30),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue