Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mobile/apps/locker/lib/extensions/user_extension.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "package:ente_sharing/models/user.dart";
import "package:ente_sharing/models/user.dart";

extension UserExtension on User {
//Some initial users have name in name field.
Expand Down
57 changes: 56 additions & 1 deletion mobile/apps/locker/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -553,5 +553,60 @@
"noSystemLockFound": "No system lock found",
"toEnableAppLockPleaseSetupDevicePasscodeOrScreen": "To enable app lock, please setup device passcode or screen lock in your system settings.",
"legacy": "Legacy",
"authToManageLegacy": "Please authenticate to manage your trusted contacts"
"authToManageLegacy": "Please authenticate to manage your trusted contacts",
"uploadError": "Upload Error",
"tryAdjustingYourSearchQuery": "Try adjusting your search query",
"noFilesFoundForQuery": "No files found for \"{query}\"",
"@noFilesFoundForQuery": {
"description": "Message when no files match the search query",
"placeholders": {
"query": {
"type": "String",
"example": "vacation"
}
}
},
"deselectAll": "Deselect All",
"selectAll": "Select All",
"unnamedCollection": "Unnamed Collection",
"enteLocker": "ente Locker",
"uploadedFilesProgress": "Uploaded {completed}/{total} files...",
"@uploadedFilesProgress": {
"description": "Progress message showing uploaded files",
"placeholders": {
"completed": {
"type": "int",
"example": "3"
},
"total": {
"type": "int",
"example": "5"
}
}
},
"uploadedFilesProgressWithError": "Uploaded {completed}/{total} files... ({error})",
"@uploadedFilesProgressWithError": {
"description": "Progress message showing uploaded files with error",
"placeholders": {
"completed": {
"type": "int",
"example": "3"
},
"total": {
"type": "int",
"example": "5"
},
"error": {
"type": "String",
"example": "Network error"
}
}
},
"noCollectionsAvailableForSelection": "No collections available",
"createCollectionButton": "Create collection",
"collectionButtonLabel": "Collection",
"hideWindow": "Hide Window",
"showWindow": "Show Window",
"exitApp": "Exit App",
"lockerLogs": "Locker logs"
}
102 changes: 102 additions & 0 deletions mobile/apps/locker/lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1881,6 +1881,108 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Please authenticate to manage your trusted contacts'**
String get authToManageLegacy;

/// No description provided for @uploadError.
///
/// In en, this message translates to:
/// **'Upload Error'**
String get uploadError;

/// No description provided for @tryAdjustingYourSearchQuery.
///
/// In en, this message translates to:
/// **'Try adjusting your search query'**
String get tryAdjustingYourSearchQuery;

/// Message when no files match the search query
///
/// In en, this message translates to:
/// **'No files found for \"{query}\"'**
String noFilesFoundForQuery(String query);

/// No description provided for @deselectAll.
///
/// In en, this message translates to:
/// **'Deselect All'**
String get deselectAll;

/// No description provided for @selectAll.
///
/// In en, this message translates to:
/// **'Select All'**
String get selectAll;

/// No description provided for @unnamedCollection.
///
/// In en, this message translates to:
/// **'Unnamed Collection'**
String get unnamedCollection;

/// No description provided for @enteLocker.
///
/// In en, this message translates to:
/// **'ente Locker'**
String get enteLocker;

/// Progress message showing uploaded files
///
/// In en, this message translates to:
/// **'Uploaded {completed}/{total} files...'**
String uploadedFilesProgress(int completed, int total);

/// Progress message showing uploaded files with error
///
/// In en, this message translates to:
/// **'Uploaded {completed}/{total} files... ({error})'**
String uploadedFilesProgressWithError(int completed, int total, String error);

/// No description provided for @noCollectionsAvailableForSelection.
///
/// In en, this message translates to:
/// **'No collections available'**
String get noCollectionsAvailableForSelection;

/// No description provided for @createCollectionButton.
///
/// In en, this message translates to:
/// **'Create collection'**
String get createCollectionButton;

/// No description provided for @collectionButtonLabel.
///
/// In en, this message translates to:
/// **'Collection'**
String get collectionButtonLabel;

/// No description provided for @hideWindow.
///
/// In en, this message translates to:
/// **'Hide Window'**
String get hideWindow;

/// No description provided for @showWindow.
///
/// In en, this message translates to:
/// **'Show Window'**
String get showWindow;

/// No description provided for @exitApp.
///
/// In en, this message translates to:
/// **'Exit App'**
String get exitApp;

/// No description provided for @lockerLogs.
///
/// In en, this message translates to:
/// **'Locker logs'**
String get lockerLogs;

/// No description provided for @debugLogsForLockerApp.
///
/// In en, this message translates to:
/// **'Debug logs for Locker app.\\n\\n'**
String get debugLogsForLockerApp;
}

class _AppLocalizationsDelegate
Expand Down
58 changes: 58 additions & 0 deletions mobile/apps/locker/lib/l10n/app_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1061,4 +1061,62 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get authToManageLegacy =>
'Please authenticate to manage your trusted contacts';

@override
String get uploadError => 'Upload Error';

@override
String get tryAdjustingYourSearchQuery => 'Try adjusting your search query';

@override
String noFilesFoundForQuery(String query) {
return 'No files found for \"$query\"';
}

@override
String get deselectAll => 'Deselect All';

@override
String get selectAll => 'Select All';

@override
String get unnamedCollection => 'Unnamed Collection';

@override
String get enteLocker => 'ente Locker';

@override
String uploadedFilesProgress(int completed, int total) {
return 'Uploaded $completed/$total files...';
}

@override
String uploadedFilesProgressWithError(
int completed, int total, String error) {
return 'Uploaded $completed/$total files... ($error)';
}

@override
String get noCollectionsAvailableForSelection => 'No collections available';

@override
String get createCollectionButton => 'Create collection';

@override
String get collectionButtonLabel => 'Collection';

@override
String get hideWindow => 'Hide Window';

@override
String get showWindow => 'Show Window';

@override
String get exitApp => 'Exit App';

@override
String get lockerLogs => 'Locker logs';

@override
String get debugLogsForLockerApp => 'Debug logs for Locker app.\\n\\n';
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dart:core';
import "package:ente_sharing/models/user.dart";
import 'package:flutter/foundation.dart';
import 'package:locker/services/collections/models/collection_magic.dart';
import 'package:locker/services/collections/models/public_url.dart';
import 'package:locker/services/collections/models/public_url.dart';
import 'package:locker/services/files/sync/models/common_keys.dart';

class Collection {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ enum CollectionViewType {
favorite
}


CollectionViewType getCollectionViewType(Collection c, int userID) {
if (!c.isOwner(userID)) {
return CollectionViewType.sharedCollection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import "package:locker/services/collections/models/collection.dart";
import "package:locker/ui/pages/collection_page.dart";

class CollectionFlexGridViewWidget extends StatefulWidget {
final List<Collection> collections;
final List<Collection> collections;
const CollectionFlexGridViewWidget({
super.key,
required this.collections,
required this.collections,
});

@override
Expand All @@ -21,12 +21,12 @@ class CollectionFlexGridViewWidget extends StatefulWidget {

class _CollectionFlexGridViewWidgetState
extends State<CollectionFlexGridViewWidget> {
late List<Collection> _displayedCollections;
late List<Collection> _displayedCollections;

@override
void initState() {
super.initState();
_displayedCollections = widget.collections;
_displayedCollections = widget.collections;
}

@override
Expand All @@ -47,7 +47,8 @@ class _CollectionFlexGridViewWidgetState
itemCount: min(_displayedCollections.length, 4),
itemBuilder: (context, index) {
final collection = _displayedCollections[index];
final collectionName = collection.name ?? 'Unnamed Collection';
final collectionName =
collection.name ?? context.l10n.unnamedCollection;

return GestureDetector(
onTap: () => _navigateToCollection(collection),
Expand Down
21 changes: 12 additions & 9 deletions mobile/apps/locker/lib/ui/components/file_row_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -292,18 +292,21 @@ class FileRowWidget extends StatelessWidget {
}

await dialog.hide();

SnackBarUtils.showInfoSnackBar(
context,
context.l10n.fileDeletedSuccessfully,
);
if (context.mounted) {
SnackBarUtils.showInfoSnackBar(
context,
context.l10n.fileDeletedSuccessfully,
);
}
} catch (e) {
await dialog.hide();

SnackBarUtils.showWarningSnackBar(
context,
context.l10n.failedToDeleteFile(e.toString()),
);
if (context.mounted) {
SnackBarUtils.showWarningSnackBar(
context,
context.l10n.failedToDeleteFile(e.toString()),
);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

39 changes: 27 additions & 12 deletions mobile/apps/locker/lib/ui/pages/all_collections_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class _AllCollectionsPageState extends State<AllCollectionsPage>
bool showTrash = false;
bool showUncategorized = false;
final _logger = Logger("AllCollectionsPage");
StreamSubscription<CollectionsUpdatedEvent>? _collectionsUpdatedSub;

@override
List<Collection> get allCollections => _allCollections;
Expand Down Expand Up @@ -82,7 +83,9 @@ class _AllCollectionsPageState extends State<AllCollectionsPage>
void initState() {
super.initState();
_loadCollections();
Bus.instance.on<CollectionsUpdatedEvent>().listen((event) async {
_collectionsUpdatedSub =
Bus.instance.on<CollectionsUpdatedEvent>().listen((event) async {
if (!mounted) return;
await _loadCollections();
});
if (widget.viewType == UISectionType.homeCollections) {
Expand All @@ -91,11 +94,19 @@ class _AllCollectionsPageState extends State<AllCollectionsPage>
}
}

@override
void dispose() {
_collectionsUpdatedSub?.cancel();
super.dispose();
}

Future<void> _loadCollections() async {
setState(() {
_isLoading = true;
_error = null;
});
if (mounted) {
setState(() {
_isLoading = true;
_error = null;
});
}

try {
List<Collection> collections = [];
Expand Down Expand Up @@ -139,15 +150,19 @@ class _AllCollectionsPageState extends State<AllCollectionsPage>
: 0;
_allFiles = await CollectionService.instance.getAllFiles();

setState(() {
_isLoading = false;
});
if (mounted) {
setState(() {
_isLoading = false;
});
}
} catch (e) {
_logger.severe("Failed to load collections", e);
setState(() {
_error = 'Failed to load collections: $e';
_isLoading = false;
});
if (mounted) {
setState(() {
_error = 'Failed to load collections: $e';
_isLoading = false;
});
}
}
}

Expand Down
Loading