Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][locker] Clean up Locker action helpers

aman-pilot41f3a5aa66d9
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 9d02e8d558..40a76b9c59 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
@@ -19,17 +19,10 @@ class CollectionPopupMenuWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colors = context.componentColors;
-
return EntePopupMenuButton<String>(
optionsBuilder: () => _buildOptions(context),
onSelected: (value) => _handleMenuAction(context, value),
- child:
- child ??
- HugeIcon(
- icon: HugeIcons.strokeRoundedMoreVertical,
- color: colors.textBase,
- ),
+ child: child,
);
}
diff --git a/mobile/apps/locker/lib/ui/pages/collection_page.dart b/mobile/apps/locker/lib/ui/pages/collection_page.dart
index 409644ec0b..72d269eea7 100644
--- a/mobile/apps/locker/lib/ui/pages/collection_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/collection_page.dart
@@ -101,6 +101,7 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>
_collectionUpdateSubscription.cancel();
_keyboardFocusNode.dispose();
_scrollController.dispose();
+ _selectedFiles.dispose();
super.dispose();
}
@@ -236,26 +237,9 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>
);
}
- final canManageCollection =
- collectionViewType == CollectionViewType.ownedCollection ||
- collectionViewType == CollectionViewType.hiddenOwnedCollection ||
- collectionViewType == CollectionViewType.sharedCollectionViewer ||
- collectionViewType == CollectionViewType.sharedCollectionCollaborator ||
- collectionViewType == CollectionViewType.quickLink;
+ final canManageCollection = canShare;
if (canManageCollection) {
- actions.add(
- CollectionPopupMenuWidget(
- collection: _collection,
- child: IgnorePointer(
- child: IconButtonComponent(
- icon: const HugeIcon(icon: HugeIcons.strokeRoundedMoreVertical),
- variant: IconButtonComponentVariant.primary,
- shouldSurfaceExecutionStates: false,
- onTap: () {},
- ),
- ),
- ),
- );
+ actions.add(CollectionPopupMenuWidget(collection: _collection));
}
return actions;
diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dart
index 2a8e02176a..2381fa7860 100644
--- a/mobile/apps/locker/lib/ui/pages/home_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart
@@ -314,6 +314,7 @@ class _HomePageState extends UploaderPageState<HomePage>
_keyboardFocusNode.dispose();
_scrollController.dispose();
_displayedFilesNotifier.dispose();
+ _selectedFiles.dispose();
_deepLinkSubscription?.cancel();
_triggerLogoutSubscription?.cancel();
_collectionsUpdatedSubscription?.cancel();
diff --git a/mobile/apps/locker/lib/utils/file_icon_utils.dart b/mobile/apps/locker/lib/utils/file_icon_utils.dart
index 7eba2cd770..99b173e78f 100644
--- a/mobile/apps/locker/lib/utils/file_icon_utils.dart
+++ b/mobile/apps/locker/lib/utils/file_icon_utils.dart
@@ -69,17 +69,16 @@ class FileIconUtils {
static Widget getFileIcon(
BuildContext context,
String fileName, {
+ required Color backgroundColor,
double size = 24,
- Color? backgroundColor,
}) {
final colors = context.componentColors;
final config = _getFileConfig(fileName);
return buildRoleIcon(
icon: config.icon,
foregroundColor: _foregroundColor(config.colorRole, colors),
- roleBackgroundColor: _backgroundColor(config.colorRole, colors),
- size: size,
backgroundColor: backgroundColor,
+ size: size,
);
}
@@ -91,27 +90,17 @@ class FileIconUtils {
FileIconColorRole.neutral => colors.textLight,
};
}
-
- static Color _backgroundColor(FileIconColorRole role, ColorTokens colors) {
- return switch (role) {
- FileIconColorRole.warning => colors.warningLight,
- FileIconColorRole.green => colors.greenLight,
- FileIconColorRole.primary => colors.primaryLight,
- FileIconColorRole.neutral => colors.fillLight,
- };
- }
}
Widget buildRoleIcon({
required dynamic icon,
required Color foregroundColor,
- required Color roleBackgroundColor,
+ required Color backgroundColor,
double size = 24,
- Color? backgroundColor,
}) {
return IconTile(
icon: HugeIcon(icon: icon, color: foregroundColor, size: size),
- backgroundColor: backgroundColor ?? roleBackgroundColor,
+ backgroundColor: backgroundColor,
);
}
diff --git a/mobile/apps/locker/lib/utils/info_item_utils.dart b/mobile/apps/locker/lib/utils/info_item_utils.dart
index febb88de82..514adeb8a4 100644
--- a/mobile/apps/locker/lib/utils/info_item_utils.dart
+++ b/mobile/apps/locker/lib/utils/info_item_utils.dart
@@ -49,9 +49,9 @@ class InfoItemUtils {
return buildRoleIcon(
icon: config.icon,
foregroundColor: _foregroundColor(config.colorRole, colors),
- roleBackgroundColor: _backgroundColor(config.colorRole, colors),
+ backgroundColor:
+ backgroundColor ?? _backgroundColor(config.colorRole, colors),
size: size,
- backgroundColor: backgroundColor,
);
}