Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mobile][photos] Defer people sharing list creation until tap (#14147)

Rakhulb3568a8c9da8
diff --git a/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart
index d40236f88d..2eef68a227 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart
@@ -150,14 +150,12 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
widget.selectedFiles.files.isEmpty &&
!isLocalGalleryMode &&
Configuration.instance.hasConfiguredAccount()
- ? GalleryFilesState.maybeOf(context)?.galleryFilesOrNull
- ?.where(
- (file) =>
- file.uploadedFileID != null &&
- file.ownerID == currentUserID,
- )
- .toList()
+ ? GalleryFilesState.maybeOf(context)?.galleryFilesOrNull?.where(
+ (file) =>
+ file.uploadedFileID != null && file.ownerID == currentUserID,
+ )
: null;
+ final hasShareableFiles = shareableFiles?.isNotEmpty ?? false;
return GalleryAppBarWidget.sliverConfig(
widget.type,
_appBarTitle,
@@ -179,7 +177,7 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
context,
onCover: onCover,
foregroundColor: foregroundColor,
- shareableFiles: shareableFiles,
+ shareableFiles: hasShareableFiles ? shareableFiles : null,
),
).buildSliver(context);
}
@@ -188,7 +186,7 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
BuildContext context, {
required bool onCover,
Color? foregroundColor,
- required List<EnteFile>? shareableFiles,
+ required Iterable<EnteFile>? shareableFiles,
}) {
final hasAccount = Configuration.instance.hasConfiguredAccount();
final List<Widget> actions = <Widget>[];
@@ -197,7 +195,7 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
}
if (!isLocalGalleryMode && hasAccount) {
- if (shareableFiles != null && shareableFiles.isNotEmpty) {
+ if (shareableFiles != null) {
actions.add(
IconButtonComponent(
key: shareButtonKey,
@@ -214,7 +212,7 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
shouldSurfaceExecutionStates: false,
onTap: () => showSharePersonSheet(
context,
- files: shareableFiles,
+ files: shareableFiles.toList(),
shareButtonKey: shareButtonKey,
),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
index 84cbf2b1f9..2502f5d5c1 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
@@ -217,14 +217,12 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
Configuration.instance.hasConfiguredAccount() &&
!person.data.isIgnored &&
person.data.name.trim().isNotEmpty
- ? GalleryFilesState.maybeOf(context)?.galleryFilesOrNull
- ?.where(
- (file) =>
- file.uploadedFileID != null &&
- file.ownerID == currentUserID,
- )
- .toList()
+ ? GalleryFilesState.maybeOf(context)?.galleryFilesOrNull?.where(
+ (file) =>
+ file.uploadedFileID != null && file.ownerID == currentUserID,
+ )
: null;
+ final hasShareableFiles = shareableFiles?.isNotEmpty ?? false;
return GalleryAppBarWidget.sliverConfig(
widget.type,
_appBarTitle,
@@ -246,7 +244,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
context,
onCover: onCover,
foregroundColor: foregroundColor,
- shareableFiles: shareableFiles,
+ shareableFiles: hasShareableFiles ? shareableFiles : null,
),
).buildSliver(context);
}
@@ -271,7 +269,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
BuildContext context, {
required bool onCover,
Color? foregroundColor,
- required List<EnteFile>? shareableFiles,
+ required Iterable<EnteFile>? shareableFiles,
}) {
final bool isIgnored = person.data.isIgnored;
final bool isPinned = person.data.isPinned;
@@ -285,8 +283,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
if (!isIgnored &&
person.data.name.trim().isNotEmpty &&
- shareableFiles != null &&
- shareableFiles.isNotEmpty) {
+ shareableFiles != null) {
actions.add(
IconButtonComponent(
key: shareButtonKey,
@@ -304,7 +301,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
onTap: () => showSharePersonSheet(
context,
person: person,
- files: shareableFiles,
+ files: shareableFiles.toList(),
shareButtonKey: shareButtonKey,
),
),