[mob][photos] Enable multiPart upload for internal users

This commit is contained in:
Neeraj Gupta
2024-04-15 10:56:41 +05:30
parent 601a776b7a
commit 2638a06551
2 changed files with 14 additions and 4 deletions

View File

@@ -29,6 +29,7 @@ import "package:photos/models/metadata/file_magic.dart";
import 'package:photos/models/upload_url.dart';
import "package:photos/models/user_details.dart";
import 'package:photos/services/collections_service.dart';
import "package:photos/services/feature_flag_service.dart";
import "package:photos/services/file_magic_service.dart";
import 'package:photos/services/local_sync_service.dart';
import 'package:photos/services/sync_service.dart';
@@ -493,11 +494,15 @@ class FileUploader {
final String thumbnailObjectKey =
await _putFile(thumbnailUploadURL, encryptedThumbnailFile);
final count = await calculatePartCount(
await encryptedFile.length(),
);
// Calculate the number of parts for the file. Multiple part upload
// is only enabled for internal users and debug builds till it's battle tested.
final count = FeatureFlagService.instance.isInternalUserOrDebugBuild()
? await calculatePartCount(
await encryptedFile.length(),
)
: 1;
String fileObjectKey;
late String fileObjectKey;
if (count <= 1) {
final fileUploadURL = await _getUploadURL();