Merge branch 'main' into mobile-resumable

This commit is contained in:
Neeraj Gupta
2024-04-15 12:18:18 +05:30
3 changed files with 16 additions and 6 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();