Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix: add internal user config

Prateek Sunal1ce6edf626ca
diff --git a/mobile/lib/core/constants.dart b/mobile/lib/core/constants.dart
index 1cd9da1dd1..cc4c45c8eb 100644
--- a/mobile/lib/core/constants.dart
+++ b/mobile/lib/core/constants.dart
@@ -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';
diff --git a/mobile/lib/db/upload_locks_db.dart b/mobile/lib/db/upload_locks_db.dart
index bf52d21749..3c5a79921e 100644
--- a/mobile/lib/db/upload_locks_db.dart
+++ b/mobile/lib/db/upload_locks_db.dart
@@ -273,7 +273,7 @@ class UploadLocksDB {
_trackUploadTable.columnEncryptedFilePath: encryptedFilePath,
_trackUploadTable.columnEncryptedFileSize: fileSize,
_trackUploadTable.columnFileKey: fileKey,
- _trackUploadTable.columnPartSize: multipartPartSize,
+ _trackUploadTable.columnPartSize: multipartPartSizeForUpload,
},
);
diff --git a/mobile/lib/utils/multipart_upload_util.dart b/mobile/lib/utils/multipart_upload_util.dart
index f17897e88c..3f019eaf72 100644
--- a/mobile/lib/utils/multipart_upload_util.dart
+++ b/mobile/lib/utils/multipart_upload_util.dart
@@ -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: {