[mob] Control the enable multipart option via feature flag
This commit is contained in:
@@ -11,6 +11,7 @@ import "package:photos/module/upload/model/multipart.dart";
|
||||
import "package:photos/module/upload/model/xml.dart";
|
||||
import "package:photos/services/collections_service.dart";
|
||||
import "package:photos/utils/crypto_util.dart";
|
||||
import "package:photos/utils/local_settings.dart";
|
||||
|
||||
class MultiPartUploader {
|
||||
final Dio _enteDio;
|
||||
@@ -55,9 +56,9 @@ class MultiPartUploader {
|
||||
}
|
||||
|
||||
Future<int> calculatePartCount(int fileSize) async {
|
||||
// Multipart upload is only enabled for internal users
|
||||
// and debug builds till it's battle tested.
|
||||
if (!_featureFlagService.internalUser) return 1;
|
||||
// If the feature flag is disabled, return 1
|
||||
if (!_featureFlagService.enableMobMultiPart) return 1;
|
||||
if (!LocalSettings.instance.userEnabledMultiplePart) return 1;
|
||||
|
||||
final partCount = (fileSize / multipartPartSizeForUpload).ceil();
|
||||
return partCount;
|
||||
|
||||
@@ -3,6 +3,7 @@ import "dart:async";
|
||||
import 'package:flutter/material.dart';
|
||||
import "package:photos/core/error-reporting/super_logging.dart";
|
||||
import "package:photos/generated/l10n.dart";
|
||||
import "package:photos/service_locator.dart";
|
||||
import "package:photos/services/memories_service.dart";
|
||||
import "package:photos/services/user_remote_flag_service.dart";
|
||||
import 'package:photos/theme/ente_theme.dart';
|
||||
@@ -192,9 +193,11 @@ class _AdvancedSettingsScreenState extends State<AdvancedSettingsScreen> {
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 24,
|
||||
),
|
||||
if (flagService.enableMobMultiPart)
|
||||
const SizedBox(
|
||||
height: 24,
|
||||
),
|
||||
if (flagService.enableMobMultiPart)
|
||||
MenuItemWidget(
|
||||
captionedTextWidget: CaptionedTextWidget(
|
||||
title: S.of(context).enableMultiPartUpload,
|
||||
|
||||
@@ -12,6 +12,7 @@ class RemoteFlags {
|
||||
final bool recoveryKeyVerified;
|
||||
final bool internalUser;
|
||||
final bool betaUser;
|
||||
final bool enableMobMultiPart;
|
||||
|
||||
RemoteFlags({
|
||||
required this.enableStripe,
|
||||
@@ -22,6 +23,7 @@ class RemoteFlags {
|
||||
required this.recoveryKeyVerified,
|
||||
required this.internalUser,
|
||||
required this.betaUser,
|
||||
required this.enableMobMultiPart,
|
||||
});
|
||||
|
||||
static RemoteFlags defaultValue = RemoteFlags(
|
||||
@@ -33,6 +35,7 @@ class RemoteFlags {
|
||||
recoveryKeyVerified: false,
|
||||
internalUser: kDebugMode,
|
||||
betaUser: kDebugMode,
|
||||
enableMobMultiPart: false,
|
||||
);
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
@@ -46,6 +49,7 @@ class RemoteFlags {
|
||||
'recoveryKeyVerified': recoveryKeyVerified,
|
||||
'internalUser': internalUser,
|
||||
'betaUser': betaUser,
|
||||
'enableMobMultiPart': enableMobMultiPart,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -61,6 +65,8 @@ class RemoteFlags {
|
||||
map['recoveryKeyVerified'] ?? defaultValue.recoveryKeyVerified,
|
||||
internalUser: map['internalUser'] ?? defaultValue.internalUser,
|
||||
betaUser: map['betaUser'] ?? defaultValue.betaUser,
|
||||
enableMobMultiPart:
|
||||
map['enableMobMultiPart'] ?? defaultValue.enableMobMultiPart,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,4 +72,6 @@ class FlagService {
|
||||
bool get passKeyEnabled => flags.passKeyEnabled || internalOrBetaUser;
|
||||
|
||||
bool get recoveryKeyVerified => flags.recoveryKeyVerified;
|
||||
|
||||
bool get enableMobMultiPart => flags.enableMobMultiPart || internalUser;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user