chore: move multipart size out of constants
This commit is contained in:
parent
46b7dba9e3
commit
901e50b69b
3 changed files with 9 additions and 11 deletions
|
@ -1,5 +1,3 @@
|
|||
import "package:photos/services/feature_flag_service.dart";
|
||||
|
||||
const int thumbnailSmallSize = 256;
|
||||
const int thumbnailQuality = 50;
|
||||
const int thumbnailLargeSize = 512;
|
||||
|
@ -51,13 +49,6 @@ class FFDefault {
|
|||
const multipartPartSize = 20 * 1024 * 1024;
|
||||
const multipartPartSizeInternal = 8 * 1024 * 1024;
|
||||
|
||||
int get multipartPartSizeForUpload {
|
||||
if (FeatureFlagService.instance.isInternalUserOrDebugBuild()) {
|
||||
return multipartPartSizeInternal;
|
||||
}
|
||||
return multipartPartSize;
|
||||
}
|
||||
|
||||
const kDefaultProductionEndpoint = 'https://api.ente.io';
|
||||
|
||||
const int intMaxValue = 9223372036854775807;
|
||||
|
|
|
@ -3,9 +3,9 @@ import 'dart:io';
|
|||
|
||||
import 'package:path/path.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import "package:photos/core/constants.dart";
|
||||
import "package:photos/models/encryption_result.dart";
|
||||
import "package:photos/module/upload/model/multipart.dart";
|
||||
import "package:photos/module/upload/service/multipart.dart";
|
||||
import "package:photos/utils/crypto_util.dart";
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
import "package:sqflite_migration/sqflite_migration.dart";
|
||||
|
@ -294,7 +294,7 @@ class UploadLocksDB {
|
|||
_trackUploadTable.columnEncryptedFileSize: fileSize,
|
||||
_trackUploadTable.columnFileKey: fileKey,
|
||||
_trackUploadTable.columnFileNonce: fileNonce,
|
||||
_trackUploadTable.columnPartSize: multipartPartSizeForUpload,
|
||||
_trackUploadTable.columnPartSize: MultiPartUploader.multipartPartSizeForUpload,
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
@ -32,6 +32,13 @@ class MultiPartUploader {
|
|||
return _db.getFileEncryptionData(localId, fileHash);
|
||||
}
|
||||
|
||||
static int get multipartPartSizeForUpload {
|
||||
if (FeatureFlagService.instance.isInternalUserOrDebugBuild()) {
|
||||
return multipartPartSizeInternal;
|
||||
}
|
||||
return multipartPartSize;
|
||||
}
|
||||
|
||||
Future<int> calculatePartCount(int fileSize) async {
|
||||
final partCount = (fileSize / multipartPartSizeForUpload).ceil();
|
||||
return partCount;
|
||||
|
|
Loading…
Add table
Reference in a new issue