π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
chore(web): remove mobile dart changes from web PR branch
AmanRajSinghMourya7c1cdec3b433
diff --git a/mobile/apps/photos/lib/core/configuration.dart b/mobile/apps/photos/lib/core/configuration.dartindex 806caaeb86..486c8f0a26 100644--- a/mobile/apps/photos/lib/core/configuration.dart+++ b/mobile/apps/photos/lib/core/configuration.dart@@ -19,7 +19,6 @@ import 'package:photos/db/collections_db.dart';import 'package:photos/db/files_db.dart';import "package:photos/db/gallery_downloads_db.dart";import "package:photos/db/memories_db.dart";-import "package:photos/db/memory_shares_db.dart";import "package:photos/db/ml/db.dart";import 'package:photos/db/trash_db.dart';import 'package:photos/db/upload_locks_db.dart';@@ -212,6 +211,9 @@ class Configuration {}}+ // Reset feed cutoff so it is recreated for the next login session.+ await localSettings.clearSharedPhotoFeedCutoffTime();+// Clear preferences and secure storageawait _preferences.clear();await _secureStorage.deleteAll();@@ -230,7 +232,6 @@ class Configuration {await GalleryDownloadsDB.instance.clearTable();await CollectionsDB.instance.clearTable();await MemoriesDB.instance.clearTable();- await MemorySharesDB.instance.clearTable();await MLDataDB.instance.clearTable();await UploadLocksDB.instance.clearTable();await TrashDB.instance.clearTable();diff --git a/mobile/apps/photos/lib/db/memory_shares_db.dart b/mobile/apps/photos/lib/db/memory_shares_db.dartdeleted file mode 100644index 8e62dcded1..0000000000--- a/mobile/apps/photos/lib/db/memory_shares_db.dart+++ /dev/null@@ -1,165 +0,0 @@-import 'dart:io';--import 'package:path/path.dart';-import 'package:path_provider/path_provider.dart';-import 'package:photos/models/api/memory_share/memory_share.dart';-import 'package:sqflite/sqflite.dart';--class MemorySharesDB {- static const _databaseName = "ente.memory_shares.db";- static const _databaseVersion = 1;-- static const _table = 'memory_shares';-- static const _columnID = 'id';- static const _columnType = 'type';- static const _columnMetadataCipher = 'metadata_cipher';- static const _columnMetadataNonce = 'metadata_nonce';- static const _columnMemEncKey = 'mem_enc_key';- static const _columnMemKeyDecryptionNonce = 'mem_key_decryption_nonce';- static const _columnAccessToken = 'access_token';- static const _columnIsDeleted = 'is_deleted';- static const _columnCreatedAt = 'created_at';- static const _columnUpdatedAt = 'updated_at';- static const _columnUrl = 'url';- static const _columnMemoryHash = 'memory_hash';- static const _columnPreviewUploadedFileID = 'preview_uploaded_file_id';- static const _columnFileCount = 'file_count';-- MemorySharesDB._();- static final MemorySharesDB instance = MemorySharesDB._();-- static Future<Database>? _dbFuture;-- Future<Database> get database async {- _dbFuture ??= _initDatabase();- return _dbFuture!;- }-- Future<Database> _initDatabase() async {- final Directory documentsDirectory =- await getApplicationDocumentsDirectory();- final String path = join(documentsDirectory.path, _databaseName);- return await openDatabase(- path,- version: _databaseVersion,- onCreate: _onCreate,- );- }-- Future<void> _onCreate(Database db, int version) async {- await db.execute('''- CREATE TABLE $_table (- $_columnID INTEGER PRIMARY KEY NOT NULL,- $_columnType TEXT NOT NULL,- $_columnMetadataCipher TEXT,- $_columnMetadataNonce TEXT,- $_columnMemEncKey TEXT NOT NULL,- $_columnMemKeyDecryptionNonce TEXT NOT NULL,- $_columnAccessToken TEXT NOT NULL,- $_columnIsDeleted INTEGER NOT NULL DEFAULT 0,- $_columnCreatedAt INTEGER NOT NULL,- $_columnUpdatedAt INTEGER,- $_columnUrl TEXT NOT NULL,- $_columnMemoryHash TEXT,- $_columnPreviewUploadedFileID INTEGER,- $_columnFileCount INTEGER- )- ''');- }-- Future<void> upsert(MemoryShare share) async {- final db = await database;- await db.insert(- _table,- _toRow(share),- conflictAlgorithm: ConflictAlgorithm.replace,- );- }-- Future<List<MemoryShare>> getAll() async {- final db = await database;- final rows = await db.query(- _table,- where: '$_columnIsDeleted = 0',- orderBy: '$_columnCreatedAt DESC',- );- return rows.map(_fromRow).toList();- }-- Future<MemoryShare?> getById(int id) async {- final db = await database;- final rows = await db.query(- _table,- where: '$_columnID = ?',- whereArgs: [id],- );- if (rows.isEmpty) return null;- return _fromRow(rows.first);- }-- Future<MemoryShare?> getByMemoryHash(String memoryHash) async {- final db = await database;- final rows = await db.query(- _table,- where: '$_columnMemoryHash = ? AND $_columnIsDeleted = 0',- whereArgs: [memoryHash],- orderBy: '$_columnCreatedAt DESC',- limit: 1,- );- if (rows.isEmpty) return null;- return _fromRow(rows.first);- }-- Future<void> delete(int id) async {- final db = await database;- await db.delete(- _table,- where: '$_columnID = ?',- whereArgs: [id],- );- }-- Future<void> clearTable() async {- final db = await database;- await db.delete(_table);- }-- Map<String, dynamic> _toRow(MemoryShare share) {- return {- _columnID: share.id,- _columnType: share.type.name,- _columnMetadataCipher: share.metadataCipher,- _columnMetadataNonce: share.metadataNonce,- _columnMemEncKey: share.encryptedKey,- _columnMemKeyDecryptionNonce: share.keyDecryptionNonce,- _columnAccessToken: share.accessToken,- _columnIsDeleted: share.isDeleted ? 1 : 0,- _columnCreatedAt: share.createdAt,- _columnUpdatedAt: share.updatedAt,- _columnUrl: share.url,- _columnMemoryHash: share.memoryHash,- _columnPreviewUploadedFileID: share.previewUploadedFileID,- _columnFileCount: share.fileCount,- };- }-- MemoryShare _fromRow(Map<String, dynamic> row) {- return MemoryShare(- id: row[_columnID] as int,- type: MemoryShareType.fromString(row[_columnType] as String),- metadataCipher: row[_columnMetadataCipher] as String?,- metadataNonce: row[_columnMetadataNonce] as String?,- encryptedKey: row[_columnMemEncKey] as String,- keyDecryptionNonce: row[_columnMemKeyDecryptionNonce] as String,- accessToken: row[_columnAccessToken] as String,- isDeleted: (row[_columnIsDeleted] as int) == 1,- createdAt: row[_columnCreatedAt] as int,- updatedAt: row[_columnUpdatedAt] as int?,- url: row[_columnUrl] as String,- memoryHash: row[_columnMemoryHash] as String?,- previewUploadedFileID: row[_columnPreviewUploadedFileID] as int?,- fileCount: row[_columnFileCount] as int?,- );- }-}diff --git a/mobile/apps/photos/lib/gateways/entity/models/type.dart b/mobile/apps/photos/lib/gateways/entity/models/type.dartindex 0fbb8aef89..71714d9f0c 100644--- a/mobile/apps/photos/lib/gateways/entity/models/type.dart+++ b/mobile/apps/photos/lib/gateways/entity/models/type.dart@@ -3,8 +3,7 @@ enum EntityType {person,cgroup,unknown,- smartAlbum,- memory;+ smartAlbum;bool get isZipped {switch (this) {@@ -26,8 +25,6 @@ enum EntityType {return "cgroup";case EntityType.smartAlbum:return "smart_album";- case EntityType.memory:- return "memory";case EntityType.unknown:return "unknown";}diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dartindex d9cd13e345..30549ae1a4 100644--- a/mobile/apps/photos/lib/main.dart+++ b/mobile/apps/photos/lib/main.dart@@ -37,7 +37,6 @@ import "package:photos/services/machine_learning/face_ml/person/person_service.dimport 'package:photos/services/machine_learning/ml_service.dart';import 'package:photos/services/machine_learning/semantic_search/semantic_search_service.dart';import 'package:photos/services/memory_lane/memory_lane_service.dart';-import 'package:photos/services/memory_share_service.dart';import "package:photos/services/notification_service.dart";import 'package:photos/services/push_service.dart';import 'package:photos/services/search_service.dart';@@ -279,7 +278,6 @@ Future<void> _init(bool isBackground, {String via = ''}) async {NetworkClient.instance.getDio(),packageInfo,);- await MemoryShareService.instance.init();_logger.info("UserService init $tlog");await UserService.instance.init();diff --git a/mobile/apps/photos/lib/models/api/memory_share/memory_share.dart b/mobile/apps/photos/lib/models/api/memory_share/memory_share.dartdeleted file mode 100644index b5fac3bb37..0000000000--- a/mobile/apps/photos/lib/models/api/memory_share/memory_share.dart+++ /dev/null@@ -1,140 +0,0 @@-enum MemoryShareType {- share,- lane;-- static MemoryShareType fromString(String value) {- switch (value) {- case 'lane':- return MemoryShareType.lane;- default:- return MemoryShareType.share;- }- }-}--class MemoryShare {- final int id;- final MemoryShareType type;- final String? metadataCipher;- final String? metadataNonce;- final String encryptedKey;- final String keyDecryptionNonce;- final String accessToken;- final bool isDeleted;- final int createdAt;- final int? updatedAt;- final String url;- final String? memoryHash;- final int? previewUploadedFileID;- final int? fileCount;-- MemoryShare({- required this.id,- required this.type,- this.metadataCipher,- this.metadataNonce,- required this.encryptedKey,- required this.keyDecryptionNonce,- required this.accessToken,- required this.isDeleted,- required this.createdAt,- this.updatedAt,- required this.url,- this.memoryHash,- this.previewUploadedFileID,- this.fileCount,- });-- factory MemoryShare.fromJson(Map<String, dynamic> json) {- return MemoryShare(- id: json['id'] as int,- type: MemoryShareType.fromString(json['type'] as String? ?? 'share'),- metadataCipher: json['metadataCipher'] as String?,- metadataNonce: json['metadataNonce'] as String?,- encryptedKey: json['encryptedKey'] as String,- keyDecryptionNonce: json['keyDecryptionNonce'] as String,- accessToken: json['accessToken'] as String,- isDeleted: json['isDeleted'] as bool? ?? false,- createdAt: json['createdAt'] as int,- updatedAt: json['updatedAt'] as int?,- url: json['url'] as String,- memoryHash: json['memoryHash'] as String?,- previewUploadedFileID: json['previewUploadedFileID'] as int?,- fileCount: json['fileCount'] as int?,- );- }-- MemoryShare copyWith({- int? id,- MemoryShareType? type,- String? metadataCipher,- String? metadataNonce,- String? encryptedKey,- String? keyDecryptionNonce,- String? accessToken,- bool? isDeleted,- int? createdAt,- int? updatedAt,- String? url,- String? memoryHash,- int? previewUploadedFileID,- int? fileCount,- }) {- return MemoryShare(- id: id ?? this.id,- type: type ?? this.type,- metadataCipher: metadataCipher ?? this.metadataCipher,- metadataNonce: metadataNonce ?? this.metadataNonce,- encryptedKey: encryptedKey ?? this.encryptedKey,- keyDecryptionNonce: keyDecryptionNonce ?? this.keyDecryptionNonce,- accessToken: accessToken ?? this.accessToken,- isDeleted: isDeleted ?? this.isDeleted,- createdAt: createdAt ?? this.createdAt,- updatedAt: updatedAt ?? this.updatedAt,- url: url ?? this.url,- memoryHash: memoryHash ?? this.memoryHash,- previewUploadedFileID:- previewUploadedFileID ?? this.previewUploadedFileID,- fileCount: fileCount ?? this.fileCount,- );- }-- Map<String, dynamic> toJson() {- return {- 'id': id,- 'type': type.name,- 'metadataCipher': metadataCipher,- 'metadataNonce': metadataNonce,- 'encryptedKey': encryptedKey,- 'keyDecryptionNonce': keyDecryptionNonce,- 'accessToken': accessToken,- 'isDeleted': isDeleted,- 'createdAt': createdAt,- 'updatedAt': updatedAt,- 'url': url,- 'memoryHash': memoryHash,- 'previewUploadedFileID': previewUploadedFileID,- 'fileCount': fileCount,- };- }-}--class MemoryShareFileItem {- final int fileID;- final String encryptedKey;- final String keyDecryptionNonce;-- MemoryShareFileItem({- required this.fileID,- required this.encryptedKey,- required this.keyDecryptionNonce,- });-- Map<String, dynamic> toJson() {- return {- 'fileID': fileID,- 'encryptedKey': encryptedKey,- 'keyDecryptionNonce': keyDecryptionNonce,- };- }-}diff --git a/mobile/apps/photos/lib/services/memory_share_service.dart b/mobile/apps/photos/lib/services/memory_share_service.dartdeleted file mode 100644index e12d9f1f68..0000000000--- a/mobile/apps/photos/lib/services/memory_share_service.dart+++ /dev/null@@ -1,580 +0,0 @@-import 'dart:convert';-import 'dart:math';-import 'dart:typed_data';--import 'package:crypto/crypto.dart';-import 'package:dio/dio.dart';-import 'package:ente_crypto/ente_crypto.dart';-import "package:logging/logging.dart";-import 'package:photos/core/network/network.dart';-import "package:photos/db/files_db.dart";-import 'package:photos/db/memory_shares_db.dart';-import "package:photos/gateways/entity/models/type.dart";-import 'package:photos/models/api/memory_share/memory_share.dart';-import 'package:photos/models/file/file.dart';-import 'package:photos/models/memories/memory.dart';-import "package:photos/models/metadata/file_magic.dart";-import 'package:photos/service_locator.dart' show entityService;-import 'package:photos/utils/file_key.dart';--class MemoryShareService {- MemoryShareService._();-- static final MemoryShareService instance = MemoryShareService._();-- final Logger _logger = Logger("MemoryShareService");-- static const int _shortFragmentSecretLength = 12;- static const int _maxMemoryShareFiles = 30;- static final RegExp _base62SecretPattern = RegExp(r'^[0-9A-Za-z]{12}$');-- late final Dio _enteDio;- late final MemorySharesDB _db;- final Map<String, MemoryShare> _memoryShareByHashCache = {};-- Future<void> init() async {- _enteDio = NetworkClient.instance.enteDio;- _db = MemorySharesDB.instance;- await _loadMemoryShareHashCache();- }-- Future<(String, int)> _createMemoryLink({- required List<EnteFile> files,- required String title,- String? memoryHash,- }) async {- List<EnteFile> uploadedFiles = const [];- try {- uploadedFiles = files.where((f) => f.uploadedFileID != null).toList();-- if (uploadedFiles.isEmpty) {- throw Exception("No uploaded files to share");- }- final resolvedMemoryHash = memoryHash ?? _getMemoryHash(uploadedFiles);-- final secretPayload = await _prepareShareSecret();- final shareKey = secretPayload.shareKey;-- final metadata = jsonEncode({'name': title});- final metadataBytes = utf8.encode(metadata);- final encryptedMetadata = CryptoUtil.encryptSync(- Uint8List.fromList(metadataBytes),- shareKey,- );-- final fileItems = <Map<String, dynamic>>[];- for (final file in uploadedFiles) {- final fileKey = getFileKey(file);- final reEncryptedKey = CryptoUtil.encryptSync(fileKey, shareKey);- fileItems.add({- 'fileID': file.uploadedFileID,- 'encryptedKey': CryptoUtil.bin2base64(reEncryptedKey.encryptedData!),- 'keyDecryptionNonce': CryptoUtil.bin2base64(reEncryptedKey.nonce!),- });- }-- final requestData = {- 'metadataCipher':- CryptoUtil.bin2base64(encryptedMetadata.encryptedData!),- 'metadataNonce': CryptoUtil.bin2base64(encryptedMetadata.nonce!),- ...secretPayload.metadata(),- 'memoryHash': resolvedMemoryHash,- 'files': fileItems,- };-- final response = await _enteDio.post('/memory-share', data: requestData);- final memoryShare = MemoryShare.fromJson(response.data['memoryShare']);-- final shareUrl = "${memoryShare.url}#${secretPayload.secret}";- final localShare = memoryShare.copyWith(- url: shareUrl,- memoryHash: resolvedMemoryHash,- previewUploadedFileID: uploadedFiles.first.uploadedFileID,- fileCount: uploadedFiles.length,- );- await _db.upsert(localShare);- _updateMemoryShareCache(localShare);-- return (shareUrl, memoryShare.id);- } catch (e, s) {- _logger.severe("Failed to create memory share", e, s);-- rethrow;- }- }-- Future<List<MemoryShare>> listMemoryShares() async {- try {- final response = await _enteDio.get('/memory-share');- final List<dynamic> shares = response.data['memoryShares'] ?? [];- Uint8List? memoryEntityKey;- try {- memoryEntityKey = await entityService.getOrCreateEntityKey(- EntityType.memory,- );- } catch (e, s) {- _logger.severe(- "Failed to get memory entity key while listing memory shares",- e,- s,- );- memoryEntityKey = null;- }- final result = shares.map((s) {- var share = MemoryShare.fromJson(s as Map<String, dynamic>);- final entityKey = memoryEntityKey;- if (entityKey != null) {- final fragment = Uri.parse(share.url).fragment;- if (fragment.isEmpty) {- final resolvedFragment = _resolveFragmentSecret(share, entityKey);- if (resolvedFragment != null && resolvedFragment.isNotEmpty) {- share = share.copyWith(url: "${share.url}#$resolvedFragment");- }- }- }- return share;- }).toList();-- for (final share in result) {- final localShare = await _db.getById(share.id);- final mergedShare = share.copyWith(- memoryHash: share.memoryHash ?? localShare?.memoryHash,- previewUploadedFileID: localShare?.previewUploadedFileID,- fileCount: localShare?.fileCount,- );- await _db.upsert(mergedShare);- _updateMemoryShareCache(mergedShare);- }-- return result;- } catch (e, s) {- _logger.severe("Failed to list memory shares", e, s);- rethrow;- }- }-- Future<List<MemoryShare>> getLocalMemoryShares() async {- return _db.getAll();- }-- Future<List<EnteFile>> getPublicMemoryFiles(String shareUrl) async {- try {- final uri = Uri.parse(shareUrl);- final accessToken = _extractAccessToken(uri);- final shareKey = _resolveShareKeyFromUrlFragment(uri.fragment);- final response = await _enteDio.get(- '/public-memory/files',- options: Options(- headers: {'X-Auth-Access-Token': accessToken},- ),- );- final rawFiles = response.data['files'] as List<dynamic>? ?? const [];- final files = <EnteFile>[];- for (final rawFile in rawFiles) {- final localFile = await _resolveLocalFileFromShareItem(rawFile);- if (localFile != null) {- files.add(localFile);- continue;- }- final file = await _parsePublicMemoryFile(rawFile, shareKey);- if (file != null) {- files.add(file);- }- }- return files;- } catch (e, s) {- _logger.severe("Failed to fetch public memory files", e, s);- rethrow;- }- }-- Future<EnteFile?> _resolveLocalFileFromShareItem(dynamic rawFile) async {- final item = _toMap(rawFile);- final remoteFile = _toMap(item?['file']);- if (remoteFile == null) {- return null;- }- final fileID = _toInt(remoteFile['id']);- if (fileID == null) {- return null;- }- return FilesDB.instance.getAnyUploadedFile(fileID);- }-- String? getMemoryShareTitle(MemoryShare share) {- try {- final metadataCipher = share.metadataCipher;- final metadataNonce = share.metadataNonce;- if (metadataCipher == null || metadataNonce == null) {- return null;- }- final fragment = Uri.parse(share.url).fragment;- if (fragment.isEmpty) {- return null;- }- final shareKey = _resolveShareKeyFromUrlFragment(fragment);- final decryptedMetadata = CryptoUtil.decryptSync(- CryptoUtil.base642bin(metadataCipher),- shareKey,- CryptoUtil.base642bin(metadataNonce),- );- final parsed = jsonDecode(utf8.decode(decryptedMetadata));- if (parsed is! Map<String, dynamic>) {- return null;- }- final name = parsed["name"];- if (name is String && name.trim().isNotEmpty) {- return name;- }- return null;- } catch (e, s) {- _logger.severe(- "Failed to read memory share title for share ${share.id}",- e,- s,- );- return null;- }- }-- Future<void> deleteMemoryShare(int shareID) async {- try {- await _enteDio.delete('/memory-share/$shareID');- await _db.delete(shareID);- _removeMemoryShareFromCache(shareID);- } catch (e, s) {- _logger.severe("Failed to delete memory share $shareID", e, s);- rethrow;- }- }-- Future<EnteFile?> _parsePublicMemoryFile(- dynamic rawFile,- Uint8List shareKey,- ) async {- final item = _toMap(rawFile);- final remoteFile = _toMap(item?['file']);- if (item == null || remoteFile == null) {- return null;- }- try {- final file = EnteFile();- file.uploadedFileID = _toInt(remoteFile['id']);- file.collectionID = _toInt(remoteFile['collectionID']);- file.ownerID = _toInt(remoteFile['ownerID']);- // /public-memory/files returns per-share re-encrypted key material at the- // top level. Fall back to nested fields for compatibility.- file.encryptedKey = item['encryptedKey'] as String? ??- remoteFile['encryptedKey'] as String?;- file.keyDecryptionNonce = item['keyDecryptionNonce'] as String? ??- remoteFile['keyDecryptionNonce'] as String?;- final collectionAddedAt = _toInt(remoteFile['collectionAddedAt']);- if (collectionAddedAt != null) {- file.addedTime = collectionAddedAt;- }-- final fileData = _toMap(remoteFile['file']);- final thumbnailData = _toMap(remoteFile['thumbnail']);- final metadataData = _toMap(remoteFile['metadata']);- if (fileData == null || thumbnailData == null || metadataData == null) {- return null;- }-- file.fileDecryptionHeader = fileData['decryptionHeader'] as String?;- file.thumbnailDecryptionHeader =- thumbnailData['decryptionHeader'] as String?;- file.metadataDecryptionHeader =- metadataData['decryptionHeader'] as String?;-- final info = _toMap(remoteFile['info']);- if (info != null) {- file.fileSize = _toInt(info['fileSize']);- }-- if (file.encryptedKey == null ||- file.keyDecryptionNonce == null ||- file.metadataDecryptionHeader == null) {- return null;- }-- final encryptedMetadata = metadataData['encryptedData'] as String?;- if (encryptedMetadata == null) {- return null;- }-- final fileKey = CryptoUtil.decryptSync(- CryptoUtil.base642bin(file.encryptedKey!),- shareKey,- CryptoUtil.base642bin(file.keyDecryptionNonce!),- );- final encodedMetadata = await CryptoUtil.decryptChaCha(- CryptoUtil.base642bin(encryptedMetadata),- fileKey,- CryptoUtil.base642bin(file.metadataDecryptionHeader!),- );- final decodedMetadata = jsonDecode(utf8.decode(encodedMetadata));- if (decodedMetadata is! Map) {- return null;- }- file.applyMetadata(Map<String, dynamic>.from(decodedMetadata));-- final pubMagicMetadata = _toMap(remoteFile['pubMagicMetadata']);- if (pubMagicMetadata != null) {- final data = pubMagicMetadata['data'] as String?;- final header = pubMagicMetadata['header'] as String?;- if (data != null && header != null) {- final utfEncodedMmd = await CryptoUtil.decryptChaCha(- CryptoUtil.base642bin(data),- fileKey,- CryptoUtil.base642bin(header),- );- file.pubMmdEncodedJson = utf8.decode(utfEncodedMmd);- file.pubMmdVersion = _toInt(pubMagicMetadata['version']) ?? 0;- file.pubMagicMetadata =- PubMagicMetadata.fromEncodedJson(file.pubMmdEncodedJson!);- }- }-- file.localID = null;- if ((file.collectionID ?? 0) <= 0) {- return null;- }- return file;- } catch (e, s) {- _logger.warning("Failed to parse public memory file", e, s);- return null;- }- }-- Future<_MemoryShareSecretPayload> _prepareShareSecret() async {- try {- final memoryEntityKey =- await entityService.getOrCreateEntityKey(EntityType.memory);- final secret = _generateBase62Secret(_shortFragmentSecretLength);- final shareKey = _deriveShareKeyFromSecret(secret);- final encryptedSecret = CryptoUtil.encryptSync(- Uint8List.fromList(utf8.encode(secret)),- memoryEntityKey,- );- return _MemoryShareSecretPayload(- secret: secret,- shareKey: shareKey,- encryptedShareSecret:- CryptoUtil.bin2base64(encryptedSecret.encryptedData!),- encryptedShareSecretNonce:- CryptoUtil.bin2base64(encryptedSecret.nonce!),- );- } catch (e, s) {- _logger.severe("Failed to prepare memory share secret", e, s);- rethrow;- }- }-- String? _resolveFragmentSecret(- MemoryShare share,- Uint8List memoryEntityKey,- ) {- try {- final decrypted = CryptoUtil.decryptSync(- CryptoUtil.base642bin(share.encryptedKey),- memoryEntityKey,- CryptoUtil.base642bin(share.keyDecryptionNonce),- );- return _tryDecodeShortFragmentSecret(decrypted);- } catch (e, s) {- _logger.severe(- "Failed to resolve memory share fragment secret for share ${share.id}",- e,- s,- );- return null;- }- }-- String? _tryDecodeShortFragmentSecret(Uint8List value) {- if (value.length != _shortFragmentSecretLength) {- return null;- }- try {- final secret = utf8.decode(value);- if (_base62SecretPattern.hasMatch(secret)) {- return secret;- }- } catch (e, s) {- _logger.severe("Failed to decode memory share fragment secret", e, s);- return null;- }- return null;- }-- Uint8List _resolveShareKeyFromUrlFragment(String fragment) {- if (!_base62SecretPattern.hasMatch(fragment)) {- throw const FormatException("Invalid memory share fragment");- }- return _deriveShareKeyFromSecret(fragment);- }-- Uint8List _deriveShareKeyFromSecret(String secret) {- final digest = sha256.convert(utf8.encode(secret));- return Uint8List.fromList(digest.bytes);- }-- String _generateBase62Secret(int length) {- const charset =- "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";- final random = Random.secure();- final buffer = StringBuffer();- for (var i = 0; i < length; i++) {- buffer.write(charset[random.nextInt(charset.length)]);- }- return buffer.toString();- }-- String _extractAccessToken(Uri uri) {- final tokenFromQuery = uri.queryParameters["t"];- if (tokenFromQuery != null && tokenFromQuery.isNotEmpty) {- return tokenFromQuery;- }- for (final segment in uri.pathSegments) {- if (segment.isNotEmpty && segment != "memory") {- return segment;- }- }- throw const FormatException("Invalid memory share URL");- }-- Map<String, dynamic>? _toMap(dynamic value) {- if (value is Map<String, dynamic>) {- return value;- }- if (value is Map) {- return Map<String, dynamic>.from(value);- }- return null;- }-- int? _toInt(dynamic value) {- if (value is int) {- return value;- }- if (value is num) {- return value.toInt();- }- if (value is String) {- return int.tryParse(value);- }- return null;- }-- Future<(String, int)> getOrCreateMemoryLink({- required List<Memory> memories,- required String title,- }) async {- try {- final files = Memory.filesFromMemories(memories);- final filesForShare = files.take(_maxMemoryShareFiles).toList();- final memoryHash = _getMemoryHash(filesForShare);- final existingShare = await _findMemoryShareByHash(memoryHash);- if (existingShare != null &&- Uri.parse(existingShare.url).fragment.isNotEmpty) {- return (existingShare.url, existingShare.id);- }- return _createMemoryLink(- files: filesForShare,- title: title,- memoryHash: memoryHash,- );- } catch (e, s) {- _logger.severe("Failed to create memory share link data", e, s);- rethrow;- }- }-- Future<MemoryShare?> _findMemoryShareByHash(String memoryHash) async {- final cachedShare = _memoryShareByHashCache[memoryHash];- if (cachedShare != null && !cachedShare.isDeleted) {- return cachedShare;- }-- try {- final remoteShares = await listMemoryShares();- for (final share in remoteShares) {- if (!share.isDeleted && share.memoryHash == memoryHash) {- _updateMemoryShareCache(share);- return share;- }- }- } catch (e, s) {- _logger.warning(- "Failed to refresh memory-share hash cache while resolving memory hash",- e,- s,- );- }-- return null;- }-- Future<void> _loadMemoryShareHashCache() async {- _memoryShareByHashCache.clear();- final shares = await _db.getAll();- for (final share in shares) {- _updateMemoryShareCache(share);- }- }-- void _updateMemoryShareCache(MemoryShare share) {- final hash = share.memoryHash;- if (hash == null || hash.isEmpty) {- return;- }- if (share.isDeleted) {- final existing = _memoryShareByHashCache[hash];- if (existing != null && existing.id == share.id) {- _memoryShareByHashCache.remove(hash);- }- return;- }- final existing = _memoryShareByHashCache[hash];- if (existing == null || share.createdAt >= existing.createdAt) {- _memoryShareByHashCache[hash] = share;- }- }-- void _removeMemoryShareFromCache(int shareID) {- _memoryShareByHashCache.removeWhere((_, share) => share.id == shareID);- }-- String _getMemoryHash(List<EnteFile> files) {- final uploadedFileIDs =- files.map((file) => file.uploadedFileID).whereType<int>().toList();- if (uploadedFileIDs.isEmpty) {- throw Exception("No uploaded files to share");- }- final uniqueSortedFileIDs = uploadedFileIDs.toSet().toList()..sort();- final hashInput =- "${uploadedFileIDs.length}:${uniqueSortedFileIDs.length}:${uniqueSortedFileIDs.join(',')}";- return sha256.convert(utf8.encode(hashInput)).toString();- }-}--class _MemoryShareSecretPayload {- final String secret;- final Uint8List shareKey;- final String encryptedShareSecret;- final String encryptedShareSecretNonce;-- const _MemoryShareSecretPayload({- required this.secret,- required this.shareKey,- required this.encryptedShareSecret,- required this.encryptedShareSecretNonce,- });-- Map<String, dynamic> metadata() {- return {- 'encryptedKey': encryptedShareSecret,- 'keyDecryptionNonce': encryptedShareSecretNonce,- };- }-}diff --git a/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart b/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dartindex 36b479f3a6..7c92eba1f5 100644--- a/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart+++ b/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart@@ -6,37 +6,26 @@ import "dart:ui";import "package:ente_pure_utils/ente_pure_utils.dart";import "package:flutter/cupertino.dart";import "package:flutter/material.dart";-import "package:flutter/services.dart";-import "package:hugeicons/hugeicons.dart";import "package:photos/core/configuration.dart";import "package:photos/core/event_bus.dart";import "package:photos/events/details_sheet_event.dart";import "package:photos/events/pause_video_event.dart";import "package:photos/events/reset_zoom_of_photo_view_event.dart";import "package:photos/events/resume_video_event.dart";-import "package:photos/generated/l10n.dart";import "package:photos/models/file/file_type.dart";import "package:photos/models/memories/memory.dart";import "package:photos/service_locator.dart";-import "package:photos/services/memory_share_service.dart";import "package:photos/services/smart_memories_service.dart";import "package:photos/theme/colors.dart";import "package:photos/theme/ente_theme.dart";import "package:photos/theme/text_style.dart";import "package:photos/ui/actions/file/file_actions.dart";-import "package:photos/ui/components/alert_bottom_sheet.dart";-import "package:photos/ui/components/base_bottom_sheet.dart";-import "package:photos/ui/components/buttons/button_widget_v2.dart";-import "package:photos/ui/components/menu_item_widget/menu_item_widget_new.dart";-import "package:photos/ui/components/settings/settings_grouped_card.dart";import "package:photos/ui/home/memories/custom_listener.dart";import "package:photos/ui/home/memories/memory_progress_indicator.dart";-import "package:photos/ui/notification/toast.dart";import "package:photos/ui/viewer/file/file_widget.dart";import "package:photos/ui/viewer/file/thumbnail_widget.dart";import "package:photos/ui/viewer/file_details/favorite_widget.dart";import "package:photos/ui/viewer/gallery/jump_to_date_gallery.dart";-import "package:photos/utils/dialog_util.dart";import "package:photos/utils/file_util.dart";import "package:photos/utils/share_util.dart";@@ -163,9 +152,8 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {final _showTitle = ValueNotifier<bool>(true);AnimationController? _progressAnimationController;AnimationController? _zoomAnimationController;- final ValueNotifier<Duration> durationNotifier = ValueNotifier(- const Duration(seconds: 5),- );+ final ValueNotifier<Duration> durationNotifier =+ ValueNotifier(const Duration(seconds: 5));/// Used to check if any pointer is on the screen.final hasPointerOnScreenNotifier = ValueNotifier<bool>(false);@@ -181,23 +169,24 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {Future.delayed(const Duration(seconds: 3), () {if (mounted) _showTitle.value = false;});- hasPointerOnScreenNotifier.addListener(_hasPointerListener);-- _detailSheetEventSubscription = Bus.instance.on<DetailsSheetEvent>().listen(- (event) {- final inheritedData = FullScreenMemoryData.of(context);- if (inheritedData == null) return;- final index = inheritedData.indexNotifier.value;- final currentFile = inheritedData.memories[index].file;-- if (event.isSameFile(- uploadedFileID: currentFile.uploadedFileID,- localID: currentFile.localID,- )) {- _toggleAnimation(pause: event.opened);- }- },+ hasPointerOnScreenNotifier.addListener(+ _hasPointerListener,);++ _detailSheetEventSubscription =+ Bus.instance.on<DetailsSheetEvent>().listen((event) {+ final inheritedData = FullScreenMemoryData.of(context);+ if (inheritedData == null) return;+ final index = inheritedData.indexNotifier.value;+ final currentFile = inheritedData.memories[index].file;++ if (event.isSameFile(+ uploadedFileID: currentFile.uploadedFileID,+ localID: currentFile.localID,+ )) {+ _toggleAnimation(pause: event.opened);+ }+ });}@override@@ -317,12 +306,17 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {final showStepProgressIndicator = inheritedData.memories.length < 60;return Padding(- padding: const EdgeInsets.symmetric(horizontal: 4.0),+ padding: const EdgeInsets.symmetric(+ horizontal: 4.0,+ ),child: SafeArea(child: Container(decoration: BoxDecoration(borderRadius: BorderRadius.circular(16),- border: Border.all(color: strokeFainterDark, width: 1),+ border: Border.all(+ color: strokeFainterDark,+ width: 1,+ ),),child: ClipRRect(borderRadius: BorderRadius.circular(16),@@ -339,7 +333,11 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {onTap: () => Navigator.pop(context),child: const Padding(padding: EdgeInsets.fromLTRB(4, 8, 8, 8),- child: Icon(Icons.close, color: Colors.white, size: 20),+ child: Icon(+ Icons.close,+ color: Colors.white,+ size: 20,+ ),),),builder: (context, value, child) {@@ -355,9 +353,8 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {totalSteps: inheritedData.memories.length,currentIndex: value,selectedColor: Colors.white,- unselectedColor: Colors.white.withValues(- alpha: 0.4,- ),+ unselectedColor:+ Colors.white.withValues(alpha: 0.4),duration: duration,animationController: (controller) {_progressAnimationController = controller;@@ -378,7 +375,9 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {final fullScreenState =context.findAncestorStateOfType<_FullScreenMemoryState>();- fullScreenState?._toggleAnimation(pause: true);+ fullScreenState?._toggleAnimation(+ pause: true,+ );Bus.instance.fire(PauseVideoEvent());await routeToPage(context,@@ -388,7 +387,9 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {),);Bus.instance.fire(ResumeVideoEvent());- fullScreenState?._toggleAnimation(pause: false);+ fullScreenState?._toggleAnimation(+ pause: false,+ );},child: Container(decoration: BoxDecoration(@@ -428,7 +429,6 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {),),),- const Spacer(),],),],@@ -495,9 +495,8 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {currentFile,autoPlay: false,tagPrefix: "memories",- backgroundDecoration: const BoxDecoration(- color: Colors.transparent,- ),+ backgroundDecoration:+ const BoxDecoration(color: Colors.transparent),isFromMemories: true,playbackCallback: (shouldEnable, _) {_toggleAnimation(pause: !shouldEnable);@@ -609,7 +608,9 @@ class BottomIcons extends StatelessWidget {onFileRemoved: (file) => {inheritedData.removeCurrentMemory.call(),if (inheritedData.memories.isEmpty)- {Navigator.of(context).pop()},+ {+ Navigator.of(context).pop(),+ },},);fullScreenState?._toggleAnimation(pause: false);@@ -618,7 +619,10 @@ class BottomIcons extends StatelessWidget {]);if (!isOfflineMode) {rowChildren.add(- SizedBox(height: 32, child: FavoriteWidget(currentFile)),+ SizedBox(+ height: 32,+ child: FavoriteWidget(currentFile),+ ),);}}@@ -630,11 +634,12 @@ class BottomIcons extends StatelessWidget {),onPressed: () async {fullScreenState?._toggleAnimation(pause: true);- await _showMemoryShareSheet(context, inheritedData);+ await share(context, [currentFile]);fullScreenState?._toggleAnimation(pause: false);},),);+return Container(alignment: Alignment.bottomCenter,padding: const EdgeInsets.fromLTRB(12, 0, 12, 16),@@ -719,7 +724,10 @@ class _MemoryBlur extends StatelessWidget {switchOutCurve: Curves.easeInExpo,child: ImageFiltered(key: ValueKey(inheritedData.indexNotifier.value),- imageFilter: ImageFilter.blur(sigmaX: 100, sigmaY: 100),+ imageFilter: ImageFilter.blur(+ sigmaX: 100,+ sigmaY: 100,+ ),child: ThumbnailWidget(currentFile,shouldShowSyncStatus: false,@@ -767,7 +775,9 @@ class _MemoriesZoomWidgetState extends State<MemoriesZoomWidget>void _initAnimation() {_controller = AnimationController(vsync: this,- duration: const Duration(seconds: 5),+ duration: const Duration(+ seconds: 5,+ ),animationBehavior: AnimationBehavior.preserve,);@@ -782,12 +792,22 @@ class _MemoriesZoomWidgetState extends State<MemoriesZoomWidget>_scaleAnimation = Tween<double>(begin: startScale,end: endScale,- ).animate(CurvedAnimation(parent: _controller, curve: Curves.easeInOut));+ ).animate(+ CurvedAnimation(+ parent: _controller,+ curve: Curves.easeInOut,+ ),+ );_panAnimation = Tween<Offset>(begin: Offset(startX, startY),end: Offset(endX, endY),- ).animate(CurvedAnimation(parent: _controller, curve: Curves.easeInOut));+ ).animate(+ CurvedAnimation(+ parent: _controller,+ curve: Curves.easeInOut,+ ),+ );if (widget.scaleController != null) {widget.scaleController!(_controller);@@ -824,214 +844,3 @@ class _MemoriesZoomWidgetState extends State<MemoriesZoomWidget>);}}--Future<void> _showMemoryShareSheet(- BuildContext context,- FullScreenMemoryData inheritedData,-) async {- final l10n = AppLocalizations.of(context);- final canShowMemoryShareLinkOption = flagService.enableMemoryShareLink &&- !(isOfflineMode && !Configuration.instance.hasConfiguredAccount());- final shouldShareLink = await showBaseBottomSheet<bool>(- context,- backgroundColor: getEnteColorScheme(context).backgroundColour,- padding: const EdgeInsets.all(16),- title: l10n.shareMemory,- child: Builder(- builder: (context) {- final colorScheme = getEnteColorScheme(context);- return SettingsGroupedCard(- children: [- if (canShowMemoryShareLinkOption)- MenuItemWidgetNew(- title: l10n.shareALinkToThisMemory,- trailingWidget: HugeIcon(- icon: HugeIcons.strokeRoundedLink02,- color: colorScheme.textBase,- size: 20,- ),- borderRadius: 0,- onTap: () async {- Navigator.of(context).pop(true);- },- ),- MenuItemWidgetNew(- title: l10n.shareThisPhoto,- trailingWidget: HugeIcon(- icon: HugeIcons.strokeRoundedShare04,- color: colorScheme.textBase,- size: 20,- ),- borderRadius: 0,- onTap: () async {- Navigator.of(context).pop(false);- },- ),- ],- );- },- ),- );- if (!context.mounted || shouldShareLink == null) {- return;- }-- if (shouldShareLink) {- await _showMemoryLinkDetailsSheet(context, inheritedData);- return;- }-- final currentFile =- inheritedData.memories[inheritedData.indexNotifier.value].file;- await share(context, [currentFile]);-}--Future<void> _showMemoryLinkDetailsSheet(- BuildContext context,- FullScreenMemoryData inheritedData,-) async {- final shareLinkData = await _getOrCreateMemoryLink(- context,- inheritedData,- );- if (!context.mounted || shareLinkData == null) {- return;- }- final shareUrl = shareLinkData.$1;- final int shareId = shareLinkData.$2;-- final l10n = AppLocalizations.of(context);- await showBaseBottomSheet<void>(- context,- title: l10n.shareLink,- padding: const EdgeInsets.all(16),- child: Builder(- builder: (context) {- final colorScheme = getEnteColorScheme(context);- final textTheme = getEnteTextTheme(context);- return Column(- crossAxisAlignment: CrossAxisAlignment.start,- mainAxisSize: MainAxisSize.min,- children: [- Text(l10n.memoryShareLinkDescription, style: textTheme.smallMuted),- const SizedBox(height: 14),- Container(- width: double.infinity,- decoration: BoxDecoration(- color: colorScheme.fillDark,- borderRadius: BorderRadius.circular(8),- ),- child: Stack(- children: [- Padding(- padding: const EdgeInsets.fromLTRB(12, 16, 44, 16),- child: SelectableText(shareUrl, style: textTheme.small),- ),- Positioned(- right: 0,- top: 0,- child: IconButton(- tooltip: l10n.copyLink,- iconSize: 20,- visualDensity: VisualDensity.compact,- onPressed: () async {- await Clipboard.setData(ClipboardData(text: shareUrl));- if (context.mounted) {- showShortToast(context, l10n.linkCopiedToClipboard);- }- },- icon: HugeIcon(- icon: HugeIcons.strokeRoundedCopy01,- color: colorScheme.textBase,- size: 20,- ),- ),- ),- ],- ),- ),- const SizedBox(height: 24),- ButtonWidgetV2(- buttonType: ButtonTypeV2.primary,- labelText: l10n.shareLink,- shouldSurfaceExecutionStates: false,- onTap: () async {- await shareText(shareUrl, context: context);- },- ),- const SizedBox(height: 16),- Center(- child: ButtonWidgetV2(- buttonType: ButtonTypeV2.critical,- labelText: l10n.deleteLink,- onTap: () async {- final shouldDelete = await showAlertBottomSheet<bool>(- context,- title: l10n.deleteLinkQuestion,- message: l10n.deleteMemoryLinkMessage,- assetPath: "assets/warning-grey.png",- buttons: [- ButtonWidgetV2(- buttonType: ButtonTypeV2.critical,- labelText: l10n.deleteLink,- onTap: () async {- try {- await MemoryShareService.instance.deleteMemoryShare(- shareId,- );- if (context.mounted) {- showShortToast(- context,- l10n.linkDeletedSuccessfully,- );- Navigator.of(context).pop(true);- }- } catch (e) {- if (context.mounted) {- showShortToast(context, l10n.somethingWentWrong);- Navigator.of(context).pop(false);- }- }- },- ),- ],- );- if (shouldDelete != true) {- return;- }- if (context.mounted) {- Navigator.of(context).pop();- }- },- ),- ),- ],- );- },- ),- );-}--Future<(String, int)?> _getOrCreateMemoryLink(- BuildContext context,- FullScreenMemoryData inheritedData,-) async {- final l10n = AppLocalizations.of(context);- final dialog = createProgressDialog(context, l10n.creatingLink);- await dialog.show();- try {- final shareLinkData =- await MemoryShareService.instance.getOrCreateMemoryLink(- memories: inheritedData.memories,- title: l10n.memories,- );- await dialog.hide();- return shareLinkData;- } catch (e) {- await dialog.hide();- if (context.mounted) {- await showGenericErrorBottomSheet(context: context, error: e);- }- return null;- }-}diff --git a/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart b/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dartdeleted file mode 100644index 4e967f1b8d..0000000000--- a/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart+++ /dev/null@@ -1,115 +0,0 @@-import "package:flutter/material.dart";-import "package:photos/db/files_db.dart";-import 'package:photos/models/file/file.dart';-import "package:photos/theme/ente_theme.dart";-import "package:photos/ui/components/buttons/icon_button_widget.dart";-import "package:photos/ui/viewer/file/no_thumbnail_widget.dart";-import "package:photos/ui/viewer/file/thumbnail_widget.dart";--class MemoryLinkAlbumItem extends StatelessWidget {- static const heroTagPrefix = "memory_link";- final String title;- final int? fileCount;- final int? previewUploadedFileID;-- const MemoryLinkAlbumItem({- super.key,- required this.title,- this.fileCount,- this.previewUploadedFileID,- });-- @override- Widget build(BuildContext context) {- final colorScheme = getEnteColorScheme(context);- final textTheme = getEnteTextTheme(context);-- return Container(- decoration: BoxDecoration(- border: Border.all(color: colorScheme.strokeFainter),- borderRadius: const BorderRadius.all(- Radius.circular(6),- ),- ),- child: Row(- mainAxisAlignment: MainAxisAlignment.spaceBetween,- children: [- Flexible(- flex: 6,- child: Row(- children: [- SizedBox(- width: 60,- height: 60,- child: FutureBuilder<EnteFile?>(- future: () {- final uploadedID = previewUploadedFileID;- if (uploadedID == null) {- return Future.value(null);- }- return FilesDB.instance.getAnyUploadedFile(uploadedID);- }(),- builder: (context, snapshot) {- if (snapshot.hasData && snapshot.data != null) {- final String heroTag =- heroTagPrefix + snapshot.data!.tag;- return Hero(- tag: heroTag,- child: ClipRRect(- borderRadius: BorderRadius.circular(4),- child: ThumbnailWidget(- snapshot.data!,- key: ValueKey(heroTag),- ),- ),- );- }- return const NoThumbnailWidget();- },- ),- ),- const SizedBox(width: 12),- Flexible(- child: Padding(- padding: const EdgeInsets.symmetric(vertical: 4),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- title,- overflow: TextOverflow.ellipsis,- ),- const SizedBox(height: 2),- Row(- children: [- Text(- (fileCount ?? 0).toString() + " \u2022 ",- style: textTheme.smallMuted,- ),- Icon(- Icons.link_outlined,- color: colorScheme.strokeMuted,- size: 22,- ),- ],- ),- ],- ),- ),- ),- ],- ),- ),- Flexible(- flex: 1,- child: IconButtonWidget(- icon: Icons.chevron_right_outlined,- iconButtonType: IconButtonType.secondary,- iconColor: colorScheme.blurStrokePressed,- ),- ),- ],- ),- );- }-}diff --git a/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart b/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dartindex 2667c8e4fd..993bbf2801 100644--- a/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart+++ b/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart@@ -13,10 +13,8 @@ import "model.dart";class FlagService {static const int _uploadV2Flag = 1 << 0;- static const int _commentsFlag = 1 << 1;static const int _backupOptionsFlag = 1 << 2;static const int _videoStreamingFlag = 1 << 3;- static const int _memoryShareLinkFlag = 1 << 4;final SharedPreferences _prefs;final Dio _enteDio;@@ -100,12 +98,6 @@ class FlagService {bool get enableShareePin => true;- bool get isSocialEnabled =>- internalUser || _isServerFlagEnabled(_commentsFlag);-- bool get enableMemoryShareLink =>- internalUser || _isServerFlagEnabled(_memoryShareLinkFlag);-bool get useRustForML => internalUser;bool get useRustForFaceThumbnails => internalUser;