Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Prune Photos utility comments

Manav Rathi858d54972b2f
diff --git a/mobile/apps/photos/lib/app_mode.dart b/mobile/apps/photos/lib/app_mode.dart
index 22efe10ca8..73d6a2825f 100644
--- a/mobile/apps/photos/lib/app_mode.dart
+++ b/mobile/apps/photos/lib/app_mode.dart
@@ -1,9 +1,3 @@
-/// Describes which photo library the app is centered around.
-///
-/// [enteGallery] is the signed-in Ente account experience, focused on photos
-/// backed up to Ente.
-///
-/// [localGallery] is the no-account local-device experience, focused on photos
-/// currently available on the device. This mode may still use the network for
-/// account setup, updates, model downloads, or other non-account-gallery flows.
+// Local gallery shows photos on the device without requiring an account. It may
+// still use the network for account setup, updates, and model downloads.
enum AppMode { enteGallery, localGallery }
diff --git a/mobile/apps/photos/lib/core/constants.dart b/mobile/apps/photos/lib/core/constants.dart
index 7ff7035551..8d1f0ae2d0 100644
--- a/mobile/apps/photos/lib/core/constants.dart
+++ b/mobile/apps/photos/lib/core/constants.dart
@@ -24,7 +24,6 @@ const photoGridSizeMin = 2;
const photoGridSizeMax = 6;
const subGalleryMultiplier = 10;
-// used to identify which ente file are available in app cache
const String sharedMediaIdentifier = 'ente-shared-media://';
const galleryThumbnailDiskLoadDeferDuration = Duration(milliseconds: 80);
@@ -36,7 +35,6 @@ const mediaManagementHintDeleteAttemptThreshold = 3;
// https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#Generating_the_mnemonic
const mnemonicKeyWordCount = 24;
-// https://stackoverflow.com/a/61162219
const dragSensitivity = 8;
const supportEmail = '[email protected]';
diff --git a/mobile/apps/photos/lib/core/error-reporting/isolate_logging.dart b/mobile/apps/photos/lib/core/error-reporting/isolate_logging.dart
index 76a4f7e8da..3266852dcf 100644
--- a/mobile/apps/photos/lib/core/error-reporting/isolate_logging.dart
+++ b/mobile/apps/photos/lib/core/error-reporting/isolate_logging.dart
@@ -59,12 +59,10 @@ class IsolateLogger {
Future onLogRecordInIsolate(LogRecord rec) async {
final str = rec.toPrettyString(null, true);
- // write to stdout
if (SuperLogging.shouldPrintLogRecord(rec)) {
SuperLogging.printLog(str);
}
- // push to log queue
fileQueueEntries.add(
IsolateLogString(
logString: str,
@@ -77,7 +75,7 @@ class IsolateLogger {
);
}
- /// WARNING: only call this from the isolate
+ // Only call from the isolate.
Queue<String> getLogStringsAndClear() {
if (fileQueueEntries.isEmpty) return Queue<String>();
final result = Queue<String>();
@@ -88,7 +86,7 @@ class IsolateLogger {
return result;
}
- /// WARNING: only call this from the main thread
+ // Only call from the main thread.
static void handLogStringsToMainLogger(List<String> logs) {
while (logs.isNotEmpty) {
final logString = logs.removeAt(0);
diff --git a/mobile/apps/photos/lib/core/error-reporting/tunneled_transport.dart b/mobile/apps/photos/lib/core/error-reporting/tunneled_transport.dart
index 32732a69d0..e8568e1dd9 100644
--- a/mobile/apps/photos/lib/core/error-reporting/tunneled_transport.dart
+++ b/mobile/apps/photos/lib/core/error-reporting/tunneled_transport.dart
@@ -3,7 +3,6 @@ import 'dart:convert';
import 'package:http/http.dart';
import 'package:sentry/sentry.dart';
-/// A transport is in charge of sending the event to the Sentry server.
class TunneledTransport implements Transport {
final Uri _tunnel;
final SentryOptions _options;
@@ -40,8 +39,7 @@ class TunneledTransport implements Transport {
.then(Response.fromStream);
if (response.statusCode != 200) {
- // body guard to not log the error as it has performance impact to allocate
- // the body String.
+ // Avoid allocating response.body unless debug logging is enabled.
if (_options.debug) {
_options.log(
SentryLevel.error,
@@ -129,8 +127,6 @@ class _CredentialBuilder {
Map<String, String> _buildHeaders(bool isWeb, String sdkIdentifier) {
final headers = {'Content-Type': 'application/x-sentry-envelope'};
- // NOTE(lejard_h) overriding user agent on VM and Flutter not sure why
- // for web it use browser user agent
if (!isWeb) {
headers['User-Agent'] = sdkIdentifier;
}
diff --git a/mobile/apps/photos/lib/core/exceptions.dart b/mobile/apps/photos/lib/core/exceptions.dart
index 7ffc72a2f4..5bf68616e6 100644
--- a/mobile/apps/photos/lib/core/exceptions.dart
+++ b/mobile/apps/photos/lib/core/exceptions.dart
@@ -1,10 +1,4 @@
-// Common runtime exceptions that can occur during normal app operation.
-// These are recoverable conditions that should be caught and handled.
-
-/// Marker for expected runtime conditions that are handled locally.
-///
-/// These may still be written to local logs, but should not be reported as app
-/// crashes.
+// Expected runtime errors may be logged, but should not be reported as crashes.
abstract interface class LocallyHandledError {}
class WidgetUnmountedException implements Exception {
diff --git a/mobile/apps/photos/lib/data/years.dart b/mobile/apps/photos/lib/data/years.dart
index 9adb4d3bc2..567bdc8ceb 100644
--- a/mobile/apps/photos/lib/data/years.dart
+++ b/mobile/apps/photos/lib/data/years.dart
@@ -4,7 +4,6 @@ class YearsData {
final List<YearData> yearsData = [];
YearsData._privateConstructor() {
for (int year = currentYear; year >= 1970; year--) {
- //appending from the latest year so that search results will show latest year first
yearsData.add(
YearData(year.toString(), [
DateTime(year).microsecondsSinceEpoch,
diff --git a/mobile/apps/photos/lib/emergency/model.dart b/mobile/apps/photos/lib/emergency/model.dart
index 90e6491891..836ccd6965 100644
--- a/mobile/apps/photos/lib/emergency/model.dart
+++ b/mobile/apps/photos/lib/emergency/model.dart
@@ -58,7 +58,6 @@ class EmergencyContact {
this.recoveryNoticeInDays,
);
- // copyWith
EmergencyContact copyWith({
User? user,
User? emergencyContact,
@@ -73,7 +72,6 @@ class EmergencyContact {
);
}
- // fromJson
EmergencyContact.fromJson(Map<String, dynamic> json)
: user = User.fromMap(json['user']),
emergencyContact = User.fromMap(json['emergencyContact']),
@@ -109,7 +107,6 @@ class EmergencyInfo {
this.othersRecoverySession,
);
- // from json
EmergencyInfo.fromJson(Map<String, dynamic> json)
: contacts = (json['contacts'] as List)
.map((contact) => EmergencyContact.fromJson(contact))
@@ -142,7 +139,6 @@ class RecoverySessions {
this.createdAt,
);
- // fromJson
RecoverySessions.fromJson(Map<String, dynamic> json)
: id = json['id'],
user = User.fromMap(json['user']),
diff --git a/mobile/apps/photos/lib/emergency/other_contact_page.dart b/mobile/apps/photos/lib/emergency/other_contact_page.dart
index d078348306..97e24a5123 100644
--- a/mobile/apps/photos/lib/emergency/other_contact_page.dart
+++ b/mobile/apps/photos/lib/emergency/other_contact_page.dart
@@ -14,9 +14,6 @@ import "package:photos/ui/components/buttons/button_widget_v2.dart";
import "package:photos/ui/components/title_bar_title_widget.dart";
import "package:photos/utils/dialog_util.dart";
-// OtherContactPage is used to start recovery process for other user's account
-// Based on the state of the contact & recovery session, it will show
-// different UI
class OtherContactPage extends StatefulWidget {
final EmergencyContact contact;
final EmergencyInfo emergencyInfo;
diff --git a/mobile/apps/photos/lib/emergency/recover_others_account.dart b/mobile/apps/photos/lib/emergency/recover_others_account.dart
index a67cae0d81..85518c5547 100644
--- a/mobile/apps/photos/lib/emergency/recover_others_account.dart
+++ b/mobile/apps/photos/lib/emergency/recover_others_account.dart
@@ -235,7 +235,6 @@ class _RecoverOthersAccountState extends State<RecoverOthersAccount> {
final KeyAttributes attributes = widget.attributes;
Uint8List? masterKey;
try {
- // Decrypt the master key that was earlier encrypted with the recovery key
masterKey = await CryptoUtil.decrypt(
CryptoUtil.base642bin(attributes.masterKeyEncryptedWithRecoveryKey!),
CryptoUtil.hex2bin(widget.recoveryKey),
@@ -246,15 +245,12 @@ class _RecoverOthersAccountState extends State<RecoverOthersAccount> {
rethrow;
}
- // Derive a key from the password that will be used to encrypt and
- // decrypt the master key
final kekSalt = CryptoUtil.getSaltToDeriveKey();
final derivedKeyResult = await CryptoUtil.deriveSensitiveKey(
utf8.encode(password),
kekSalt,
);
final loginKey = await CryptoUtil.deriveLoginKey(derivedKeyResult.key);
- // Encrypt the key with this derived key
final encryptedKeyData = CryptoUtil.encryptSync(
masterKey,
derivedKeyResult.key,
diff --git a/mobile/apps/photos/lib/ente_theme_data.dart b/mobile/apps/photos/lib/ente_theme_data.dart
index 51b66701a2..1ea88e41cf 100644
--- a/mobile/apps/photos/lib/ente_theme_data.dart
+++ b/mobile/apps/photos/lib/ente_theme_data.dart
@@ -42,7 +42,6 @@ final lightThemeData = ThemeData(
iconTheme: const IconThemeData(color: Colors.black),
elevation: 0,
),
- //https://api.flutter.dev/flutter/material/TextTheme-class.html
textTheme: _buildTextTheme(const Color.fromRGBO(0, 0, 0, 1)),
primaryTextTheme: const TextTheme().copyWith(
bodyMedium: const TextStyle(color: Colors.yellow),
@@ -50,7 +49,7 @@ final lightThemeData = ThemeData(
),
cardColor: const Color.fromRGBO(250, 250, 250, 1.0),
dialogTheme: const DialogThemeData(
- backgroundColor: Color.fromRGBO(250, 250, 250, 1.0), //
+ backgroundColor: Color.fromRGBO(250, 250, 250, 1.0),
titleTextStyle: TextStyle(
color: Colors.black,
fontSize: 24,
@@ -376,9 +375,9 @@ OutlinedButtonThemeData buildOutlinedButtonThemeData({
}
ElevatedButtonThemeData buildElevatedButtonThemeData({
- required Color onPrimary, // text button color
+ required Color onPrimary,
required Color primary,
- double elevation = 2, // background color of button
+ double elevation = 2,
}) {
return ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
diff --git a/mobile/apps/photos/lib/events/memories_setting_changed.dart b/mobile/apps/photos/lib/events/memories_setting_changed.dart
index cddd6f671a..0d1cb054e8 100644
--- a/mobile/apps/photos/lib/events/memories_setting_changed.dart
+++ b/mobile/apps/photos/lib/events/memories_setting_changed.dart
@@ -1,5 +1,4 @@
import "package:photos/events/event.dart";
// todo: consider removing this once we opt for riverpod or similar state management
-// solution
class MemoriesSettingChanged extends Event {}
diff --git a/mobile/apps/photos/lib/events/notification_event.dart b/mobile/apps/photos/lib/events/notification_event.dart
index 92aca5960e..99d325b050 100644
--- a/mobile/apps/photos/lib/events/notification_event.dart
+++ b/mobile/apps/photos/lib/events/notification_event.dart
@@ -1,5 +1,3 @@
import 'package:photos/events/event.dart';
-// NotificationEvent event is used to re-fresh the UI to show latest notification
-// (if any)
class NotificationEvent extends Event {}
diff --git a/mobile/apps/photos/lib/events/video_streaming_changed.dart b/mobile/apps/photos/lib/events/video_streaming_changed.dart
index 23d90b08b3..819348c4d8 100644
--- a/mobile/apps/photos/lib/events/video_streaming_changed.dart
+++ b/mobile/apps/photos/lib/events/video_streaming_changed.dart
@@ -1,5 +1,4 @@
import "package:photos/events/event.dart";
// todo: consider removing this once we opt for riverpod or similar state management
-// solution
class VideoStreamingChanged extends Event {}
diff --git a/mobile/apps/photos/lib/gateways/collections/models/public_url.dart b/mobile/apps/photos/lib/gateways/collections/models/public_url.dart
index a70442d74c..5afa854177 100644
--- a/mobile/apps/photos/lib/gateways/collections/models/public_url.dart
+++ b/mobile/apps/photos/lib/gateways/collections/models/public_url.dart
@@ -43,7 +43,6 @@ class PublicURL {
bool get hasExpiry => validTill != 0;
- // isExpired indicates whether the link has expired or not
bool get isExpired =>
hasExpiry && validTill < DateTime.now().microsecondsSinceEpoch;
diff --git a/mobile/apps/photos/lib/locale.dart b/mobile/apps/photos/lib/locale.dart
index 99c6127022..e5e434b795 100644
--- a/mobile/apps/photos/lib/locale.dart
+++ b/mobile/apps/photos/lib/locale.dart
@@ -1,7 +1,6 @@
import "package:flutter/widgets.dart";
import "package:shared_preferences/shared_preferences.dart";
-// list of locales which are enabled for photos app.
// Add more language to the list only when at least 90% of the strings are
// translated in the corresponding language.
const List<Locale> appSupportedLocales = <Locale>[
@@ -60,7 +59,6 @@ Locale localResolutionCallBack(
Future<Locale> getFormatLocale() async {
final Locale locale = (await getLocale())!;
Locale? firstLanguageMatch;
- // see if exact matche is present in the device locales
for (Locale deviceLocale in _onDeviceLocales) {
if (deviceLocale.languageCode == locale.languageCode &&
deviceLocale.countryCode == locale.countryCode) {
diff --git a/mobile/apps/photos/lib/models/account/two_factor.dart b/mobile/apps/photos/lib/models/account/two_factor.dart
index 45f7c8fde8..bebdbb27fe 100644
--- a/mobile/apps/photos/lib/models/account/two_factor.dart
+++ b/mobile/apps/photos/lib/models/account/two_factor.dart
@@ -1,6 +1,5 @@
enum TwoFactorType { totp, passkey }
-// ToString for TwoFactorType
String twoFactorTypeToString(TwoFactorType type) {
switch (type) {
case TwoFactorType.totp:
diff --git a/mobile/apps/photos/lib/models/file/extensions/file_props.dart b/mobile/apps/photos/lib/models/file/extensions/file_props.dart
index 97cf061419..1f89f14c29 100644
--- a/mobile/apps/photos/lib/models/file/extensions/file_props.dart
+++ b/mobile/apps/photos/lib/models/file/extensions/file_props.dart
@@ -51,7 +51,6 @@ extension FilePropsExtn on EnteFile {
DeviceTrashFile? get asDeviceTrashFile =>
(this is DeviceTrashFile) ? this as DeviceTrashFile : null;
- // Return true if the file was uploaded via collect photos workflow
bool get isCollect => uploaderName != null;
String? get uploaderName => pubMagicMetadata?.uploaderName;
diff --git a/mobile/apps/photos/lib/models/gallery/fixed_extent_section_layout.dart b/mobile/apps/photos/lib/models/gallery/fixed_extent_section_layout.dart
index 4deff5e4a1..5a92858140 100644
--- a/mobile/apps/photos/lib/models/gallery/fixed_extent_section_layout.dart
+++ b/mobile/apps/photos/lib/models/gallery/fixed_extent_section_layout.dart
@@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
-// Used to store layout information for a section (group) in a gallery
-
class FixedExtentSectionLayout {
final double tileHeight, mainAxisStride;
final int firstIndex, lastIndex, bodyFirstIndex;
diff --git a/mobile/apps/photos/lib/models/gallery/gallery_groups.dart b/mobile/apps/photos/lib/models/gallery/gallery_groups.dart
index 2009cd959a..da8e3650b2 100644
--- a/mobile/apps/photos/lib/models/gallery/gallery_groups.dart
+++ b/mobile/apps/photos/lib/models/gallery/gallery_groups.dart
@@ -309,7 +309,7 @@ class GalleryGroups {
void _buildGroups() {
final stopwatch = Stopwatch()..start();
- final yearsInGroups = <int>{}; //Only relevant for time grouping
+ final yearsInGroups = <int>{};
List<EnteFile> groupFiles = [];
final allFilesLength = allFiles.length;
diff --git a/mobile/apps/photos/lib/models/gallery_type.dart b/mobile/apps/photos/lib/models/gallery_type.dart
index 9a11c948bf..a5a002b713 100644
--- a/mobile/apps/photos/lib/models/gallery_type.dart
+++ b/mobile/apps/photos/lib/models/gallery_type.dart
@@ -81,8 +81,6 @@ extension GalleyTypeExtension on GalleryType {
}
}
- // showDeleteTopOption indicates whether we should show
- // delete icon as iconButton
bool showDeleteIconOption() {
switch (this) {
case GalleryType.ownedCollection:
diff --git a/mobile/apps/photos/lib/models/local_entity_data.dart b/mobile/apps/photos/lib/models/local_entity_data.dart
index a353149bf6..c2b7901422 100644
--- a/mobile/apps/photos/lib/models/local_entity_data.dart
+++ b/mobile/apps/photos/lib/models/local_entity_data.dart
@@ -1,7 +1,6 @@
import "package:equatable/equatable.dart";
import "package:photos/gateways/entity/models/type.dart";
-// LocalEntityData is a class that represents the data of an entity stored locally.
class LocalEntityData {
final String id;
final EntityType type;
diff --git a/mobile/apps/photos/lib/models/memories/filler_memory.dart b/mobile/apps/photos/lib/models/memories/filler_memory.dart
index 0567d3cb52..5cac6fb710 100644
--- a/mobile/apps/photos/lib/models/memories/filler_memory.dart
+++ b/mobile/apps/photos/lib/models/memories/filler_memory.dart
@@ -3,7 +3,6 @@ import "package:photos/models/memories/memory.dart";
import "package:photos/models/memories/smart_memory.dart";
class FillerMemory extends SmartMemory {
- // For creating the title
int yearsAgo;
FillerMemory(
List<Memory> memories,
diff --git a/mobile/apps/photos/lib/models/memories/smart_memory_constants.dart b/mobile/apps/photos/lib/models/memories/smart_memory_constants.dart
index a858e91377..7d42d79883 100644
--- a/mobile/apps/photos/lib/models/memories/smart_memory_constants.dart
+++ b/mobile/apps/photos/lib/models/memories/smart_memory_constants.dart
@@ -1,4 +1,3 @@
-// Constants for computing smart memories
const kMemoriesUpdateFrequencyDays = 3;
const kMemoriesUpdateFrequency = Duration(days: kMemoriesUpdateFrequencyDays);
const kMemoriesMargin = Duration(days: 1);
diff --git a/mobile/apps/photos/lib/models/memories/time_memory.dart b/mobile/apps/photos/lib/models/memories/time_memory.dart
index fa3736540a..bf720252c6 100644
--- a/mobile/apps/photos/lib/models/memories/time_memory.dart
+++ b/mobile/apps/photos/lib/models/memories/time_memory.dart
@@ -6,7 +6,6 @@ import "package:photos/models/memories/smart_memory.dart";
enum TimeMemoryKind { day, month, week, lastWeek, lastMonth }
class TimeMemory extends SmartMemory {
- // For computing the title
final TimeMemoryKind kind;
DateTime? day;
DateTime? month;
diff --git a/mobile/apps/photos/lib/models/memories/trip_memory.dart b/mobile/apps/photos/lib/models/memories/trip_memory.dart
index 103f28e404..583d0cb85a 100644
--- a/mobile/apps/photos/lib/models/memories/trip_memory.dart
+++ b/mobile/apps/photos/lib/models/memories/trip_memory.dart
@@ -7,7 +7,6 @@ class TripMemory extends SmartMemory {
final Location location;
final String? tripKey;
- // Stuff for the title
String? locationName;
int? tripYear;
diff --git a/mobile/apps/photos/lib/models/metadata/collection_magic.dart b/mobile/apps/photos/lib/models/metadata/collection_magic.dart
index 3a84184e0a..418a73d999 100644
--- a/mobile/apps/photos/lib/models/metadata/collection_magic.dart
+++ b/mobile/apps/photos/lib/models/metadata/collection_magic.dart
@@ -2,11 +2,9 @@ import 'dart:convert';
import "package:photos/models/metadata/common_keys.dart";
-// Collection SubType Constants
const subTypeDefaultHidden = 1;
const subTypeSharedFilesCollection = 2;
-// key for collection subType
const subTypeKey = 'subType';
const muteKey = "mute";
@@ -62,16 +60,13 @@ class CollectionMagicMetadata {
}
class CollectionPubMagicMetadata {
- // sort order while showing collection
bool? asc;
- // cover photo id for the collection
int? coverID;
// layout for public link sharing (masonry, grouped, continuous, trip)
String? layout;
- // description shown below the album name
String? description;
CollectionPubMagicMetadata({
diff --git a/mobile/apps/photos/lib/models/metadata/common_keys.dart b/mobile/apps/photos/lib/models/metadata/common_keys.dart
index 44dbf1665e..6370e588f3 100644
--- a/mobile/apps/photos/lib/models/metadata/common_keys.dart
+++ b/mobile/apps/photos/lib/models/metadata/common_keys.dart
@@ -1,6 +1,5 @@
const magicKeyVisibility = 'visibility';
-// Visibility Constants
const visibleVisibility = 0;
const archiveVisibility = 1;
diff --git a/mobile/apps/photos/lib/models/metadata/file_magic.dart b/mobile/apps/photos/lib/models/metadata/file_magic.dart
index 04658dc52b..547cf452bc 100644
--- a/mobile/apps/photos/lib/models/metadata/file_magic.dart
+++ b/mobile/apps/photos/lib/models/metadata/file_magic.dart
@@ -57,7 +57,6 @@ class PubMagicMetadata {
String? cameraMake;
String? cameraModel;
- // Indicates streaming version of the file.
// If this is set, then the file is a streaming version of the original file.
int? sv;
diff --git a/mobile/apps/photos/lib/models/ml/discover/prompt.dart b/mobile/apps/photos/lib/models/ml/discover/prompt.dart
index 8ebb42865a..ee568fd60a 100644
--- a/mobile/apps/photos/lib/models/ml/discover/prompt.dart
+++ b/mobile/apps/photos/lib/models/ml/discover/prompt.dart
@@ -9,7 +9,6 @@ class Prompt {
final bool showVideo;
final bool recentFirst;
- // fromJson
Prompt.fromJson(Map<String, dynamic> json)
: id = json['id'] ?? json['title'],
query = json['query'] ?? json['prompt'],
diff --git a/mobile/apps/photos/lib/models/ml/face/face_with_embedding.dart b/mobile/apps/photos/lib/models/ml/face/face_with_embedding.dart
index f9cbec9452..2fcd30f4c0 100644
--- a/mobile/apps/photos/lib/models/ml/face/face_with_embedding.dart
+++ b/mobile/apps/photos/lib/models/ml/face/face_with_embedding.dart
@@ -32,7 +32,6 @@ class FaceWithoutEmbedding {
fileID,
parseIntOrDoubleAsDouble(json['score'])!,
Detection.fromJson(json['detection'] as Map<String, dynamic>),
- // high value means t
parseIntOrDoubleAsDouble(json['blur']) ?? kLapacianDefault,
);
}
diff --git a/mobile/apps/photos/lib/models/preview/preview_item_status.dart b/mobile/apps/photos/lib/models/preview/preview_item_status.dart
index 41108b9ce7..f4b5ea4905 100644
--- a/mobile/apps/photos/lib/models/preview/preview_item_status.dart
+++ b/mobile/apps/photos/lib/models/preview/preview_item_status.dart
@@ -1,13 +1,9 @@
enum PreviewItemStatus {
- // in progress
compressing,
uploading,
- // error
failed,
- // queued
inQueue,
retry,
- // done
uploaded,
// paused (e.g., due to uploads in progress)
paused,
diff --git a/mobile/apps/photos/lib/models/user_details.dart b/mobile/apps/photos/lib/models/user_details.dart
index b1e69db4e3..8ec03b7270 100644
--- a/mobile/apps/photos/lib/models/user_details.dart
+++ b/mobile/apps/photos/lib/models/user_details.dart
@@ -86,9 +86,6 @@ class UserDetails {
);
}
- // getFamilyOrPersonalUsage will return total usage for family if user
- // belong to family group. Otherwise, it will return storage consumed by
- // current user
int getFamilyOrPersonalUsage() {
return isPartOfFamily() ? familyData!.getTotalUsage() : usage;
}
@@ -101,15 +98,11 @@ class UserDetails {
return max(getTotalStorage() - getFamilyOrPersonalUsage(), 0);
}
- // getTotalStorage will return total storage available including the
- // storage bonus
int getTotalStorage() {
return (isPartOfFamily() ? familyData!.storage : subscription.storage) +
storageBonus;
}
- // return the member storage limit if user is part of family and the admin
- // has set the storage limit for the user.
int? familyMemberStorageLimit() {
if (isPartOfFamily()) {
final FamilyMember? currentUserMember = currentFamilyMember();
@@ -218,14 +211,12 @@ class ProfileData {
bool isEmailMFAEnabled;
bool isTwoFactorEnabled;
- // Constructor with default values
ProfileData({
this.canDisableEmailMFA = false,
this.isEmailMFAEnabled = false,
this.isTwoFactorEnabled = false,
});
- // Factory method to create ProfileData instance from JSON
factory ProfileData.fromJson(Map<String, dynamic>? json) {
return ProfileData(
canDisableEmailMFA: json?['canDisableEmailMFA'] ?? false,
@@ -234,7 +225,6 @@ class ProfileData {
);
}
- // Method to convert ProfileData instance to JSON
Map<String, dynamic> toJson() {
return {
'canDisableEmailMFA': canDisableEmailMFA,
diff --git a/mobile/apps/photos/lib/module/download/manager.dart b/mobile/apps/photos/lib/module/download/manager.dart
index 8276898f8a..5b93a29133 100644
--- a/mobile/apps/photos/lib/module/download/manager.dart
+++ b/mobile/apps/photos/lib/module/download/manager.dart
@@ -168,7 +168,7 @@ class DownloadManager {
'Existing file size mismatch for ${task.filename}: '
'expected ${task.totalBytes}, but got $existingSize',
);
- await baseFile.delete(); // Remove corrupted file
+ await baseFile.delete();
}
}
diff --git a/mobile/apps/photos/lib/module/live_photo/upload.dart b/mobile/apps/photos/lib/module/live_photo/upload.dart
index aa0a884330..e5f7521590 100644
--- a/mobile/apps/photos/lib/module/live_photo/upload.dart
+++ b/mobile/apps/photos/lib/module/live_photo/upload.dart
@@ -19,9 +19,8 @@ typedef _LivePhotoVideoData = ({File file, String fileHash});
final _logger = Logger('LivePhotoUpload');
-/// Uploads may prepare several files concurrently. Keep this per-file pipeline
-/// sequential to limit duplicate reads and I/O pressure. If Live Photo imports
-/// become a bottleneck, profile the shared worker queue before parallelizing it.
+// Uploads may prepare several files concurrently. Keep this per-file pipeline
+// sequential to limit duplicate reads and I/O pressure.
Future<LivePhotoUploadData> prepareLivePhotoForUpload(
EnteFile file,
File imageFile,
diff --git a/mobile/apps/photos/lib/module/metadata/exif.dart b/mobile/apps/photos/lib/module/metadata/exif.dart
index 1c82f991d6..d79e62d8fb 100644
--- a/mobile/apps/photos/lib/module/metadata/exif.dart
+++ b/mobile/apps/photos/lib/module/metadata/exif.dart
@@ -169,7 +169,6 @@ ParsedExifDateTime _getStandardExifDateTimeInDeviceTimezone(
final photoUtcDate = result.add(
Duration(hours: -offsetHours, minutes: -offsetMinutes),
);
- // Convert the UTC time to the device's local time
final deviceLocalTime = photoUtcDate.toLocal();
return ParsedExifDateTime(
deviceLocalTime,
diff --git a/mobile/apps/photos/lib/module/metadata/location.dart b/mobile/apps/photos/lib/module/metadata/location.dart
index 50e0e2b3e3..f96e43d2cc 100644
--- a/mobile/apps/photos/lib/module/metadata/location.dart
+++ b/mobile/apps/photos/lib/module/metadata/location.dart
@@ -7,7 +7,6 @@ import "package:photos/models/location/location.dart";
import "package:photos/module/metadata/exif.dart";
import "package:photos/module/metadata/video.dart";
-/// Adds Android location metadata to [file], preferring valid EXIF data.
Future<void> updateLocationFromEmbeddedMetadata(
EnteFile file,
File sourceFile,
diff --git a/mobile/apps/photos/lib/module/metadata/panorama.dart b/mobile/apps/photos/lib/module/metadata/panorama.dart
index 8d6cd5f662..9747cae070 100644
--- a/mobile/apps/photos/lib/module/metadata/panorama.dart
+++ b/mobile/apps/photos/lib/module/metadata/panorama.dart
@@ -16,7 +16,6 @@ final _logger = Logger('PanoramaUtil');
Future<Map<String, dynamic>> readXmp(File file) =>
extractXmp(filePath: file.path);
-/// Check if the file is a panorama image.
Future<bool> _isPanorama(EnteFile enteFile) async {
if (enteFile.fileType != FileType.image) {
return false;
@@ -49,7 +48,6 @@ bool isPanoramaFromXmp(Map<String, dynamic> xmpData) {
return projectionType == "cylindrical" || projectionType == "equirectangular";
}
-/// Detects and persists panorama metadata if it has not been checked yet.
Future<void> guardedCheckPanorama(EnteFile file) async {
if (!file.canEditMetaInfo || file.isPanorama() != null) {
return;
@@ -59,7 +57,6 @@ Future<void> guardedCheckPanorama(EnteFile file) async {
);
final isPanorama = await _isPanorama(file);
- // Update the metadata if it is not updated
if (file.canEditMetaInfo && file.isPanorama() == null) {
final mediaType =
(file.pubMagicMetadata?.mediaType ?? 0) | (isPanorama ? 1 : 0);
diff --git a/mobile/apps/photos/lib/module/upload/model/xml.dart b/mobile/apps/photos/lib/module/upload/model/xml.dart
index 46dcc5094b..a40d57d44d 100644
--- a/mobile/apps/photos/lib/module/upload/model/xml.dart
+++ b/mobile/apps/photos/lib/module/upload/model/xml.dart
@@ -2,20 +2,17 @@
import "package:xml/xml.dart";
-// used for classes that can be converted to xml
abstract class XmlParsableObject {
Map<String, dynamic> toMap();
String get elementName;
}
-// for converting the response to xml
String convertJs2Xml(Map<String, dynamic> json) {
final builder = XmlBuilder();
buildXml(builder, json);
return builder.buildDocument().toXmlString(pretty: true, indent: ' ');
}
-// for building the xml node tree recursively
void buildXml(XmlBuilder builder, dynamic node) {
if (node is Map<String, dynamic>) {
node.forEach((key, value) {
diff --git a/mobile/apps/photos/lib/service_locator.dart b/mobile/apps/photos/lib/service_locator.dart
index 53e060ad92..686501d4ce 100644
--- a/mobile/apps/photos/lib/service_locator.dart
+++ b/mobile/apps/photos/lib/service_locator.dart
@@ -61,7 +61,6 @@ class ServiceLocator {
late final BackupSettings backupSettings;
late final EnteWakeLockService wakeLockService;
- // instance
ServiceLocator._privateConstructor();
static final ServiceLocator instance = ServiceLocator._privateConstructor();
@@ -122,10 +121,8 @@ BackupSettings get backupSettings => ServiceLocator.instance.backupSettings;
EnteWakeLockService get wakeLockService =>
ServiceLocator.instance.wakeLockService;
-/// Whether the app is currently showing the no-account local gallery experience.
-///
-/// This does not mean the device is offline. It means the active gallery mode is
-/// local-device focused rather than Ente-account focused.
+// True when showing local-device photos instead of an Ente account. Network
+// access may still be used.
bool get isLocalGalleryMode => localSettings.isLocalGalleryMode;
bool get hasGrantedMLConsent {
@@ -321,7 +318,6 @@ InstallSourceService get installSourceService {
return _installSourceService!;
}
-// Gateways
PushGateway? _pushGateway;
PushGateway get pushGateway {
_pushGateway ??= PushGateway(ServiceLocator.instance.enteDio);
diff --git a/mobile/apps/photos/lib/services/backup_preference_service.dart b/mobile/apps/photos/lib/services/backup_preference_service.dart
index 9a5ed8796a..ba30e8d63e 100644
--- a/mobile/apps/photos/lib/services/backup_preference_service.dart
+++ b/mobile/apps/photos/lib/services/backup_preference_service.dart
@@ -91,9 +91,7 @@ class BackupPreferenceService {
await _prefs.remove(_keyOnlyNewSinceEpoch);
}
- /// Auto-selects all device folders when the user hasn't made any manual
- /// selection yet. This is used in onboarding flows to quickly opt into
- /// backing up everything visible to the app.
+ // Onboarding auto-selects all folders unless the user chose folders manually.
Future<void> _ensureDefaultFolderSelection() async {
if (hasManualFolderSelection || hasSelectedAnyBackupFolder) {
return;
diff --git a/mobile/apps/photos/lib/services/contacts/contact_identity_resolver.dart b/mobile/apps/photos/lib/services/contacts/contact_identity_resolver.dart
index 8074db0e54..fe504fe8ce 100644
--- a/mobile/apps/photos/lib/services/contacts/contact_identity_resolver.dart
+++ b/mobile/apps/photos/lib/services/contacts/contact_identity_resolver.dart
@@ -5,8 +5,8 @@ import "package:photos/utils/contact_string_util.dart";
typedef ResolvedUserIdentity = ({String displayName, String? knownEmail});
-/// Precedence: saved contact name β†’ linked person name / local label β†’
-/// known email β†’ "Someone".
+// Precedence: saved contact name β†’ linked person name or local label β†’ known
+// email β†’ "Someone".
ResolvedUserIdentity resolveSuggestionIdentity(UserSuggestion suggestion) {
final contact = PhotosContactsService.instance.getCachedContact(
contactUserId: suggestion.userID,
diff --git a/mobile/apps/photos/lib/services/contacts/direct_contact_users.dart b/mobile/apps/photos/lib/services/contacts/direct_contact_users.dart
index 8e1d45ab6a..107e718374 100644
--- a/mobile/apps/photos/lib/services/contacts/direct_contact_users.dart
+++ b/mobile/apps/photos/lib/services/contacts/direct_contact_users.dart
@@ -4,9 +4,6 @@ import "package:photos/models/collection/collection.dart";
import "package:photos/models/user_details.dart";
import "package:photos/utils/contact_string_util.dart";
-/// Builds entries shown in Contacts.
-///
-/// Each user has a positive ID and a known, non-placeholder email address.
List<User> buildDirectContactUsers({
required int ownerUserId,
required String ownerEmail,
diff --git a/mobile/apps/photos/lib/services/filedata/filedata_service.dart b/mobile/apps/photos/lib/services/filedata/filedata_service.dart
index 69e12a3cde..3bafeb3d08 100644
--- a/mobile/apps/photos/lib/services/filedata/filedata_service.dart
+++ b/mobile/apps/photos/lib/services/filedata/filedata_service.dart
@@ -29,9 +29,7 @@ class FileDataService {
previewIds = <int, PreviewInfo>{};
}
- /// Used to not sync preview ids everytime a chunking and preview
- /// upload is successful, instead update the local copy of those
- /// preview ids
+ // Update the local preview cache without syncing after every upload.
void appendPreview(int id, String objectId, int objectSize) {
if (previewIds.containsKey(id)) return;
previewIds[id] = PreviewInfo(objectId: objectId, objectSize: objectSize);
diff --git a/mobile/apps/photos/lib/services/filter/collection_ignore.dart b/mobile/apps/photos/lib/services/filter/collection_ignore.dart
index 8d3edeef18..5bef00d82c 100644
--- a/mobile/apps/photos/lib/services/filter/collection_ignore.dart
+++ b/mobile/apps/photos/lib/services/filter/collection_ignore.dart
@@ -43,7 +43,7 @@ class CollectionsAndSavedFileFilter extends Filter {
return true;
}
if (_ignoredUploadIDs!.contains(file.uploadedFileID!)) {
- return false; // this file should be filtered out
+ return false;
}
if (ignoreSavedFiles &&
file.ownerID != ownerID &&
diff --git a/mobile/apps/photos/lib/services/filter/dedupe_by_upload_id.dart b/mobile/apps/photos/lib/services/filter/dedupe_by_upload_id.dart
index 93294e37e4..dce685cf75 100644
--- a/mobile/apps/photos/lib/services/filter/dedupe_by_upload_id.dart
+++ b/mobile/apps/photos/lib/services/filter/dedupe_by_upload_id.dart
@@ -1,8 +1,6 @@
import 'package:photos/models/file/file.dart';
import "package:photos/services/filter/filter.dart";
-// DedupeUploadIDFilter will filter out files where were previously filtered
-// during the same filtering session
class DedupeUploadIDFilter extends Filter {
final Set<int> trackedUploadIDs = {};
diff --git a/mobile/apps/photos/lib/services/filter/upload_ignore.dart b/mobile/apps/photos/lib/services/filter/upload_ignore.dart
index 584196560a..616eb057e9 100644
--- a/mobile/apps/photos/lib/services/filter/upload_ignore.dart
+++ b/mobile/apps/photos/lib/services/filter/upload_ignore.dart
@@ -2,8 +2,6 @@ import 'package:photos/models/file/file.dart';
import "package:photos/services/filter/filter.dart";
import "package:photos/services/ignored_files_service.dart";
-// UploadIgnoreFilter hides the unuploaded files that are ignored from for
-// upload
class UploadIgnoreFilter extends Filter {
Map<String, String> idToReasonMap;
@@ -11,7 +9,6 @@ class UploadIgnoreFilter extends Filter {
@override
bool filter(EnteFile file) {
- // Already uploaded files pass the filter
if (file.isUploaded) return true;
return !IgnoredFilesService.instance.shouldSkipUpload(idToReasonMap, file);
}
diff --git a/mobile/apps/photos/lib/services/isolated_ffmpeg_service.dart b/mobile/apps/photos/lib/services/isolated_ffmpeg_service.dart
index e422d2a569..402e7456d6 100644
--- a/mobile/apps/photos/lib/services/isolated_ffmpeg_service.dart
+++ b/mobile/apps/photos/lib/services/isolated_ffmpeg_service.dart
@@ -19,8 +19,6 @@ class IsolatedFfmpegService {
return await Isolate.run<Map>(() => _ffmpegRun(command, rootIsolateToken));
}
- /// Run FFmpeg with session ID callback for cancellation support.
- /// Uses a completion port registered on the root isolate.
Future<Map> runFfmpegCancellable(
String command,
void Function(int sessionId) onSessionStarted,
diff --git a/mobile/apps/photos/lib/services/location_service.dart b/mobile/apps/photos/lib/services/location_service.dart
index 8a2028dc11..c27eb3d246 100644
--- a/mobile/apps/photos/lib/services/location_service.dart
+++ b/mobile/apps/photos/lib/services/location_service.dart
@@ -519,7 +519,7 @@ Map<City, List<EnteFile>> getCityResults(Map args) {
final Map<City, List<EnteFile>> results = {};
for (final file in files) {
- if (!file.hasLocation) continue; // Skip files without location
+ if (!file.hasLocation) continue;
final fileLocation = file.location!;
for (final city in matchingCities) {
final x = city.lat - fileLocation.latitude!;
@@ -539,7 +539,7 @@ Map<City, List<EnteFile>> getCityResults(Map args) {
final bool hasQuery = query.isNotEmpty;
final Map<City, List<EnteFile>> results = {};
for (final file in files) {
- if (!file.hasLocation) continue; // Skip files without location
+ if (!file.hasLocation) continue;
final fileLocation = file.location!;
final fileLat = fileLocation.latitude!;
final fileLng = fileLocation.longitude!;
diff --git a/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart b/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart
index 36d588330f..0154bf9f84 100644
--- a/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart
@@ -34,11 +34,9 @@ class ComputeController {
bool _debugInteractionOverride = false;
Future<void>? _initFuture;
- /// If true, user interaction is ignored and compute tasks can run regardless of user activity.
bool get interactionOverride =>
_temporaryInteractionOverride || _debugInteractionOverride;
- /// If true, compute tasks are paused regardless of device health or user activity.
bool get computeBlocked => _computeBlocks.isNotEmpty;
final Set<String> _computeBlocks = {};
@@ -72,7 +70,6 @@ class ComputeController {
_logger.info('init done ');
}
- // Directly assign the values + Attach listener for compute controller
Future<void> init() {
return _initFuture ??= _initInternal();
}
diff --git a/mobile/apps/photos/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart b/mobile/apps/photos/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart
index 4a399dfa1a..41cb4c3174 100644
--- a/mobile/apps/photos/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart
@@ -2415,7 +2415,7 @@ List<(String, double, String)> _calcSuggestionsMean(Map<String, dynamic> args) {
),
);
}
- suggestClusterIds.sort((a, b) => a.$2.compareTo(b.$2)); // sort by distance
+ suggestClusterIds.sort((a, b) => a.$2.compareTo(b.$2));
dev.log(
"Already found ${suggestClusterIds.length} good suggestions using mean",
diff --git a/mobile/apps/photos/lib/services/machine_learning/face_thumbnail_generator.dart b/mobile/apps/photos/lib/services/machine_learning/face_thumbnail_generator.dart
index d2771599cf..4efc36d49c 100644
--- a/mobile/apps/photos/lib/services/machine_learning/face_thumbnail_generator.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/face_thumbnail_generator.dart
@@ -22,8 +22,6 @@ class FaceThumbnailGenerator extends SuperIsolate {
FaceThumbnailGenerator._privateConstructor();
factory FaceThumbnailGenerator() => instance;
- /// Generates face thumbnails for all [faceBoxes] in the image at
- /// [imagePath].
Future<List<Uint8List>> generateFaceThumbnails(
String imagePath,
List<FaceBox> faceBoxes,
diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_model.dart b/mobile/apps/photos/lib/services/machine_learning/ml_model.dart
index d59841ad9c..cf3a536a44 100644
--- a/mobile/apps/photos/lib/services/machine_learning/ml_model.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/ml_model.dart
@@ -15,7 +15,7 @@ abstract class MlModelAsset {
final _downloadModelLock = Lock();
- /// WARNING: If [downloadModel] was not first called, this method will download the model first using high bandwidth.
+ // Downloads over high bandwidth if downloadModel was not called first.
Future<String> getModelPath() async {
return _downloadModelLock.synchronized(() async {
return RemoteAssetsService.instance.getAssetPath(
diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_model_download_service.dart b/mobile/apps/photos/lib/services/machine_learning/ml_model_download_service.dart
index 34db9b8ea4..4d692f465b 100644
--- a/mobile/apps/photos/lib/services/machine_learning/ml_model_download_service.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/ml_model_download_service.dart
@@ -47,9 +47,6 @@ class MLModelDownloadService {
return isLocalGalleryMode || await canUseHighBandwidth();
}
- /// Invalidate the download cache so the next ML run re-enters
- /// [ensureModelsDownloaded], which checks consent, local indexing, bandwidth,
- /// and downloads any newly required models.
void invalidateModelDownloadCache({bool includeNonIndexingModels = false}) {
_areIndexingModelsDownloaded = false;
if (includeNonIndexingModels) {
diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_result.dart b/mobile/apps/photos/lib/services/machine_learning/ml_result.dart
index 0c4d624301..41541240ea 100644
--- a/mobile/apps/photos/lib/services/machine_learning/ml_result.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/ml_result.dart
@@ -16,8 +16,8 @@ class MLResult {
List<PetFaceResult>? petFaces;
List<PetBodyResult>? petBodies;
- /// Bitmask attached to the remotely stored embeddings, describing the
- /// runtime and execution providers used to produce this result.
+ // Bitmask attached to remotely stored embeddings, describing the runtime and
+ // execution providers used to produce this result.
int remoteFlags;
Dimensions decodedImageSize;
diff --git a/mobile/apps/photos/lib/services/machine_learning/webgpu_execution_policy.dart b/mobile/apps/photos/lib/services/machine_learning/webgpu_execution_policy.dart
index 1e3b5f9e8b..e1b99217f7 100644
--- a/mobile/apps/photos/lib/services/machine_learning/webgpu_execution_policy.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/webgpu_execution_policy.dart
@@ -7,9 +7,7 @@ import "package:photos/utils/ram_check_util.dart";
final webGpuExecutionPolicy = WebGpuExecutionPolicy();
-/// Computes the app-owned portion of Android WebGPU eligibility.
-///
-/// Durable quarantine and GPU adapter compatibility are owned by Rust.
+// Rust owns durable quarantine and GPU adapter compatibility.
class WebGpuExecutionPolicy {
Future<int?>? _androidSdkFuture;
@@ -20,7 +18,6 @@ class WebGpuExecutionPolicy {
return false;
}
final sdk = await (_androidSdkFuture ??= _readAndroidSdk());
- // Android 12+
return sdk != null && sdk >= 31;
}
diff --git a/mobile/apps/photos/lib/services/photos_contacts_service.dart b/mobile/apps/photos/lib/services/photos_contacts_service.dart
index e939e5c765..a981f08017 100644
--- a/mobile/apps/photos/lib/services/photos_contacts_service.dart
+++ b/mobile/apps/photos/lib/services/photos_contacts_service.dart
@@ -7,7 +7,7 @@ import "package:photos/events/contacts_changed_event.dart";
import "package:photos/events/user_logged_out_event.dart";
import "package:photos/service_locator.dart";
-/// Photos-specific session and event adapter for the shared contact directory.
+// Photos-specific session and event adapter for the shared contact directory.
class PhotosContactsService {
PhotosContactsService._privateConstructor()
: _store = contacts.ContactDirectory(
diff --git a/mobile/apps/photos/lib/services/smart_albums_service.dart b/mobile/apps/photos/lib/services/smart_albums_service.dart
index 175f3c6f1a..67d77c501b 100644
--- a/mobile/apps/photos/lib/services/smart_albums_service.dart
+++ b/mobile/apps/photos/lib/services/smart_albums_service.dart
@@ -36,7 +36,7 @@ class SmartAlbumsService {
final lastRemoteSyncTimeValue = lastRemoteSyncTime();
if (_lastCacheRefreshTime != lastRemoteSyncTimeValue) {
_lastCacheRefreshTime = lastRemoteSyncTimeValue;
- _cachedConfigsFuture = null; // Invalidate cache
+ _cachedConfigsFuture = null;
}
_cachedConfigsFuture ??= _fetchAndCacheSaConfigs();
return _cachedConfigsFuture!;
@@ -253,7 +253,7 @@ class SmartAlbumsService {
addWithCustomID: addWithCustomID,
);
- _lastCacheRefreshTime = 0; // Invalidate cache
+ _lastCacheRefreshTime = 0;
return result;
}
@@ -264,6 +264,6 @@ class SmartAlbumsService {
_logger.fine("Deleting entry for collection ($collectionId)");
final id = getId(collectionId: collectionId, userId: userId);
await entityService.deleteEntry(id);
- _lastCacheRefreshTime = 0; // Invalidate cache
+ _lastCacheRefreshTime = 0;
}
}
diff --git a/mobile/apps/photos/lib/services/storage_bonus_service.dart b/mobile/apps/photos/lib/services/storage_bonus_service.dart
index fb32eee9d6..588d3f7e10 100644
--- a/mobile/apps/photos/lib/services/storage_bonus_service.dart
+++ b/mobile/apps/photos/lib/services/storage_bonus_service.dart
@@ -16,7 +16,6 @@ class StorageBonusService {
debugPrint("StorageBonusService constructor");
}
- // returns true if _showStorageBonusTapCount value is less than minTapCountBeforeHidingBanner
bool shouldShowStorageBonus() {
final tapCount = prefs.getInt(_showStorageBonusTapCount) ?? 0;
return tapCount <= minTapCountBeforeHidingBanner;
diff --git a/mobile/apps/photos/lib/services/text_embeddings_cache_service.dart b/mobile/apps/photos/lib/services/text_embeddings_cache_service.dart
index e8716daf6d..aa3d955a81 100644
--- a/mobile/apps/photos/lib/services/text_embeddings_cache_service.dart
+++ b/mobile/apps/photos/lib/services/text_embeddings_cache_service.dart
@@ -13,18 +13,15 @@ class TextEmbeddingsCacheService {
final mlDataDB = isLocalGalleryMode
? MLDataDB.localGalleryInstance
: MLDataDB.instance;
- // 1. Check database cache
final dbResult = await mlDataDB.getRepeatedTextEmbeddingCache(query);
if (dbResult != null) {
_logger.info('Text embedding cache hit for query');
return dbResult;
}
- // 2. Compute new embedding
_logger.info('Computing new text embedding for query');
final embedding = await MLComputer.instance.runClipText(query);
- // 3. Store in database cache
await mlDataDB.putRepeatedTextEmbeddingCache(query, embedding);
return embedding;
diff --git a/mobile/apps/photos/lib/theme/text_style.dart b/mobile/apps/photos/lib/theme/text_style.dart
index af39108803..ca4fbbba43 100644
--- a/mobile/apps/photos/lib/theme/text_style.dart
+++ b/mobile/apps/photos/lib/theme/text_style.dart
@@ -55,7 +55,6 @@ class EnteTextTheme {
final TextStyle miniBold;
final TextStyle tiny;
final TextStyle tinyBold;
- // textMuted variants
final TextStyle h1Muted;
final TextStyle h2Muted;
final TextStyle h3Muted;
@@ -67,7 +66,6 @@ class EnteTextTheme {
final TextStyle miniBoldMuted;
final TextStyle tinyMuted;
- // textFaint variants
final TextStyle h1Faint;
final TextStyle h2Faint;
final TextStyle h3Faint;
diff --git a/mobile/apps/photos/lib/ui/account/passkey_page.dart b/mobile/apps/photos/lib/ui/account/passkey_page.dart
index 99c5ff5481..4a0b8899ab 100644
--- a/mobile/apps/photos/lib/ui/account/passkey_page.dart
+++ b/mobile/apps/photos/lib/ui/account/passkey_page.dart
@@ -135,7 +135,6 @@ class _PasskeyPageState extends State<PasskeyPage> {
Future<bool> _initDeepLinks() async {
final appLinks = AppLinks();
- // Attach a listener to the stream
linkStreamSubscription = appLinks.uriLinkStream.listen(
_handleDeeplink,
onError: (err) {
diff --git a/mobile/apps/photos/lib/ui/collections/album/smart_album_people.dart b/mobile/apps/photos/lib/ui/collections/album/smart_album_people.dart
index 1942ddedf7..2dbb048aa4 100644
--- a/mobile/apps/photos/lib/ui/collections/album/smart_album_people.dart
+++ b/mobile/apps/photos/lib/ui/collections/album/smart_album_people.dart
@@ -104,7 +104,6 @@ class _SmartAlbumPeopleState extends State<SmartAlbumPeople> {
if (currentConfig == null) {
final infoMap = <String, PersonInfo>{};
- // Add files which are needed
for (final personId in _selectedPeople.personIds) {
infoMap[personId] = (updatedAt: 0, addedFiles: {});
}
diff --git a/mobile/apps/photos/lib/ui/collections/device/device_folders_vertical_grid_view.dart b/mobile/apps/photos/lib/ui/collections/device/device_folders_vertical_grid_view.dart
index 19e020207e..246aef50c2 100644
--- a/mobile/apps/photos/lib/ui/collections/device/device_folders_vertical_grid_view.dart
+++ b/mobile/apps/photos/lib/ui/collections/device/device_folders_vertical_grid_view.dart
@@ -116,10 +116,6 @@ class _DeviceFolderVerticalGridViewBodyState
const Duration(milliseconds: 1500),
executionInterval: const Duration(seconds: 4),
);
- /*
- Aspect ratio 1:1
- Width changes dynamically with screen width
- */
static const maxThumbnailWidth = 224.0;
static const horizontalPadding = 16.0;
static const crossAxisSpacing = 8.0;
diff --git a/mobile/apps/photos/lib/ui/common/bottom_shadow.dart b/mobile/apps/photos/lib/ui/common/bottom_shadow.dart
index 2de7e944e2..e861f6ae80 100644
--- a/mobile/apps/photos/lib/ui/common/bottom_shadow.dart
+++ b/mobile/apps/photos/lib/ui/common/bottom_shadow.dart
@@ -16,7 +16,7 @@ class BottomShadowWidget extends StatelessWidget {
color: shadowColor ?? Theme.of(context).colorScheme.surface,
spreadRadius: 42,
blurRadius: 42,
- offset: Offset(0, offsetDy), // changes position of shadow
+ offset: Offset(0, offsetDy),
),
],
),
diff --git a/mobile/apps/photos/lib/ui/common/web_page.dart b/mobile/apps/photos/lib/ui/common/web_page.dart
index 500d9ec97e..a5a8840bfd 100644
--- a/mobile/apps/photos/lib/ui/common/web_page.dart
+++ b/mobile/apps/photos/lib/ui/common/web_page.dart
@@ -8,7 +8,6 @@ class WebPage extends StatefulWidget {
final String title;
final String url;
- // if true, show open in browser icon in appBar
final bool canOpenInBrowser;
const WebPage(
diff --git a/mobile/apps/photos/lib/ui/components/buttons/button_widget.dart b/mobile/apps/photos/lib/ui/components/buttons/button_widget.dart
index d324dee04e..f417004e14 100644
--- a/mobile/apps/photos/lib/ui/components/buttons/button_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/buttons/button_widget.dart
@@ -369,7 +369,7 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
color: checkIconColor,
),
)
- : const SizedBox.shrink(), //fallback
+ : const SizedBox.shrink(),
),
),
),
diff --git a/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart b/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart
index 58ad56ae11..735022fb81 100644
--- a/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart
+++ b/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart
@@ -88,7 +88,6 @@ class _ApplyCodeContentState extends State<_ApplyCodeContent> {
await storageBonusService.applyCode(code);
if (mounted) {
Navigator.of(context).pop(true);
- // Navigate to success screen
await Navigator.of(context).push(
MaterialPageRoute(
builder: (context) =>
diff --git a/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart b/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart
index 1fb8907563..f0a370bfb1 100644
--- a/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart
+++ b/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart
@@ -25,17 +25,13 @@ class ReferralCodeWidget extends StatelessWidget {
Widget build(BuildContext context) {
final colors = context.componentColors;
- // The edit button is 24px (6px padding + 12px icon + 6px padding)
- // Plus 12px tap padding on each side = 48px total tap area
- // We need extra space at bottom-right for the overlapping button
const editButtonSize = 24.0;
const tapPadding = 12.0;
- const overlapAmount = editButtonSize / 2; // How much it overlaps the box
+ const overlapAmount = editButtonSize / 2;
return Stack(
clipBehavior: Clip.none,
children: [
- // Add padding to the code box to make room for the edit button in layout
Padding(
padding: EdgeInsets.only(
bottom: shouldShowEdit ? overlapAmount + tapPadding : 0,
diff --git a/mobile/apps/photos/lib/ui/map/map_gallery_tile_badge.dart b/mobile/apps/photos/lib/ui/map/map_gallery_tile_badge.dart
index 94ac4d9e14..b13572d4eb 100644
--- a/mobile/apps/photos/lib/ui/map/map_gallery_tile_badge.dart
+++ b/mobile/apps/photos/lib/ui/map/map_gallery_tile_badge.dart
@@ -28,9 +28,7 @@ class MapGalleryTileBadge extends StatelessWidget {
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(2)),
shape: BoxShape.rectangle,
- // color: Color.fromRGBO(30, 215, 96, 1),
color: Colors.green,
- // color: Colors.redAccent,
),
child: Text(
formatNumber(size),
diff --git a/mobile/apps/photos/lib/ui/map/map_screen.dart b/mobile/apps/photos/lib/ui/map/map_screen.dart
index a284cbcf23..1c7c4d20ab 100644
--- a/mobile/apps/photos/lib/ui/map/map_screen.dart
+++ b/mobile/apps/photos/lib/ui/map/map_screen.dart
@@ -20,8 +20,6 @@ import "package:photos/ui/map/map_view.dart";
import "package:photos/ui/notification/toast.dart";
class MapScreen extends StatefulWidget {
- // Add a function parameter where the function returns a Future<List<File>>
-
final Future<List<EnteFile>> Function() filesFutureFn;
final LatLng? center;
final double initialZoom;
diff --git a/mobile/apps/photos/lib/ui/settings/backup/backup_item_card.dart b/mobile/apps/photos/lib/ui/settings/backup/backup_item_card.dart
index df24f1b6e9..77e0b1c30a 100644
--- a/mobile/apps/photos/lib/ui/settings/backup/backup_item_card.dart
+++ b/mobile/apps/photos/lib/ui/settings/backup/backup_item_card.dart
@@ -32,7 +32,6 @@ class _BackupItemCardState extends State<BackupItemCard> {
super.initState();
folderName = widget.item.file.deviceFolder ?? '';
- // Delay rendering of the thumbnail for 0.5 seconds
Timer(const Duration(milliseconds: 500), () {
if (mounted) {
setState(() {
@@ -88,9 +87,7 @@ class _BackupItemCardState extends State<BackupItemCard> {
widget.item.file,
shouldShowSyncStatus: false,
)
- : Container(
- color: colorScheme.fillFaint, // Placeholder color
- ),
+ : Container(color: colorScheme.fillFaint),
),
),
const SizedBox(width: 12),
diff --git a/mobile/apps/photos/lib/ui/settings/storage_card_widget.dart b/mobile/apps/photos/lib/ui/settings/storage_card_widget.dart
index f512626567..77fe8241a9 100644
--- a/mobile/apps/photos/lib/ui/settings/storage_card_widget.dart
+++ b/mobile/apps/photos/lib/ui/settings/storage_card_widget.dart
@@ -304,7 +304,6 @@ class _StorageCardWidgetState extends State<StorageCardWidget> {
late num currentUsage, totalStorage;
late String currentUsageUnit, totalStorageUnit;
- // Determine the appropriate usage and units
if (shouldShowUsedStorageInTBs) {
currentUsage = usedStorageInTB;
currentUsageUnit = "TB";
@@ -316,7 +315,6 @@ class _StorageCardWidgetState extends State<StorageCardWidget> {
currentUsageUnit = "GB";
}
- // Determine the appropriate total storage and units
if (shouldShowTotalStorageInTBs) {
totalStorage = totalStorageInTB;
totalStorageUnit = "TB";
diff --git a/mobile/apps/photos/lib/ui/sharing/more_count_badge.dart b/mobile/apps/photos/lib/ui/sharing/more_count_badge.dart
index be12380f8d..7336a2746a 100644
--- a/mobile/apps/photos/lib/ui/sharing/more_count_badge.dart
+++ b/mobile/apps/photos/lib/ui/sharing/more_count_badge.dart
@@ -62,7 +62,6 @@ class MoreCountWidget extends StatelessWidget {
scale: 0.85,
child: Text(
displayChar.toUpperCase(),
- // fixed color
style: textStyle,
),
),
diff --git a/mobile/apps/photos/lib/ui/sharing/user_avator_widget.dart b/mobile/apps/photos/lib/ui/sharing/user_avator_widget.dart
index db1f434f19..65048b6127 100644
--- a/mobile/apps/photos/lib/ui/sharing/user_avator_widget.dart
+++ b/mobile/apps/photos/lib/ui/sharing/user_avator_widget.dart
@@ -211,7 +211,6 @@ class AvatarIdentityWidget extends StatelessWidget {
backgroundColor: avatarBackgroundColor(context, identity),
child: Text(
identity.initials,
- // fixed color
style: textStyle.copyWith(color: Colors.white),
),
),
diff --git a/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart b/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart
index 84679fc99d..282df51d1e 100644
--- a/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart
+++ b/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart
@@ -44,7 +44,6 @@ class _PathStorageViewerState extends State<PathStorageViewer> {
@override
void didUpdateWidget(PathStorageViewer oldWidget) {
super.didUpdateWidget(oldWidget);
- // Refresh the future when the widget updates (key changes)
if (oldWidget.item.path != widget.item.path ||
oldWidget.key != widget.key) {
_statFuture = getDirectoryStat(Directory(widget.item.path));
diff --git a/mobile/apps/photos/lib/ui/tools/deduplicate_page.dart b/mobile/apps/photos/lib/ui/tools/deduplicate_page.dart
index 0c697b9d6a..f98615ff59 100644
--- a/mobile/apps/photos/lib/ui/tools/deduplicate_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/deduplicate_page.dart
@@ -125,7 +125,7 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
return Padding(
padding: const EdgeInsets.all(4),
child: Text(
- value, // Show the value
+ value,
style: getEnteTextTheme(context).bodyMuted,
),
);
@@ -358,7 +358,6 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
child: GridView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
- // to disable GridView's scrolling
itemBuilder: (context, index) {
return _buildFile(context, duplicates.files[index], itemIndex);
},
@@ -412,7 +411,6 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
- //the numerator will give the width of the screen excuding the whitespaces in the the grid row
height:
(MediaQuery.of(context).size.width -
(crossAxisSpacing * crossAxisCount)) /
diff --git a/mobile/apps/photos/lib/ui/tools/similar_images_page.dart b/mobile/apps/photos/lib/ui/tools/similar_images_page.dart
index 73264371e3..4b513d9aff 100644
--- a/mobile/apps/photos/lib/ui/tools/similar_images_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/similar_images_page.dart
@@ -56,7 +56,7 @@ class _SimilarImagesPageState extends State<SimilarImagesPage> {
bool _isDisposed = false;
SimilarImagesPageState _pageState = SimilarImagesPageState.setup;
- double _distanceThreshold = 0.04; // Default value
+ double _distanceThreshold = 0.04;
List<SimilarFiles> _similarFilesList = [];
SortKey _sortKey = SortKey.size;
@@ -793,7 +793,7 @@ class _SimilarImagesPageState extends State<SimilarImagesPage> {
);
},
),
- const SizedBox(height: 16), // Add spacing between groups
+ const SizedBox(height: 16),
],
),
);
diff --git a/mobile/apps/photos/lib/utils/avatar_util.dart b/mobile/apps/photos/lib/utils/avatar_util.dart
index fbf7a734de..79697ff124 100644
--- a/mobile/apps/photos/lib/utils/avatar_util.dart
+++ b/mobile/apps/photos/lib/utils/avatar_util.dart
@@ -4,10 +4,10 @@ import "package:flutter/material.dart";
enum AvatarIdentityRole {
standard,
- /// Kept black across themes to preserve the established "me" treatment.
+ // Keep black across themes for the established "me" treatment.
currentUser,
- /// A non-user uploading through a public Collect link.
+ // A non-user uploading through a public Collect link.
publicUploader,
}
diff --git a/mobile/apps/photos/lib/utils/bg_task_utils.dart b/mobile/apps/photos/lib/utils/bg_task_utils.dart
index 229f95eaf1..8842734f70 100644
--- a/mobile/apps/photos/lib/utils/bg_task_utils.dart
+++ b/mobile/apps/photos/lib/utils/bg_task_utils.dart
@@ -103,7 +103,6 @@ class BgTaskUtils {
);
$.info("WorkManager configured");
- // Check if task is scheduled (Android only)
if (Platform.isAndroid) {
final isScheduled = await workmanager.Workmanager()
.isScheduledByUniqueName(backgroundTaskIdentifier);
diff --git a/mobile/apps/photos/lib/utils/cache_util.dart b/mobile/apps/photos/lib/utils/cache_util.dart
index 04b79215dc..d21c1d881c 100644
--- a/mobile/apps/photos/lib/utils/cache_util.dart
+++ b/mobile/apps/photos/lib/utils/cache_util.dart
@@ -9,9 +9,6 @@ final _computer = Computer.shared();
final _logger = Logger("CacheUtil");
-/// Writes data to a JSON file at the specified path using the provided method, inside computer.
-/// The method should convert the data to a JSON string.
-/// The JSON string is then UTF-8 encoded and written to the file.
Future<void> writeToJsonFile<P>(
String filePath,
P data,
@@ -44,9 +41,6 @@ Future<void> _writeToJsonFile<P>(Map<String, dynamic> args) async {
}
}
-/// Reads a JSON file from the specified path using the provided method, inside computer.
-/// The method should decode the JSON string into an object.
-/// The JSON string is expected to be UTF-8 encoded.
Future<P?> decodeJsonFile<P>(
String filePath,
P Function(String) jsonDecodeMethod,
diff --git a/mobile/apps/photos/lib/utils/debug_ml_export_data.dart b/mobile/apps/photos/lib/utils/debug_ml_export_data.dart
index c61b4469f4..26b7434138 100644
--- a/mobile/apps/photos/lib/utils/debug_ml_export_data.dart
+++ b/mobile/apps/photos/lib/utils/debug_ml_export_data.dart
@@ -9,23 +9,15 @@ Future<void> encodeAndSaveData(
String fileName, [
String? service,
]) async {
- // Convert map keys to strings if nestedData is a map
final dataToEncode = nestedData is Map
? nestedData.map((key, value) => MapEntry(key.toString(), value))
: nestedData;
- // Step 1: Serialize Your Data
final String jsonData = jsonEncode(dataToEncode);
- // Step 2: Encode the JSON String to Base64
- // final String base64String = base64Encode(utf8.encode(jsonData));
-
- // Step 3 & 4: Write the Base64 String to a File and Execute the Function
try {
final File file = await _writeStringToFile(jsonData, fileName);
- // Success, handle the file, e.g., print the file path
log('[$service]: File saved at ${file.path}');
} catch (e) {
- // If an error occurs, handle it.
log('[$service]: Error saving file: $e');
}
}
diff --git a/mobile/apps/photos/lib/utils/delete_file_util.dart b/mobile/apps/photos/lib/utils/delete_file_util.dart
index c64fb4c6cc..5f4d297397 100644
--- a/mobile/apps/photos/lib/utils/delete_file_util.dart
+++ b/mobile/apps/photos/lib/utils/delete_file_util.dart
@@ -523,7 +523,7 @@ Future<LocalDeletionResult> deleteLocalFilesAfterRemovingAlreadyDeletedIDs(
return combineDeletionResults(sharedMediaResult, platformResult);
}
-/// Only to be used on Android
+// Only use on Android.
Future<LocalDeletionResult>
retryFreeUpSpaceAfterRemovingAssetsNonExistingInDisk(
BuildContext context, {
@@ -1206,7 +1206,6 @@ class DeleteConfirmationSheetState extends State<DeleteConfirmationSheet> {
),
),
actions: [
- // Expanded target choices
AnimatedSize(
duration: const Duration(milliseconds: 200),
curve: Curves.easeOut,
@@ -1270,7 +1269,6 @@ class DeleteConfirmationSheetState extends State<DeleteConfirmationSheet> {
],
)
:
- // Preferred target shortcut
ButtonComponent(
label: switch (deletePreference) {
DeletePreference.DeleteFromRemoteOnly =>
@@ -1293,7 +1291,6 @@ class DeleteConfirmationSheetState extends State<DeleteConfirmationSheet> {
),
),
),
- // Preference control
if (widget.isLocal && widget.isRemote)
ConstrainedBox(
constraints: const BoxConstraints(minHeight: 48),
diff --git a/mobile/apps/photos/lib/utils/dialog_util.dart b/mobile/apps/photos/lib/utils/dialog_util.dart
index 63ceba8be8..0df54126cd 100644
--- a/mobile/apps/photos/lib/utils/dialog_util.dart
+++ b/mobile/apps/photos/lib/utils/dialog_util.dart
@@ -19,7 +19,7 @@ import 'package:photos/ui/components/dialog_widget.dart';
import 'package:photos/ui/components/models/button_type.dart';
import "package:photos/utils/email_util.dart";
-/// Legacy info-dialog helper backed by [showDialogWidget].
+// Legacy wrapper around showDialogWidget.
Future<ButtonResult?> showInfoDialog(
BuildContext context, {
String title = "",
@@ -44,7 +44,7 @@ Future<ButtonResult?> showInfoDialog(
);
}
-/// Legacy error-dialog helper backed by [showDialogWidget].
+// Legacy wrapper around showDialogWidget.
Future<ButtonResult?> showErrorDialog(
BuildContext context,
String title,
@@ -69,7 +69,7 @@ Future<ButtonResult?> showErrorDialog(
);
}
-/// Legacy exception-dialog helper backed by [showDialogWidget].
+// Legacy wrapper around showDialogWidget.
Future<ButtonResult?> showErrorDialogForException({
required BuildContext context,
required Exception exception,
@@ -139,7 +139,6 @@ String parseErrorForUI(
}
}
- // return generic error if the user is not internal and the error is not in debug mode
if (!(flagService.internalUser && kDebugMode)) {
return genericError;
}
@@ -170,7 +169,7 @@ String parseErrorForUI(
return genericError;
}
-/// Legacy parsed-error dialog helper backed by [showDialogWidget].
+// Legacy wrapper around showDialogWidget.
Future<ButtonResult?> showGenericErrorDialog({
required BuildContext context,
bool isDismissible = true,
@@ -244,7 +243,7 @@ Future<void> showGenericErrorBottomSheet({
);
}
-/// Legacy two-choice dialog helper backed by [showDialogWidget].
+// Legacy wrapper around showDialogWidget.
Future<ButtonResult?> showChoiceDialog(
BuildContext context, {
required String title,
@@ -287,11 +286,7 @@ Future<ButtonResult?> showChoiceDialog(
);
}
-/// Compatibility adapter for legacy Photos choice sheets.
-///
-/// Preserves existing two-choice [ButtonResult] behavior while rendering
-/// through [BottomSheetComponent]. Prefer [BottomSheetComponent] directly for
-/// new sheets.
+// Legacy; use BottomSheetComponent for new sheets.
Future<ButtonResult?> showChoiceActionSheet(
BuildContext context, {
required String title,
@@ -359,10 +354,8 @@ ProgressDialog createProgressDialog(
return dialog;
}
-/// Compatibility adapter for legacy Photos text-input dialogs.
-///
-/// Returns null on successful submit, [ButtonResult] on cancel, and [Exception]
-/// on submit failure. Prefer [BottomSheetComponent] directly for new sheets.
+// Returns null after submit, ButtonResult on cancel, and Exception on failure.
+// Use BottomSheetComponent for new dialogs.
Future<dynamic> showTextInputDialog(
BuildContext context, {
required String title,
diff --git a/mobile/apps/photos/lib/utils/email_util.dart b/mobile/apps/photos/lib/utils/email_util.dart
index 1892772fd2..28900ecbd9 100644
--- a/mobile/apps/photos/lib/utils/email_util.dart
+++ b/mobile/apps/photos/lib/utils/email_util.dart
@@ -253,7 +253,7 @@ Future<void> exportLogs(BuildContext context, String zipFilePath) async {
final Size size = MediaQuery.of(context).size;
if (Platform.isAndroid) {
final DateTime now = DateTime.now().toUtc();
- final String shortMonthName = DateFormat('MMM').format(now); // Short month
+ final String shortMonthName = DateFormat('MMM').format(now);
final String logFileName =
'ente-logs-${now.year}-$shortMonthName-${now.day}-${now.hour}-${now.minute}';
await FileSaver.instance.saveAs(
diff --git a/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart b/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart
index b0f10d3fe2..377435abdf 100644
--- a/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart
+++ b/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart
@@ -134,7 +134,7 @@ Future<void> checkRemoveCachedFaceIDForPersonOrClusterId(
}
}
-/// Careful to only use [personOrClusterID] if all [faces] are from the same person or cluster.
+// Pass personOrClusterID only when every face belongs to that person or cluster.
Future<Map<String, Uint8List>?> getCachedFaceCrops(
EnteFile enteFile,
Iterable<Face> faces, {
@@ -409,7 +409,6 @@ Future<Map<String, Uint8List>?> _getFaceCrops(
}
final List<Uint8List> faceCrop = await FaceThumbnailGenerator.instance
.generateFaceThumbnails(
- // await generateJpgFaceThumbnails(
imagePath,
faceBoxes,
);
diff --git a/mobile/apps/photos/lib/utils/gzip.dart b/mobile/apps/photos/lib/utils/gzip.dart
index a1968973ea..44187d836b 100644
--- a/mobile/apps/photos/lib/utils/gzip.dart
+++ b/mobile/apps/photos/lib/utils/gzip.dart
@@ -18,7 +18,6 @@ Uint8List _unGzipUInt8List(Uint8List compressedData) {
return Uint8List.fromList(decompressedList);
}
-// gzipUInt8List
Uint8List _gzipUInt8List(Uint8List data) {
final codec = GZipCodec();
final compressedData = codec.encode(data);
@@ -55,7 +54,6 @@ Map<String, dynamic> decryptAndUnzipJsonSync(
return jsonDecode(json);
}
-// zipJsonAndEncryptSync performs all operations synchronously, on a single isolate.
ChaChaEncryptionResult gzipAndEncryptJsonSync(
Map<String, dynamic> jsonData,
Uint8List key,
diff --git a/mobile/apps/photos/lib/utils/isolate/super_isolate.dart b/mobile/apps/photos/lib/utils/isolate/super_isolate.dart
index 642a6b134d..5455992a4d 100644
--- a/mobile/apps/photos/lib/utils/isolate/super_isolate.dart
+++ b/mobile/apps/photos/lib/utils/isolate/super_isolate.dart
@@ -92,9 +92,6 @@ abstract class SuperIsolate {
});
}
- /// The common method to run any operation in the isolate.
- /// It sends the [message] to [_isolateMain] and waits for the result.
- /// The actual function executed is [isolateFunction].
Future<dynamic> runInIsolate(
IsolateOperation operation,
Map<String, dynamic> args,
@@ -124,7 +121,6 @@ abstract class SuperIsolate {
IsolateLogger.handLogStringsToMainLogger(logs);
final data = receivedMessage['data'];
if (data is Map && data.containsKey('error')) {
- // Handle the error
final errorMessage = data['error'];
final errorStackTrace = data['stackTrace'];
final exception = Exception(errorMessage);
@@ -148,7 +144,6 @@ abstract class SuperIsolate {
});
}
- /// Clears specific data from the isolate's cache
Future<void> clearCachedData(String key) async {
await runInIsolate(IsolateOperation.clearIsolateCache, {'key': key});
}
@@ -157,15 +152,11 @@ abstract class SuperIsolate {
await runInIsolate(IsolateOperation.clearAllIsolateCache, {});
}
- /// Resets a timer that kills the isolate after a certain amount of inactivity.
- ///
- /// Should be called after initialization (e.g. inside `init()`) and after every call to isolate (e.g. inside `_runInIsolate()`)
void _resetInactivityTimer() {
_inactivityTimer?.cancel();
_inactivityTimer = Timer(_inactivityDuration, () {
if (_activeTasks > 0) {
logger.info('Tasks are still running. Delaying isolate disposal.');
- // Optionally, reschedule the timer to check again later.
_resetInactivityTimer();
} else {
logger.info(
diff --git a/mobile/apps/photos/lib/utils/magic_util.dart b/mobile/apps/photos/lib/utils/magic_util.dart
index 48e7b2e873..8a87531f40 100644
--- a/mobile/apps/photos/lib/utils/magic_util.dart
+++ b/mobile/apps/photos/lib/utils/magic_util.dart
@@ -246,8 +246,7 @@ Future<void> updateShareeOrder(
}
}
-// changeCoverPhoto is used to change cover photo for a collection. To reset to
-// default cover photo, pass uploadedFileID as 0
+// Pass 0 to restore the default cover.
Future<void> changeCoverPhoto(
BuildContext context,
Collection collection,
diff --git a/mobile/apps/photos/lib/utils/photos_crypto_api_adapter.dart b/mobile/apps/photos/lib/utils/photos_crypto_api_adapter.dart
index 19f35a04c9..d271760c92 100644
--- a/mobile/apps/photos/lib/utils/photos_crypto_api_adapter.dart
+++ b/mobile/apps/photos/lib/utils/photos_crypto_api_adapter.dart
@@ -4,10 +4,8 @@ import "package:ente_crypto/ente_crypto.dart" as ente_crypto;
import "package:ente_crypto_api/ente_crypto_api.dart";
import "package:flutter_sodium/flutter_sodium.dart";
-/// A [CryptoApi] backed by photos' existing [ente_crypto] (flutter_sodium), so
-/// the lock screen reuses photos' libsodium instead of pulling in a second one.
-///
-/// Only the subset the lock screen calls is implemented; anything else throws.
+// Reuses Photos' flutter_sodium for the lock screen instead of loading a second
+// libsodium implementation. Methods unused by the lock screen throw.
class PhotosCryptoApiAdapter implements CryptoApi {
const PhotosCryptoApiAdapter();
diff --git a/mobile/apps/photos/lib/utils/ram_check_util.dart b/mobile/apps/photos/lib/utils/ram_check_util.dart
index 2f169bea05..23870db569 100644
--- a/mobile/apps/photos/lib/utils/ram_check_util.dart
+++ b/mobile/apps/photos/lib/utils/ram_check_util.dart
@@ -1,6 +1,6 @@
import "package:ente_photos_platform/ente_photos_platform.dart";
-/// The total amount of RAM in the device in MB
+// Total device RAM in MB.
int? deviceTotalRAM;
bool get enoughRamForLocalIndexing =>
@@ -12,7 +12,6 @@ bool get hasLessThan5GBRAM =>
bool get enoughRamForLocalGalleryLocalIndexing =>
deviceTotalRAM == null || deviceTotalRAM! > 3 * 1024;
-/// Return the total amount of RAM in the device in MB
Future<int?> checkDeviceTotalRAM() async {
if (deviceTotalRAM != null) return deviceTotalRAM;
try {
diff --git a/mobile/apps/photos/lib/utils/separators_util.dart b/mobile/apps/photos/lib/utils/separators_util.dart
index 0ad153c656..bd5d26d07b 100644
--- a/mobile/apps/photos/lib/utils/separators_util.dart
+++ b/mobile/apps/photos/lib/utils/separators_util.dart
@@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
-//This method returns a newly declared list with separators. It will not
-//modify the original list
List<Widget> addSeparators(List<Widget> listOfWidgets, Widget separator) {
final int initialLength = listOfWidgets.length;
final listOfWidgetsWithSeparators = <Widget>[];
diff --git a/mobile/apps/photos/lib/utils/share_util.dart b/mobile/apps/photos/lib/utils/share_util.dart
index d594813296..cb4070ee4f 100644
--- a/mobile/apps/photos/lib/utils/share_util.dart
+++ b/mobile/apps/photos/lib/utils/share_util.dart
@@ -20,7 +20,6 @@ import "package:uuid/uuid.dart";
final _logger = Logger("ShareUtil");
-/// share is used to share media/files from ente to other apps
Future<void> share(
BuildContext context,
List<EnteFile> files, {
@@ -98,8 +97,6 @@ Future<void> share(
}
}
-/// Returns the rect of button if context and key are not null
-/// If key is null, returned rect will be at the center of the screen
Rect shareButtonRect(BuildContext context, GlobalKey? shareButtonKey) {
Size size = MediaQuery.sizeOf(context);
final RenderObject? renderObject = shareButtonKey?.currentContext
@@ -139,7 +136,6 @@ Future<ShareResult> shareText(
String formatMemoryShareText(String title, String shareUrl) =>
'$title: $shareUrl';
-/// Shares URL first with description below
Future<ShareResult> shareLinkWithDescription(
String url, {
String? description,
@@ -165,7 +161,6 @@ Future<List<EnteFile>> convertIncomingSharedMediaToFile(
}
final enteFile = EnteFile();
final sharedLocalId = const Uuid().v4();
- // fileName: img_x.jpg
enteFile.title = basename(media.path);
var ioFile = File(media.path);
try {
@@ -174,10 +169,7 @@ Future<List<EnteFile>> convertIncomingSharedMediaToFile(
);
} catch (e) {
if (e is FileSystemException) {
- //from renameSync docs:
- //On some platforms, a rename operation cannot move a file between
- //different file systems. If that is the case, instead copySync the
- //file to the new location and then deleteSync the original.
+ // renameSync may not move files across filesystems.
_logger.info("Creating new copy of file in path ${ioFile.path}");
final newIoFile = ioFile.copySync(
Configuration.instance.getSharedMediaDirectory() +
@@ -238,10 +230,8 @@ Future<List<EnteFile>> convertPicketAssets(
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'),
);
@@ -272,10 +262,7 @@ Future<void> shareAlbumLink(
await shareLinkWithDescription(url, context: context, key: key);
}
-/// required for ipad https://github.com/flutter/flutter/issues/47220#issuecomment-608453383
-/// This returns the position of the share button if context and key are not null
-/// and if not, it returns a default position so that the share sheet on iPad has
-/// some position to show up.
+// iPad share sheets require a source rectangle.
Rect _sharePosOrigin(BuildContext? context, GlobalKey? key) {
late final Rect rect;
if (context != null) {
diff --git a/mobile/apps/photos/plugins/ente_feature_flag/lib/src/model.dart b/mobile/apps/photos/plugins/ente_feature_flag/lib/src/model.dart
index 4953f5326b..0fdde69249 100644
--- a/mobile/apps/photos/plugins/ente_feature_flag/lib/src/model.dart
+++ b/mobile/apps/photos/plugins/ente_feature_flag/lib/src/model.dart
@@ -34,7 +34,6 @@ class RemoteFlags {
required this.customDomainCNAME,
});
- // CopyWith
RemoteFlags copyWith({
bool? enableStripe,
bool? disableCFWorker,
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.dart
index 85d67ded40..7cf14bddce 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
@@ -47,7 +47,6 @@ class FlagService {
bool get disableCFWorker => flags.disableCFWorker;
- /// Returns true if the user is an internal user, respecting the debug toggle.
bool get internalUser {
final isDisabled = _prefs.getBool("ls.internal_user_disabled") ?? false;
return (flags.internalUser || kDebugMode) && !isDisabled;
diff --git a/mobile/apps/photos/plugins/ente_panorama_viewer/lib/src/models.dart b/mobile/apps/photos/plugins/ente_panorama_viewer/lib/src/models.dart
index e5eb5018cf..3b776cc7c2 100644
--- a/mobile/apps/photos/plugins/ente_panorama_viewer/lib/src/models.dart
+++ b/mobile/apps/photos/plugins/ente_panorama_viewer/lib/src/models.dart
@@ -1,16 +1,15 @@
import "dart:ui";
-/// Position and zoom of the panorama camera.
class PanoramaView {
const PanoramaView({this.longitude = 0, this.latitude = 0, this.zoom = 1});
- /// Horizontal camera angle in degrees.
+ // Horizontal angle in degrees.
final double longitude;
- /// Vertical camera angle in degrees.
+ // Vertical angle in degrees.
final double latitude;
- /// Magnification relative to the viewer's base field of view.
+ // Relative to the viewer's base field of view.
final double zoom;
PanoramaView copyWith({double? longitude, double? latitude, double? zoom}) {
@@ -33,7 +32,6 @@ class PanoramaView {
int get hashCode => Object.hash(longitude, latitude, zoom);
}
-/// Placement of the source image on its full equirectangular canvas.
class PanoramaGeometry {
PanoramaGeometry({required this.fullSize, required this.croppedArea}) {
final values = [
@@ -61,10 +59,10 @@ class PanoramaGeometry {
: fullSize = const Size(1, 1),
croppedArea = const Rect.fromLTWH(0, 0, 1, 1);
- /// Pixel dimensions of the complete equirectangular canvas.
+ // Complete equirectangular canvas dimensions in pixels.
final Size fullSize;
- /// Pixel rectangle occupied by the source image on [fullSize].
+ // Source image bounds within fullSize, in pixels.
final Rect croppedArea;
Rect get normalizedCrop => Rect.fromLTRB(
croppedArea.left / fullSize.width,
diff --git a/mobile/apps/photos/plugins/ente_panorama_viewer/lib/src/viewer.dart b/mobile/apps/photos/plugins/ente_panorama_viewer/lib/src/viewer.dart
index bf9da0fa57..2934532cb6 100644
--- a/mobile/apps/photos/plugins/ente_panorama_viewer/lib/src/viewer.dart
+++ b/mobile/apps/photos/plugins/ente_panorama_viewer/lib/src/viewer.dart
@@ -33,19 +33,16 @@ class EntePanoramaViewer extends StatefulWidget {
this.onError,
});
- /// Equirectangular source image, either full or cropped.
+ // Full or cropped equirectangular image.
final ImageProvider image;
- /// Placement of [image] on its complete equirectangular canvas.
final PanoramaGeometry geometry;
- /// Camera used only on mount and when [image] changes.
+ // Used only on mount and when image changes.
final PanoramaView? initialView;
- /// Whether device orientation should adjust the camera.
final bool motionEnabled;
- /// Shown until both the image and fragment shader are ready.
final Widget? placeholder;
final VoidCallback? onTap;
final ValueChanged<PanoramaView>? onViewChanged;