π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove obsolete mobile code
Manav Rathicf9af3adcfea
diff --git a/mobile/apps/auth/lib/core/constants.dart b/mobile/apps/auth/lib/core/constants.dartindex e63fb309e5..852544e5d2 100644--- a/mobile/apps/auth/lib/core/constants.dart+++ b/mobile/apps/auth/lib/core/constants.dart@@ -12,12 +12,6 @@ final Uri githubFeatureRequestUri = Uri.https({"discussions_q": "is:open label:\"- auth\" sort:top"},);const int microSecondsInDay = 86400000000;-const int android11SDKINT = 30;-const int galleryLoadStartTime = -8000000000000000; // June 28, 1716-const int galleryLoadEndTime = 9223372036854775807; // 2^63 - 1--// todo: 6Jun22: delete old media identifier after 3 months-const String oldSharedMediaIdentifier = 'ente-shared://';const String sharedMediaIdentifier = 'ente-shared-media://';const int maxLivePhotoToastCount = 2;@@ -30,8 +24,6 @@ const thumbnailServerLoadDeferDuration = Duration(milliseconds: 80);// https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#Generating_the_mnemonicconst mnemonicKeyWordCount = 24;-const dragSensitivity = 8;-class FFDefault {static const bool enableStripe = true;static const bool disableCFWorker = false;diff --git a/mobile/apps/auth/lib/events/signed_out_event.dart b/mobile/apps/auth/lib/events/signed_out_event.dartdeleted file mode 100644index 613744d49d..0000000000--- a/mobile/apps/auth/lib/events/signed_out_event.dart+++ /dev/null@@ -1 +0,0 @@-// TODO Implement this library.diff --git a/mobile/apps/photos/lib/services/files_service.dart b/mobile/apps/photos/lib/services/files_service.dartindex dd106fc6bd..6344421121 100644--- a/mobile/apps/photos/lib/services/files_service.dart+++ b/mobile/apps/photos/lib/services/files_service.dart@@ -5,7 +5,6 @@ import "package:ente_strings/ente_strings.dart";import "package:flutter/material.dart";import "package:latlong2/latlong.dart";import 'package:logging/logging.dart';-import 'package:path/path.dart';import 'package:photo_manager/photo_manager.dart' hide LatLng;import 'package:photos/core/configuration.dart';import "package:photos/db/device_files_db.dart";@@ -218,57 +217,6 @@ class FilesService {}}- // Note: this method is not used anywhere, but it is kept for future- // reference when we add bulk EditTime feature- Future<void> bulkEditTime(List<EnteFile> files, EditTimeSource source) async {- final ListMatch<EnteFile> result = files.splitMatch(- (element) => element.isUploaded,- );- final List<EnteFile> uploadedFiles = result.matched;- final List<EnteFile> localOnlyFiles = result.unmatched;- for (EnteFile localFile in localOnlyFiles) {- final timeResult = _parseTime(localFile, source);- if (timeResult != null) {- localFile.creationTime = timeResult;- }- }- await _filesDB.insertMultiple(localOnlyFiles);-- final List<EnteFile> remoteFilesToUpdate = [];- final Map<int, Map<String, int>> fileIDToUpdateMetadata = {};- for (EnteFile remoteFile in uploadedFiles) {- if (remoteFile.ownerID != _config.getUserID()! ||- fileIDToUpdateMetadata.containsKey(remoteFile.uploadedFileID!)) {- continue;- }- final timeResult = _parseTime(remoteFile, source);- if (timeResult != null) {- remoteFilesToUpdate.add(remoteFile);- fileIDToUpdateMetadata[remoteFile.uploadedFileID!] = {- editTimeKey: timeResult,- };- }- }- if (remoteFilesToUpdate.isNotEmpty) {- await FileMagicService.instance.updatePublicMagicMetadata(- remoteFilesToUpdate,- null,- metadataUpdateMap: fileIDToUpdateMetadata,- );- }- }-- int? _parseTime(EnteFile file, EditTimeSource source) {- assert(- source == EditTimeSource.fileName,- "edit source ${source.name} is not supported yet",- );- final timeResult = parseDateTimeFromFileNameV2(- basenameWithoutExtension(file.title ?? ""),- );- return timeResult?.microsecondsSinceEpoch;- }-Future<void> removeIgnoredFiles(Future<FileLoadResult> result) async {final ignoredIDs = await IgnoredFilesService.instance.idToIgnoreReasonMap;(await result).files.removeWhere(@@ -278,5 +226,3 @@ class FilesService {);}}--enum EditTimeSource { fileName, exif, manualFix, manualAdjusted }diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dartindex 958db92111..7d0bc43f86 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart@@ -675,7 +675,7 @@ class GalleryState extends State<Gallery> {ScrollPhysics get _scrollPhysics => widget.disableScroll? const NeverScrollableScrollPhysics()- : const ExponentialBouncingScrollPhysics();+ : const BouncingScrollPhysics();static String _buildAutomationScrollIdentifier(String tagPrefix) {final safeTagPrefix = tagPrefix.replaceAll(@@ -878,7 +878,7 @@ class GalleryState extends State<Gallery> {child: CustomScrollView(physics: widget.disableScroll || isSwipeActive? const NeverScrollableScrollPhysics()- : const ExponentialBouncingScrollPhysics(),+ : const BouncingScrollPhysics(),controller: _scrollController,slivers: [if (widget.appBar != null)@@ -1238,15 +1238,3 @@ class GalleryIndexUpdatedEvent {GalleryIndexUpdatedEvent(this.tag, this.index);}--// TODO: Revert this PR https://github.com/ente/ente/pull/8401 after Jan 1,-// 2026. This was implemented temporarily for the Christmas banner and should-// be removed afterwards.-class ExponentialBouncingScrollPhysics extends BouncingScrollPhysics {- const ExponentialBouncingScrollPhysics({super.parent});-- @override- ExponentialBouncingScrollPhysics applyTo(ScrollPhysics? ancestor) {- return ExponentialBouncingScrollPhysics(parent: buildParent(ancestor));- }-}diff --git a/mobile/apps/photos/lib/utils/share_util.dart b/mobile/apps/photos/lib/utils/share_util.dartindex 46c7a84814..191ba5afa6 100644--- a/mobile/apps/photos/lib/utils/share_util.dart+++ b/mobile/apps/photos/lib/utils/share_util.dart@@ -227,26 +227,6 @@ Future<List<EnteFile>> convertPicketAssets(return localFiles;}-DateTime? parseDateFromFileNam1e(String fileName) {- if (fileName.startsWith('IMG-') || fileName.startsWith('VID-')) {- // Whatsapp media files- return DateTime.tryParse(fileName.split('-')[1]);- } else if (fileName.startsWith("Screenshot_")) {- // Screenshots on droid- return DateTime.tryParse(- (fileName).replaceAll('Screenshot_', '').replaceAll('-', 'T'),- );- } else {- return DateTime.tryParse(- (fileName)- .replaceAll("IMG_", "")- .replaceAll("VID_", "")- .replaceAll("DCIM_", "")- .replaceAll("_", " "),- );- }-}-void shareSelected(BuildContext context,GlobalKey shareButtonKey,diff --git a/mobile/apps/photos/plugins/ente_crypto/lib/src/crypto.dart b/mobile/apps/photos/plugins/ente_crypto/lib/src/crypto.dartindex 96193338eb..c7a8657f4c 100644--- a/mobile/apps/photos/plugins/ente_crypto/lib/src/crypto.dart+++ b/mobile/apps/photos/plugins/ente_crypto/lib/src/crypto.dart@@ -84,79 +84,6 @@ EncryptionResult chachaEncryptData(Map<String, dynamic> args) {);}-// chachaEncryptFileV2 does chucked encryption similar to chachaEncryptFile.-// This implementation is refactored to simplify the logic to make it easier to-// maintain and reason about.-// Rolling out this version 2 in phases to ensure stability-Future<FileEncryptResult> chachaEncryptFileV2(Map<String, dynamic> args) async {- final encryptionStartTime = DateTime.now().millisecondsSinceEpoch;- final logger = Logger("chachaEncryptFileV2");- final sourceFile = File(args["sourceFilePath"]);- final destinationFile = File(args["destinationFilePath"]);- if (destinationFile.existsSync() && (destinationFile.lengthSync() > 0)) {- logger.warning("Destination file already exists and is not empty");- throw Exception("Destination file already exists and is not empty");- }- final sourceFileLength = await sourceFile.length();- logger.info("Encrypting file of size " + sourceFileLength.toString());-- final inputFile = sourceFile.openSync(mode: FileMode.read);- final key = args["key"] ?? Sodium.cryptoSecretstreamXchacha20poly1305Keygen();- final initPushResult = Sodium.cryptoSecretstreamXchacha20poly1305InitPush(- key,- );- var bytesRead = 0;- var tag = Sodium.cryptoSecretstreamXchacha20poly1305TagMessage;- while (tag != Sodium.cryptoSecretstreamXchacha20poly1305TagFinal) {- final bool isLastChunk =- bytesRead + encryptionChunkSize >= sourceFileLength;- final int chunkSize = isLastChunk- ? (sourceFileLength - bytesRead)- : encryptionChunkSize;-- final buffer = BytesBuilder();- while (buffer.length < chunkSize) {- final remainingBytes = chunkSize - buffer.length;- final readBytes = await inputFile.read(remainingBytes);- if (readBytes.isEmpty) break;- buffer.add(readBytes);- }-- final bufferBytes = buffer.toBytes();- bytesRead += bufferBytes.length;- if (bufferBytes.length != chunkSize) {- throw Exception(- "V2 $kPartialReadErrorTag $chunkSize bytes, but got ${bufferBytes.length} bytes, sourceFileLength: $sourceFileLength",- );- }- if (isLastChunk) {- if (bytesRead == sourceFileLength) {- tag = Sodium.cryptoSecretstreamXchacha20poly1305TagFinal;- } else {- throw Exception(- "Expected $sourceFileLength bytes, but read $bytesRead bytes",- );- }- }- final encryptedData = Sodium.cryptoSecretstreamXchacha20poly1305Push(- initPushResult.state,- bufferBytes,- null,- tag,- );- await destinationFile.writeAsBytes(encryptedData, mode: FileMode.append);- }- await inputFile.close();-- logger.info(- "Encryption time: " +- (DateTime.now().millisecondsSinceEpoch - encryptionStartTime)- .toString(),- );-- return FileEncryptResult(key: key, header: initPushResult.header);-}-Future<FileEncryptResult> chachaEncryptFile(Map<String, dynamic> args) async {final encryptionStartTime = DateTime.now().millisecondsSinceEpoch;final logger = Logger("ChaChaEncryptV1");@@ -721,22 +648,6 @@ class CryptoUtil {.unwrapExceptionInComputer();}- static Future<FileEncryptResult> encryptFileV2(- String sourceFilePath,- String destinationFilePath, {- Uint8List? key,- }) {- final args = <String, dynamic>{};- args["sourceFilePath"] = sourceFilePath;- args["destinationFilePath"] = destinationFilePath;- args["key"] = key;- return _computer.compute(- chachaEncryptFileV2,- param: args,- taskName: "encryptFileV2",- );- }-static Future<FileEncryptResult> encryptFileWithMD5(String sourceFilePath,String destinationFilePath, {diff --git a/mobile/packages/logging/lib/super_logging.dart b/mobile/packages/logging/lib/super_logging.dartindex 5c162c5a8c..594000e445 100644--- a/mobile/packages/logging/lib/super_logging.dart+++ b/mobile/packages/logging/lib/super_logging.dart@@ -337,13 +337,4 @@ class SuperLogging {final pkgInfo = await PackageInfo.fromPlatform();return "${pkgInfo.version}+${pkgInfo.buildNumber}";}-- // disable sentry on f-droid. We need to make it opt-in preference- static Future<bool> isFDroidBuild() async {- if (!Platform.isAndroid) {- return false;- }- final pkgName = (await PackageInfo.fromPlatform()).packageName;- return pkgName.endsWith("fdroid");- }}