fix: add internal user config

This commit is contained in:
Prateek Sunal 2024-04-13 14:17:54 +05:30
parent 70bf917f32
commit 1ce6edf626
3 changed files with 16 additions and 6 deletions

View file

@ -1,3 +1,5 @@
import "package:photos/services/feature_flag_service.dart";
const int thumbnailSmallSize = 256;
const int thumbnailQuality = 50;
const int thumbnailLargeSize = 512;
@ -47,6 +49,14 @@ class FFDefault {
// this is the chunk size of the un-encrypted file which is read and encrypted before uploading it as a single part.
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';

View file

@ -273,7 +273,7 @@ class UploadLocksDB {
_trackUploadTable.columnEncryptedFilePath: encryptedFilePath,
_trackUploadTable.columnEncryptedFileSize: fileSize,
_trackUploadTable.columnFileKey: fileKey,
_trackUploadTable.columnPartSize: multipartPartSize,
_trackUploadTable.columnPartSize: multipartPartSizeForUpload,
},
);

View file

@ -58,7 +58,7 @@ class MultipartUploadURLs {
}
Future<int> calculatePartCount(int fileSize) async {
final partCount = (fileSize / multipartPartSize).ceil();
final partCount = (fileSize / multipartPartSizeForUpload).ceil();
return partCount;
}
@ -148,14 +148,14 @@ Future<Map<int, String>> uploadParts(
final partURL = partsURLs[i];
final isLastPart = i == partsLength - 1;
final fileSize = isLastPart
? encryptedFile.lengthSync() % multipartPartSize
: multipartPartSize;
? encryptedFile.lengthSync() % multipartPartSizeForUpload
: multipartPartSizeForUpload;
final response = await _dio.put(
partURL,
data: encryptedFile.openRead(
i * multipartPartSize,
isLastPart ? null : (i + 1) * multipartPartSize,
i * multipartPartSizeForUpload,
isLastPart ? null : (i + 1) * multipartPartSizeForUpload,
),
options: Options(
headers: {