Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][locker] Remove stale Locker code

AmanRajSinghMouryabb2a164de888
diff --git a/mobile/apps/locker/lib/services/files/sync/models/metadata_request.dart b/mobile/apps/locker/lib/services/files/sync/models/metadata_request.dart
deleted file mode 100644
index de0589e1ed..0000000000
--- a/mobile/apps/locker/lib/services/files/sync/models/metadata_request.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-class MetadataRequest {
- int? version;
- int? count;
- String? data;
- String? header;
-
- MetadataRequest({
- required this.version,
- required this.count,
- required this.data,
- required this.header,
- });
-
- MetadataRequest.fromJson(dynamic json) {
- version = json['version'];
- count = json['count'];
- data = json['data'];
- header = json['header'];
- }
-
- Map<String, dynamic> toJson() {
- final map = <String, dynamic>{};
- map['version'] = version;
- map['count'] = count;
- map['data'] = data;
- map['header'] = header;
- return map;
- }
-}
diff --git a/mobile/apps/locker/lib/ui/collections/collection_flex_grid_view.dart b/mobile/apps/locker/lib/ui/collections/collection_flex_grid_view.dart
deleted file mode 100644
index 44cacea62c..0000000000
--- a/mobile/apps/locker/lib/ui/collections/collection_flex_grid_view.dart
+++ /dev/null
@@ -1,87 +0,0 @@
-import "dart:math";
-
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:flutter/material.dart";
-import "package:hugeicons/hugeicons.dart";
-import "package:locker/extensions/collection_extension.dart";
-import "package:locker/l10n/l10n.dart";
-import "package:locker/services/collections/models/collection.dart";
-import "package:locker/ui/pages/collection_page.dart";
-
-class CollectionFlexGridViewWidget extends StatelessWidget {
- final List<Collection> collections;
- const CollectionFlexGridViewWidget({super.key, required this.collections});
-
- @override
- Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
-
- return MediaQuery.removePadding(
- context: context,
- removeBottom: true,
- removeTop: true,
- child: GridView.builder(
- shrinkWrap: true,
- physics: const NeverScrollableScrollPhysics(),
- gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: 2,
- crossAxisSpacing: 12,
- mainAxisSpacing: 12,
- childAspectRatio: 2.4,
- ),
- itemCount: min(collections.length, 4),
- itemBuilder: (context, index) {
- final collection = collections[index];
- final collectionName =
- collection.displayName ?? context.l10n.unnamedCollection;
-
- return GestureDetector(
- onTap: () {
- Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) => CollectionPage(collection: collection),
- ),
- );
- },
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(20),
- color: colorScheme.backdropBase,
- ),
- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Container(
- height: 32,
- width: 32,
- padding: const EdgeInsets.all(6),
- child: collection.type == CollectionType.favorites
- ? HugeIcon(
- icon: HugeIcons.strokeRoundedStar,
- color: colorScheme.primary700,
- )
- : HugeIcon(
- icon: HugeIcons.strokeRoundedWallet05,
- color: colorScheme.textBase,
- ),
- ),
- const SizedBox(width: 8),
- Expanded(
- child: Text(
- collectionName,
- style: textTheme.bodyBold,
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- ],
- ),
- ),
- );
- },
- ),
- );
- }
-}
diff --git a/mobile/apps/locker/lib/ui/collections/section_title.dart b/mobile/apps/locker/lib/ui/collections/section_title.dart
deleted file mode 100644
index 685e775b26..0000000000
--- a/mobile/apps/locker/lib/ui/collections/section_title.dart
+++ /dev/null
@@ -1,69 +0,0 @@
-import "package:ente_ui/theme/ente_theme.dart";
-import 'package:flutter/material.dart';
-
-class SectionTitle extends StatelessWidget {
- final String? title;
- final bool mutedTitle;
- final Widget? titleWithBrand;
- final EdgeInsetsGeometry? padding;
-
- const SectionTitle({
- this.title,
- this.titleWithBrand,
- this.mutedTitle = false,
- super.key,
- this.padding,
- });
-
- @override
- Widget build(BuildContext context) {
- Widget child;
- if (titleWithBrand != null) {
- child = titleWithBrand!;
- } else if (title != null) {
- child = Text(title!, style: getEnteTextTheme(context).h3Bold);
- } else {
- child = const SizedBox.shrink();
- }
- return child;
- }
-}
-
-class SectionOptions extends StatelessWidget {
- final Widget title;
- final Widget? trailingWidget;
- final VoidCallback? onTap;
- final String? body;
-
- const SectionOptions(
- this.title, {
- this.trailingWidget,
- super.key,
- this.body,
- this.onTap,
- });
-
- @override
- Widget build(BuildContext context) {
- if (trailingWidget != null) {
- final hasBody = body != null && body!.isNotEmpty;
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: onTap,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [title, trailingWidget!],
- ),
- if (hasBody)
- Text(body!, style: getEnteTextTheme(context).bodyMuted),
- ],
- ),
- );
- } else {
- return Container(child: title);
- }
- }
-}
diff --git a/mobile/apps/locker/lib/ui/components/button/copy_button.dart b/mobile/apps/locker/lib/ui/components/button/copy_button.dart
deleted file mode 100644
index 1ff7518fcc..0000000000
--- a/mobile/apps/locker/lib/ui/components/button/copy_button.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:flutter/material.dart";
-import "package:flutter/services.dart";
-import "package:locker/l10n/l10n.dart";
-
-class CopyButton extends StatefulWidget {
- final String url;
-
- const CopyButton({super.key, required this.url});
-
- @override
- State<CopyButton> createState() => _CopyButtonState();
-}
-
-class _CopyButtonState extends State<CopyButton> {
- bool _isCopied = false;
-
- @override
- Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
-
- return IconButton(
- onPressed: () async {
- await Clipboard.setData(ClipboardData(text: widget.url));
- setState(() {
- _isCopied = true;
- });
- // Reset the state after 2 seconds
- Future.delayed(const Duration(seconds: 2), () {
- if (mounted) {
- setState(() {
- _isCopied = false;
- });
- }
- });
- },
- icon: Icon(
- _isCopied ? Icons.check : Icons.copy,
- size: 16,
- color: _isCopied ? colorScheme.primary500 : colorScheme.primary500,
- ),
- iconSize: 16,
- constraints: const BoxConstraints(),
- padding: const EdgeInsets.all(4),
- tooltip: _isCopied
- ? context.l10n.linkCopiedToClipboard
- : context.l10n.copyLink,
- );
- }
-}
diff --git a/mobile/apps/locker/lib/ui/components/collection_popup_menu_widget.dart b/mobile/apps/locker/lib/ui/components/collection_popup_menu_widget.dart
index 3351635f71..20b12a5fb8 100644
--- a/mobile/apps/locker/lib/ui/components/collection_popup_menu_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/collection_popup_menu_widget.dart
@@ -5,19 +5,16 @@ import "package:locker/l10n/l10n.dart";
import "package:locker/services/collections/models/collection.dart";
import "package:locker/services/collections/models/collection_view_type.dart";
import "package:locker/services/configuration.dart";
-import "package:locker/ui/components/item_list_view.dart";
import "package:locker/ui/components/popup_menu_item_widget.dart";
import "package:locker/utils/collection_actions.dart";
class CollectionPopupMenuWidget extends StatelessWidget {
final Collection collection;
- final List<OverflowMenuAction>? overflowActions;
final Widget? child;
const CollectionPopupMenuWidget({
super.key,
required this.collection,
- this.overflowActions,
this.child,
});
@@ -54,28 +51,6 @@ class CollectionPopupMenuWidget extends StatelessWidget {
List<PopupMenuItem<String>> _buildPopupMenuItems(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
- if (overflowActions != null && overflowActions!.isNotEmpty) {
- final items = <PopupMenuItem<String>>[];
- for (int i = 0; i < overflowActions!.length; i++) {
- final action = overflowActions![i];
- items.add(
- PopupMenuItem<String>(
- value: action.id,
- padding: EdgeInsets.zero,
- height: 0,
- child: PopupMenuItemWidget(
- icon: action.icon,
- label: action.label,
- isFirst: i == 0,
- isLast: i == overflowActions!.length - 1,
- isWarning: action.isWarning,
- ),
- ),
- );
- }
- return items;
- }
-
final collectionViewType = getCollectionViewType(
collection,
Configuration.instance.getUserID()!,
@@ -150,15 +125,6 @@ class CollectionPopupMenuWidget extends StatelessWidget {
}
void _handleMenuAction(BuildContext context, String action) {
- if (overflowActions != null && overflowActions!.isNotEmpty) {
- final customAction = overflowActions!.firstWhere(
- (a) => a.id == action,
- orElse: () => throw StateError('Action not found'),
- );
- customAction.onTap(context, null, collection);
- return;
- }
-
switch (action) {
case 'edit':
_editCollection(context);
diff --git a/mobile/apps/locker/lib/ui/components/file_popup_menu_widget.dart b/mobile/apps/locker/lib/ui/components/file_popup_menu_widget.dart
deleted file mode 100644
index 3f2f2247c2..0000000000
--- a/mobile/apps/locker/lib/ui/components/file_popup_menu_widget.dart
+++ /dev/null
@@ -1,221 +0,0 @@
-import "package:ente_events/event_bus.dart";
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:flutter/material.dart";
-import "package:hugeicons/hugeicons.dart";
-import "package:locker/events/collections_updated_event.dart";
-import "package:locker/l10n/l10n.dart";
-import "package:locker/services/favorites_service.dart";
-import "package:locker/services/files/sync/models/file.dart";
-import "package:locker/ui/components/item_list_view.dart";
-import "package:locker/ui/components/popup_menu_item_widget.dart";
-import "package:locker/utils/file_actions.dart";
-import "package:locker/utils/file_util.dart";
-
-class FilePopupMenuWidget extends StatelessWidget {
- final EnteFile file;
- final List<OverflowMenuAction>? overflowActions;
- final Widget? child;
- const FilePopupMenuWidget({
- super.key,
- required this.file,
- this.overflowActions,
- this.child,
- });
-
- @override
- Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
-
- return PopupMenuButton<String>(
- onSelected: (value) => _handleMenuAction(context, value),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(16),
- side: BorderSide(color: colorScheme.strokeFaint),
- ),
- offset: const Offset(-24, 24),
- color: colorScheme.backdropBase,
- surfaceTintColor: Colors.transparent,
- padding: EdgeInsets.zero,
- menuPadding: EdgeInsets.zero,
- elevation: 15,
- shadowColor: Colors.black.withValues(alpha: 0.08),
- constraints: const BoxConstraints(minWidth: 120),
- child:
- child ??
- HugeIcon(
- icon: HugeIcons.strokeRoundedMoreVertical,
- color: colorScheme.textBase,
- ),
- itemBuilder: (BuildContext context) {
- return _buildPopupMenuItems(context);
- },
- );
- }
-
- List<PopupMenuItem<String>> _buildPopupMenuItems(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
-
- if (overflowActions != null && overflowActions!.isNotEmpty) {
- final items = <PopupMenuItem<String>>[];
- for (int i = 0; i < overflowActions!.length; i++) {
- final action = overflowActions![i];
- items.add(
- PopupMenuItem<String>(
- value: action.id,
- padding: EdgeInsets.zero,
- height: 0,
- child: PopupMenuItemWidget(
- icon: action.icon,
- label: action.label,
- isFirst: i == 0,
- isLast: i == overflowActions!.length - 1,
- isWarning: action.isWarning,
- ),
- ),
- );
- }
- return items;
- }
-
- return [
- PopupMenuItem<String>(
- value: 'edit',
- padding: EdgeInsets.zero,
- height: 0,
- child: PopupMenuItemWidget(
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedPencilEdit02,
- color: colorScheme.textBase,
- size: 20,
- ),
- label: context.l10n.edit,
- isFirst: true,
- isLast: false,
- ),
- ),
- PopupMenuItem<String>(
- value: 'toggle_important',
- padding: EdgeInsets.zero,
- height: 0,
- child: Builder(
- builder: (context) {
- final isImportant = FavoritesService.instance.isFavoriteCache(file);
- return PopupMenuItemWidget(
- icon: Icon(
- isImportant ? Icons.star_rounded : Icons.star_border_rounded,
- color: colorScheme.textBase,
- size: 22,
- ),
- label: isImportant
- ? context.l10n.unimportant
- : context.l10n.important,
- isFirst: false,
- isLast: false,
- );
- },
- ),
- ),
- PopupMenuItem<String>(
- value: 'download',
- padding: EdgeInsets.zero,
- height: 0,
- child: PopupMenuItemWidget(
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedDownload01,
- color: colorScheme.textBase,
- size: 20,
- ),
- label: context.l10n.save,
- isFirst: false,
- isLast: false,
- ),
- ),
- PopupMenuItem<String>(
- value: 'share_link',
- padding: EdgeInsets.zero,
- height: 0,
- child: PopupMenuItemWidget(
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedShare08,
- color: colorScheme.textBase,
- size: 20,
- ),
- label: context.l10n.share,
- isFirst: false,
- isLast: false,
- ),
- ),
- PopupMenuItem<String>(
- value: 'delete',
- padding: EdgeInsets.zero,
- height: 0,
- child: PopupMenuItemWidget(
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedDelete02,
- color: colorScheme.warning500,
- size: 20,
- ),
- label: context.l10n.delete,
- isFirst: false,
- isLast: true,
- isWarning: true,
- ),
- ),
- ];
- }
-
- void _handleMenuAction(BuildContext context, String action) {
- if (overflowActions != null && overflowActions!.isNotEmpty) {
- final customAction = overflowActions!.firstWhere(
- (a) => a.id == action,
- orElse: () => throw StateError('Action not found'),
- );
- customAction.onTap(context, file, null);
- return;
- }
-
- switch (action) {
- case 'edit':
- _editFile(context);
- break;
- case 'toggle_important':
- _markImportant(context);
- break;
- case 'download':
- _downloadFile(context);
- break;
- case 'share_link':
- _shareFileLink(context);
- break;
- case 'delete':
- _deleteFile(context);
- break;
- }
- }
-
- Future<void> _shareFileLink(BuildContext context) async {
- await FileActions.shareFileLink(context, file);
- }
-
- Future<void> _downloadFile(BuildContext context) async {
- await FileUtil.downloadFile(context, file);
- }
-
- Future<void> _deleteFile(BuildContext context) async {
- await FileActions.deleteFile(
- context,
- file,
- onSuccess: () {
- Bus.instance.fire(CollectionsUpdatedEvent('file_deleted'));
- },
- );
- }
-
- Future<void> _editFile(BuildContext context) async {
- await FileActions.editFile(context, file);
- }
-
- Future<void> _markImportant(BuildContext context) async {
- await FileActions.markImportant(context, file);
- }
-}
diff --git a/mobile/apps/locker/lib/ui/components/file_restore_sheet.dart b/mobile/apps/locker/lib/ui/components/file_restore_sheet.dart
deleted file mode 100644
index 7341e24205..0000000000
--- a/mobile/apps/locker/lib/ui/components/file_restore_sheet.dart
+++ /dev/null
@@ -1,106 +0,0 @@
-import 'package:ente_ui/components/base_bottom_sheet.dart';
-import 'package:ente_ui/utils/toast_util.dart';
-import 'package:flutter/material.dart';
-import 'package:locker/l10n/l10n.dart';
-import 'package:locker/services/collections/models/collection.dart';
-import 'package:locker/services/files/sync/models/file.dart';
-import 'package:locker/ui/components/collection_selection_widget.dart';
-import "package:locker/ui/components/gradient_button.dart";
-
-class FileRestoreSheetResult {
- final List<Collection> selectedCollections;
-
- const FileRestoreSheetResult({required this.selectedCollections});
-}
-
-class FileRestoreSheet extends StatefulWidget {
- final EnteFile file;
- final List<Collection> collections;
-
- const FileRestoreSheet({
- super.key,
- required this.file,
- required this.collections,
- });
-
- @override
- State<FileRestoreSheet> createState() => _FileRestoreSheetState();
-}
-
-class _FileRestoreSheetState extends State<FileRestoreSheet> {
- final Set<int> _selectedCollectionIds = <int>{};
- List<Collection> _availableCollections = [];
-
- @override
- void initState() {
- super.initState();
- _availableCollections = List.from(widget.collections);
- }
-
- void _toggleCollection(int collectionId) {
- setState(() {
- if (_selectedCollectionIds.contains(collectionId)) {
- _selectedCollectionIds.remove(collectionId);
- } else {
- _selectedCollectionIds.add(collectionId);
- }
- });
- }
-
- void _onCollectionsUpdated(List<Collection> updatedCollections) {
- setState(() {
- _availableCollections = updatedCollections;
- });
- }
-
- Future<void> _onRestore() async {
- final selectedCollections = _availableCollections
- .where((c) => _selectedCollectionIds.contains(c.id))
- .toList();
-
- if (selectedCollections.isEmpty) {
- showToast(context, context.l10n.pleaseSelectAtLeastOneCollection);
- return;
- }
-
- Navigator.of(
- context,
- ).pop(FileRestoreSheetResult(selectedCollections: selectedCollections));
- }
-
- @override
- Widget build(BuildContext context) {
- return Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- CollectionSelectionWidget(
- collections: _availableCollections,
- selectedCollectionIds: _selectedCollectionIds,
- onToggleCollection: _toggleCollection,
- onCollectionsUpdated: _onCollectionsUpdated,
- title: "",
- singleSelectionMode: true,
- ),
- const SizedBox(height: 28),
- SizedBox(
- width: double.infinity,
- child: GradientButton(onTap: _onRestore, text: context.l10n.restore),
- ),
- ],
- );
- }
-}
-
-Future<FileRestoreSheetResult?> showFileRestoreSheet(
- BuildContext context, {
- required EnteFile file,
- required List<Collection> collections,
-}) {
- return showBaseBottomSheet<FileRestoreSheetResult>(
- context,
- title: context.l10n.restore,
- headerSpacing: 20,
- child: FileRestoreSheet(file: file, collections: collections),
- );
-}
diff --git a/mobile/apps/locker/lib/ui/components/item_list_view.dart b/mobile/apps/locker/lib/ui/components/item_list_view.dart
index 01f2faf319..ceb3cf049c 100644
--- a/mobile/apps/locker/lib/ui/components/item_list_view.dart
+++ b/mobile/apps/locker/lib/ui/components/item_list_view.dart
@@ -17,27 +17,6 @@ import "package:locker/ui/components/file_list_widget.dart";
import 'package:locker/ui/pages/collection_page.dart';
import 'package:locker/utils/collection_sort_util.dart';
-class OverflowMenuAction {
- final String id;
- final String label;
- final Widget icon;
- final bool isWarning;
- final void Function(
- BuildContext context,
- EnteFile? file,
- Collection? collection,
- )
- onTap;
-
- const OverflowMenuAction({
- required this.id,
- required this.label,
- required this.icon,
- required this.onTap,
- this.isWarning = false,
- });
-}
-
class ItemListView extends StatefulWidget {
static const double _selectionOverlayPadding = 200.0;
diff --git a/mobile/apps/locker/lib/ui/sharing/add_participant_page.dart b/mobile/apps/locker/lib/ui/sharing/add_participant_page.dart
deleted file mode 100644
index 2030d64900..0000000000
--- a/mobile/apps/locker/lib/ui/sharing/add_participant_page.dart
+++ /dev/null
@@ -1,463 +0,0 @@
-import 'package:email_validator/email_validator.dart';
-import 'package:ente_contacts/contacts.dart';
-import "package:ente_sharing/models/user.dart";
-import "package:ente_sharing/user_avator_widget.dart";
-import "package:ente_sharing/verify_identity_dialog.dart";
-import "package:ente_ui/components/buttons/button_widget.dart";
-import "package:ente_ui/components/buttons/models/button_type.dart";
-import "package:ente_ui/components/captioned_text_widget.dart";
-import "package:ente_ui/components/divider_widget.dart";
-import "package:ente_ui/components/menu_item_widget.dart";
-import "package:ente_ui/components/menu_section_description_widget.dart";
-import "package:ente_ui/components/menu_section_title.dart";
-import "package:ente_ui/components/separators.dart";
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:ente_ui/utils/toast_util.dart";
-import 'package:flutter/material.dart';
-import "package:locker/extensions/user_extension.dart";
-import "package:locker/l10n/l10n.dart";
-import "package:locker/services/collections/collections_service.dart";
-import "package:locker/services/collections/models/collection.dart";
-import "package:locker/services/configuration.dart";
-import "package:locker/utils/collection_actions.dart";
-
-enum ActionTypesToShow { addViewer, addCollaborator }
-
-class AddParticipantPage extends StatefulWidget {
- /// Cannot be empty
- final List<ActionTypesToShow> actionTypesToShow;
- final List<Collection> collections;
-
- AddParticipantPage(this.collections, this.actionTypesToShow, {super.key})
- : assert(actionTypesToShow.isNotEmpty, 'actionTypesToShow cannot be empty');
-
- @override
- State<StatefulWidget> createState() => _AddParticipantPage();
-}
-
-class _AddParticipantPage extends State<AddParticipantPage> {
- final _selectedEmails = <String>{};
- String _newEmail = '';
- bool _emailIsValid = false;
- bool isKeypadOpen = false;
- late List<User> _suggestedUsers;
-
- // Focus nodes are necessary
- final textFieldFocusNode = FocusNode();
- final _textController = TextEditingController();
-
- late CollectionActions collectionActions;
-
- @override
- void initState() {
- super.initState();
- _suggestedUsers = _getSuggestedUser();
- collectionActions = CollectionActions();
- }
-
- @override
- void dispose() {
- _textController.dispose();
- textFieldFocusNode.dispose();
- super.dispose();
- }
-
- @override
- Widget build(BuildContext context) {
- return ValueListenableBuilder<int>(
- valueListenable: ContactsDisplayService.instance.changes,
- builder: (context, _, _) {
- final filterSuggestedUsers =
- _suggestedUsers
- .where(
- (element) =>
- element.matchesResolvedNameOrEmail(_textController.text),
- )
- .toList()
- ..sort(
- (a, b) => a.resolvedDisplayName.toLowerCase().compareTo(
- b.resolvedDisplayName.toLowerCase(),
- ),
- );
- isKeypadOpen = MediaQuery.viewInsetsOf(context).bottom > 100;
- final enteTextTheme = getEnteTextTheme(context);
- final enteColorScheme = getEnteColorScheme(context);
- return Scaffold(
- resizeToAvoidBottomInset: isKeypadOpen,
- appBar: AppBar(title: Text(_getTitle())),
- body: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 12),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: Text(
- context.l10n.addANewEmail,
- style: enteTextTheme.small.copyWith(
- color: enteColorScheme.textMuted,
- ),
- ),
- ),
- const SizedBox(height: 4),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: _enterEmailField(),
- ),
- Expanded(
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: Column(
- children: [
- filterSuggestedUsers.isNotEmpty
- ? MenuSectionTitle(
- title: context.l10n.orPickAnExistingOne,
- )
- : const SizedBox.shrink(),
- Expanded(
- child: ListView.builder(
- physics: const BouncingScrollPhysics(),
- itemBuilder: (context, index) {
- if (index >= filterSuggestedUsers.length) {
- return Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 8.0,
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- filterSuggestedUsers.isNotEmpty
- ? MenuSectionDescriptionWidget(
- content: context
- .l10n
- .longPressAnEmailToVerifyEndToEndEncryption,
- )
- : const SizedBox.shrink(),
- widget.actionTypesToShow.contains(
- ActionTypesToShow.addCollaborator,
- )
- ? MenuSectionDescriptionWidget(
- content: context
- .l10n
- .collaboratorsCanAddFilesToTheSharedCollection,
- )
- : const SizedBox.shrink(),
- ],
- ),
- );
- }
- final currentUser = filterSuggestedUsers[index];
- return Column(
- children: [
- MenuItemWidget(
- key: ValueKey(
- '${currentUser.id ?? currentUser.email}:${currentUser.resolvedDisplayName}',
- ),
- captionedTextWidget: CaptionedTextWidget(
- title: currentUser.resolvedDisplayName,
- ),
- leadingIconSize: 24.0,
- leadingIconWidget: UserAvatarWidget(
- currentUser,
- type: AvatarType.mini,
- config: Configuration.instance,
- ),
- menuItemColor: getEnteColorScheme(
- context,
- ).fillFaint,
- pressedColor: getEnteColorScheme(
- context,
- ).fillFaint,
- trailingIcon:
- (_selectedEmails.contains(
- currentUser.email,
- ))
- ? Icons.check
- : null,
- onTap: () async {
- textFieldFocusNode.unfocus();
- if (_selectedEmails.contains(
- currentUser.email,
- )) {
- _selectedEmails.remove(currentUser.email);
- } else {
- _selectedEmails.add(currentUser.email);
- }
-
- setState(() => {});
- },
- onLongPress: () {
- showVerifyIdentitySheet(
- context,
- self: false,
- email: currentUser.email,
- config: Configuration.instance,
- );
- },
- isTopBorderRadiusRemoved: index > 0,
- isBottomBorderRadiusRemoved:
- index < (filterSuggestedUsers.length - 1),
- ),
- (index == (filterSuggestedUsers.length - 1))
- ? const SizedBox.shrink()
- : DividerWidget(
- dividerType: DividerType.menu,
- bgColor: getEnteColorScheme(
- context,
- ).fillFaint,
- ),
- ],
- );
- },
- itemCount: filterSuggestedUsers.length + 1,
- ),
- ),
- ],
- ),
- ),
- ),
- SafeArea(
- child: Padding(
- padding: const EdgeInsets.only(
- top: 8,
- bottom: 8,
- left: 16,
- right: 16,
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- const SizedBox(height: 8),
- ..._actionButtons(),
- const SizedBox(height: 12),
- ],
- ),
- ),
- ),
- ],
- ),
- );
- },
- );
- }
-
- List<Widget> _actionButtons() {
- final widgets = <Widget>[];
- if (widget.actionTypesToShow.contains(ActionTypesToShow.addViewer)) {
- widgets.add(
- ButtonWidget(
- buttonType: ButtonType.primary,
- buttonSize: ButtonSize.large,
- labelText: context.l10n.addViewers(_selectedEmails.length),
- isDisabled: _selectedEmails.isEmpty,
- onTap: () async {
- final results = <bool>[];
- final collections = widget.collections;
-
- for (String email in _selectedEmails) {
- bool result = false;
- for (Collection collection in collections) {
- result = await collectionActions.addEmailToCollection(
- context,
- collection,
- email,
- CollectionParticipantRole.viewer,
- );
- }
- results.add(result);
- }
-
- final noOfSuccessfullAdds = results.where((e) => e).length;
- showToast(
- context,
- context.l10n.viewersSuccessfullyAdded(noOfSuccessfullAdds),
- );
-
- if (!results.any((e) => e == false) && mounted) {
- Navigator.of(context).pop(true);
- }
- },
- ),
- );
- }
- if (widget.actionTypesToShow.contains(ActionTypesToShow.addCollaborator)) {
- widgets.add(
- ButtonWidget(
- buttonType:
- widget.actionTypesToShow.contains(ActionTypesToShow.addViewer)
- ? ButtonType.neutral
- : ButtonType.primary,
- buttonSize: ButtonSize.large,
- labelText: context.l10n.addCollaborators(_selectedEmails.length),
- isDisabled: _selectedEmails.isEmpty,
- onTap: () async {
- // TODO: This is not currently designed for best UX for action on
- // multiple collections and emails, especially if some operations
- // fail. Can be improved by using a different 'addEmailToCollection'
- // that accepts list of emails and list of collections.
- final results = <bool>[];
- final collections = widget.collections;
-
- for (String email in _selectedEmails) {
- bool result = false;
- for (Collection collection in collections) {
- result = await collectionActions.addEmailToCollection(
- context,
- collection,
- email,
- CollectionParticipantRole.collaborator,
- );
- }
- results.add(result);
- }
-
- final noOfSuccessfullAdds = results.where((e) => e).length;
- showToast(
- context,
- context.l10n.collaboratorsSuccessfullyAdded(noOfSuccessfullAdds),
- );
-
- if (!results.any((e) => e == false) && mounted) {
- Navigator.of(context).pop(true);
- }
- },
- ),
- );
- }
- final widgetsWithSpaceBetween = addSeparators(
- widgets,
- const SizedBox(height: 8),
- );
- return widgetsWithSpaceBetween;
- }
-
- void clearFocus() {
- _textController.clear();
- _newEmail = _textController.text;
- _emailIsValid = false;
- textFieldFocusNode.unfocus();
- setState(() => {});
- }
-
- Widget _enterEmailField() {
- return Row(
- children: [
- Expanded(
- child: TextFormField(
- controller: _textController,
- focusNode: textFieldFocusNode,
- style: getEnteTextTheme(context).body,
- decoration: InputDecoration(
- focusedBorder: OutlineInputBorder(
- borderRadius: const BorderRadius.all(Radius.circular(4.0)),
- borderSide: BorderSide(
- color: getEnteColorScheme(context).strokeMuted,
- ),
- ),
- fillColor: getEnteColorScheme(context).fillFaint,
- filled: true,
- hintText: context.l10n.enterEmail,
- contentPadding: const EdgeInsets.symmetric(
- horizontal: 16,
- vertical: 14,
- ),
- border: UnderlineInputBorder(
- borderSide: BorderSide.none,
- borderRadius: BorderRadius.circular(4),
- ),
- prefixIcon: Icon(
- Icons.email_outlined,
- color: getEnteColorScheme(context).strokeMuted,
- ),
- suffixIcon: _newEmail == ''
- ? null
- : IconButton(
- onPressed: clearFocus,
- icon: Icon(
- Icons.cancel,
- color: getEnteColorScheme(context).strokeMuted,
- ),
- ),
- ),
- onChanged: (value) {
- _newEmail = value.trim();
- _emailIsValid = EmailValidator.validate(_newEmail);
- setState(() {});
- },
- autocorrect: false,
- keyboardType: TextInputType.emailAddress,
- //initialValue: _email,
- textInputAction: TextInputAction.next,
- ),
- ),
- const SizedBox(width: 8),
- ButtonWidget(
- buttonType: ButtonType.secondary,
- buttonSize: ButtonSize.small,
- labelText: context.l10n.add,
- isDisabled: !_emailIsValid,
- onTap: () async {
- if (_emailIsValid) {
- final result = await collectionActions.doesEmailHaveAccount(
- context,
- _newEmail,
- );
- if (result && mounted) {
- setState(() {
- for (var suggestedUser in _suggestedUsers) {
- if (suggestedUser.email == _newEmail) {
- _selectedEmails.add(suggestedUser.email);
- clearFocus();
-
- return;
- }
- }
- _suggestedUsers.insert(0, User(email: _newEmail));
- _selectedEmails.add(_newEmail);
- clearFocus();
- });
- }
- }
- },
- ),
- ],
- );
- }
-
- List<User> _getSuggestedUser() {
- final Set<String> existingEmails = {};
- final collections = widget.collections;
- if (collections.isEmpty) {
- return [];
- }
-
- for (final Collection collection in collections) {
- for (final User u in collection.sharees) {
- if (u.id != null && u.email.isNotEmpty) {
- existingEmails.add(u.email);
- }
- }
- }
-
- final List<User> suggestedUsers = CollectionService.instance
- .getRelevantContacts();
-
- suggestedUsers.sort(
- (a, b) => a.resolvedDisplayName.toLowerCase().compareTo(
- b.resolvedDisplayName.toLowerCase(),
- ),
- );
-
- return suggestedUsers;
- }
-
- String _getTitle() {
- if (widget.actionTypesToShow.length > 1) {
- return context.l10n.addParticipants;
- } else if (widget.actionTypesToShow.first == ActionTypesToShow.addViewer) {
- return context.l10n.addViewer;
- } else {
- return context.l10n.addCollaborator;
- }
- }
-}
diff --git a/mobile/apps/locker/lib/ui/sharing/album_participants_page.dart b/mobile/apps/locker/lib/ui/sharing/album_participants_page.dart
deleted file mode 100644
index e7c7074e38..0000000000
--- a/mobile/apps/locker/lib/ui/sharing/album_participants_page.dart
+++ /dev/null
@@ -1,323 +0,0 @@
-import 'package:ente_contacts/contacts.dart';
-import 'package:ente_pure_utils/ente_pure_utils.dart';
-import "package:ente_sharing/models/user.dart";
-import "package:ente_sharing/user_avator_widget.dart";
-import "package:ente_ui/components/captioned_text_widget.dart";
-import "package:ente_ui/components/divider_widget.dart";
-import "package:ente_ui/components/menu_item_widget.dart";
-import "package:ente_ui/components/menu_section_title.dart";
-import "package:ente_ui/components/title_bar_title_widget.dart";
-import "package:ente_ui/components/title_bar_widget.dart";
-import "package:ente_ui/theme/ente_theme.dart";
-import 'package:flutter/material.dart';
-import "package:locker/extensions/collection_extension.dart";
-import "package:locker/extensions/user_extension.dart";
-import "package:locker/l10n/l10n.dart";
-import "package:locker/services/collections/models/collection.dart";
-import "package:locker/services/configuration.dart";
-import "package:locker/ui/sharing/add_participant_page.dart";
-import "package:locker/ui/sharing/manage_album_participant.dart";
-
-class AlbumParticipantsPage extends StatefulWidget {
- final Collection collection;
-
- const AlbumParticipantsPage(this.collection, {super.key});
-
- @override
- State<AlbumParticipantsPage> createState() => _AlbumParticipantsPageState();
-}
-
-class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
- late int currentUserID;
-
- @override
- void initState() {
- currentUserID = Configuration.instance.getUserID()!;
- super.initState();
- }
-
- Future<void> _navigateToManageUser(User user) async {
- if (user.id == currentUserID) {
- return;
- }
- await routeToPage(
- context,
- ManageIndividualParticipant(collection: widget.collection, user: user),
- );
- if (mounted) {
- setState(() => {});
- }
- }
-
- Future<void> _navigateToAddUser(bool addingViewer) async {
- await routeToPage(
- context,
- AddParticipantPage(
- [widget.collection],
- addingViewer
- ? [ActionTypesToShow.addViewer]
- : [ActionTypesToShow.addCollaborator],
- ),
- );
- if (mounted) {
- setState(() => {});
- }
- }
-
- @override
- Widget build(BuildContext context) {
- return ValueListenableBuilder<int>(
- valueListenable: ContactsDisplayService.instance.changes,
- builder: (context, _, _) {
- final isOwner =
- widget.collection.owner.id == Configuration.instance.getUserID();
- final colorScheme = getEnteColorScheme(context);
- final currentUserID = Configuration.instance.getUserID()!;
- final int participants = 1 + widget.collection.getSharees().length;
- final User owner = widget.collection.owner;
- if (owner.id == currentUserID && owner.email == "") {
- owner.email = Configuration.instance.getEmail()!;
- }
- final splitResult = widget.collection.getSharees().splitMatch(
- (x) => x.isViewer,
- );
- final List<User> viewers = splitResult.matched;
- viewers.sort(
- (a, b) => a.resolvedDisplayName.toLowerCase().compareTo(
- b.resolvedDisplayName.toLowerCase(),
- ),
- );
- final List<User> collaborators = splitResult.unmatched;
- collaborators.sort(
- (a, b) => a.resolvedDisplayName.toLowerCase().compareTo(
- b.resolvedDisplayName.toLowerCase(),
- ),
- );
-
- return Scaffold(
- body: CustomScrollView(
- primary: false,
- slivers: <Widget>[
- TitleBarWidget(
- flexibleSpaceTitle: TitleBarTitleWidget(
- title: widget.collection.displayName,
- ),
- flexibleSpaceCaption: context.l10n.albumParticipantsCount(
- participants,
- ),
- ),
- SliverList(
- delegate: SliverChildBuilderDelegate((context, index) {
- return Padding(
- padding: const EdgeInsets.only(
- top: 20,
- left: 16,
- right: 16,
- ),
- child: Column(
- children: [
- Column(
- children: [
- MenuSectionTitle(
- title: context.l10n.albumOwner,
- iconData: Icons.admin_panel_settings_outlined,
- ),
- MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: isOwner
- ? context.l10n.you
- : _resolvedNameOrEmail(
- widget.collection.owner,
- ),
- makeTextBold: isOwner,
- ),
- leadingIconWidget: UserAvatarWidget(
- owner,
- currentUserID: currentUserID,
- config: Configuration.instance,
- ),
- leadingIconSize: 24,
- menuItemColor: colorScheme.fillFaint,
- singleBorderRadius: 8,
- isGestureDetectorDisabled: true,
- ),
- ],
- ),
- ],
- ),
- );
- }, childCount: 1),
- ),
- SliverPadding(
- padding: const EdgeInsets.only(top: 20, left: 16, right: 16),
- sliver: SliverList(
- delegate: SliverChildBuilderDelegate((context, index) {
- if (index == 0 && (isOwner || collaborators.isNotEmpty)) {
- return MenuSectionTitle(
- title: context.l10n.collaborator,
- iconData: Icons.edit_outlined,
- );
- } else if (index > 0 && index <= collaborators.length) {
- final listIndex = index - 1;
- final currentUser = collaborators[listIndex];
- final isSameAsLoggedInUser =
- currentUserID == currentUser.id;
- final isLastItem =
- !isOwner && index == collaborators.length;
- return Column(
- children: [
- MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: isSameAsLoggedInUser
- ? context.l10n.you
- : _resolvedNameOrEmail(currentUser),
- makeTextBold: isSameAsLoggedInUser,
- ),
- leadingIconSize: 24.0,
- leadingIconWidget: UserAvatarWidget(
- currentUser,
- type: AvatarType.mini,
- currentUserID: currentUserID,
- config: Configuration.instance,
- ),
- menuItemColor: getEnteColorScheme(
- context,
- ).fillFaint,
- trailingIcon: isOwner ? Icons.chevron_right : null,
- trailingIconIsMuted: true,
- onTap: isOwner
- ? () async {
- if (isOwner) {
- // ignore: unawaited_futures
- _navigateToManageUser(currentUser);
- }
- }
- : null,
- isTopBorderRadiusRemoved: listIndex > 0,
- isBottomBorderRadiusRemoved: !isLastItem,
- singleBorderRadius: 8,
- ),
- isLastItem
- ? const SizedBox.shrink()
- : DividerWidget(
- dividerType: DividerType.menu,
- bgColor: getEnteColorScheme(
- context,
- ).fillFaint,
- ),
- ],
- );
- } else if (index == (1 + collaborators.length) && isOwner) {
- return MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: collaborators.isNotEmpty
- ? context.l10n.addMore
- : context.l10n.addCollaborator,
- makeTextBold: true,
- ),
- leadingIcon: Icons.add_outlined,
- menuItemColor: getEnteColorScheme(context).fillFaint,
- onTap: () async {
- // ignore: unawaited_futures
- _navigateToAddUser(false);
- },
- isTopBorderRadiusRemoved: collaborators.isNotEmpty,
- singleBorderRadius: 8,
- );
- }
- return const SizedBox.shrink();
- }, childCount: 1 + collaborators.length + 1),
- ),
- ),
- SliverPadding(
- padding: const EdgeInsets.only(top: 24, left: 16, right: 16),
- sliver: SliverList(
- delegate: SliverChildBuilderDelegate((context, index) {
- if (index == 0 && (isOwner || viewers.isNotEmpty)) {
- return MenuSectionTitle(
- title: context.l10n.viewer,
- iconData: Icons.photo_outlined,
- );
- } else if (index > 0 && index <= viewers.length) {
- final listIndex = index - 1;
- final currentUser = viewers[listIndex];
- final isSameAsLoggedInUser =
- currentUserID == currentUser.id;
- final isLastItem = !isOwner && index == viewers.length;
- return Column(
- children: [
- MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: isSameAsLoggedInUser
- ? context.l10n.you
- : _resolvedNameOrEmail(currentUser),
- makeTextBold: isSameAsLoggedInUser,
- ),
- leadingIconSize: 24.0,
- leadingIconWidget: UserAvatarWidget(
- currentUser,
- type: AvatarType.mini,
- currentUserID: currentUserID,
- config: Configuration.instance,
- ),
- menuItemColor: getEnteColorScheme(
- context,
- ).fillFaint,
- trailingIcon: isOwner ? Icons.chevron_right : null,
- trailingIconIsMuted: true,
- onTap: isOwner
- ? () async {
- if (isOwner) {
- // ignore: unawaited_futures
- _navigateToManageUser(currentUser);
- }
- }
- : null,
- isTopBorderRadiusRemoved: listIndex > 0,
- isBottomBorderRadiusRemoved: !isLastItem,
- singleBorderRadius: 8,
- ),
- isLastItem
- ? const SizedBox.shrink()
- : DividerWidget(
- dividerType: DividerType.menu,
- bgColor: getEnteColorScheme(
- context,
- ).fillFaint,
- ),
- ],
- );
- } else if (index == (1 + viewers.length) && isOwner) {
- return MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: viewers.isNotEmpty
- ? context.l10n.addMore
- : context.l10n.addViewer,
- makeTextBold: true,
- ),
- leadingIcon: Icons.add_outlined,
- menuItemColor: getEnteColorScheme(context).fillFaint,
- onTap: () async {
- // ignore: unawaited_futures
- _navigateToAddUser(true);
- },
- isTopBorderRadiusRemoved: viewers.isNotEmpty,
- singleBorderRadius: 8,
- );
- }
- return const SizedBox.shrink();
- }, childCount: 1 + viewers.length + 1),
- ),
- ),
- const SliverToBoxAdapter(child: SizedBox(height: 72)),
- ],
- ),
- );
- },
- );
- }
-
- String _resolvedNameOrEmail(User user) {
- return user.resolvedDisplayName;
- }
-}
diff --git a/mobile/apps/locker/lib/ui/sharing/manage_album_participant.dart b/mobile/apps/locker/lib/ui/sharing/manage_album_participant.dart
deleted file mode 100644
index 6396945acd..0000000000
--- a/mobile/apps/locker/lib/ui/sharing/manage_album_participant.dart
+++ /dev/null
@@ -1,192 +0,0 @@
-import 'package:ente_contacts/contacts.dart';
-import "package:ente_sharing/models/user.dart";
-import "package:ente_ui/components/buttons/button_widget.dart";
-import "package:ente_ui/components/captioned_text_widget.dart";
-import "package:ente_ui/components/divider_widget.dart";
-import "package:ente_ui/components/menu_item_widget.dart";
-import "package:ente_ui/components/menu_section_description_widget.dart";
-import "package:ente_ui/components/menu_section_title.dart";
-import "package:ente_ui/components/title_bar_title_widget.dart";
-import "package:ente_ui/theme/colors.dart";
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:ente_ui/utils/dialog_util.dart";
-import 'package:flutter/material.dart';
-import "package:locker/extensions/user_extension.dart";
-import "package:locker/l10n/l10n.dart";
-import "package:locker/services/collections/models/collection.dart";
-import "package:locker/utils/collection_actions.dart";
-
-class ManageIndividualParticipant extends StatefulWidget {
- final Collection collection;
- final User user;
-
- const ManageIndividualParticipant({
- super.key,
- required this.collection,
- required this.user,
- });
-
- @override
- State<StatefulWidget> createState() => _ManageIndividualParticipantState();
-}
-
-class _ManageIndividualParticipantState
- extends State<ManageIndividualParticipant> {
- late CollectionActions collectionActions;
-
- @override
- void initState() {
- super.initState();
- collectionActions = CollectionActions();
- }
-
- @override
- Widget build(BuildContext context) {
- return ValueListenableBuilder<int>(
- valueListenable: ContactsDisplayService.instance.changes,
- builder: (context, _, _) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- bool isConvertToViewSuccess = false;
- return Scaffold(
- appBar: AppBar(),
- body: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SafeArea(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 12),
- TitleBarTitleWidget(title: context.l10n.manage),
- Text(
- widget.user.resolvedDisplayName,
- textAlign: TextAlign.left,
- style: textTheme.small.copyWith(
- color: colorScheme.textMuted,
- ),
- ),
- ],
- ),
- ),
- const SizedBox(height: 12),
- MenuSectionTitle(title: context.l10n.addedAs),
- MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: context.l10n.collaborator,
- ),
- leadingIcon: Icons.edit_outlined,
- menuItemColor: getEnteColorScheme(context).fillFaint,
- trailingIcon: widget.user.isCollaborator ? Icons.check : null,
- onTap: widget.user.isCollaborator
- ? null
- : () async {
- final result = await collectionActions
- .addEmailToCollection(
- context,
- widget.collection,
- widget.user.email,
- CollectionParticipantRole.collaborator,
- );
- if (result && mounted) {
- widget.user.role = CollectionParticipantRole
- .collaborator
- .toStringVal();
- setState(() => {});
- }
- },
- isBottomBorderRadiusRemoved: true,
- ),
- DividerWidget(
- dividerType: DividerType.menu,
- bgColor: getEnteColorScheme(context).fillFaint,
- ),
- MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: context.l10n.viewer,
- ),
- leadingIcon: Icons.photo_outlined,
- leadingIconColor: getEnteColorScheme(context).strokeBase,
- menuItemColor: getEnteColorScheme(context).fillFaint,
- trailingIcon: widget.user.isViewer ? Icons.check : null,
- showOnlyLoadingState: true,
- onTap: widget.user.isViewer
- ? null
- : () async {
- final actionResult = await showChoiceActionSheet(
- context,
- title: context.l10n.changePermissions,
- firstButtonLabel: context.l10n.yesConvertToViewer,
- body: context.l10n
- .cannotAddMoreFilesAfterBecomingViewer(
- widget.user.resolvedDisplayName,
- ),
- isCritical: true,
- );
- if (actionResult?.action != null) {
- if (actionResult!.action == ButtonAction.first) {
- try {
- isConvertToViewSuccess = await collectionActions
- .addEmailToCollection(
- context,
- widget.collection,
- widget.user.email,
- CollectionParticipantRole.viewer,
- );
- } catch (e) {
- await showGenericErrorDialog(
- context: context,
- error: e,
- );
- }
- if (isConvertToViewSuccess && mounted) {
- isConvertToViewSuccess = false;
- widget.user.role = CollectionParticipantRole
- .viewer
- .toStringVal();
- setState(() => {});
- }
- }
- }
- },
- isTopBorderRadiusRemoved: true,
- ),
- MenuSectionDescriptionWidget(
- content:
- context.l10n.collaboratorsCanAddFilesToTheSharedAlbum,
- ),
- const SizedBox(height: 24),
- MenuSectionTitle(title: context.l10n.removeParticipant),
- MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: context.l10n.remove,
- textColor: warning500,
- makeTextBold: true,
- ),
- leadingIcon: Icons.not_interested_outlined,
- leadingIconColor: warning500,
- menuItemColor: getEnteColorScheme(context).fillFaint,
- surfaceExecutionStates: false,
- onTap: () async {
- final result = await collectionActions.removeParticipant(
- context,
- widget.collection,
- widget.user,
- );
-
- if ((result) && mounted) {
- Navigator.of(context).pop(true);
- }
- },
- ),
- ],
- ),
- ),
- );
- },
- );
- }
-}