Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Used better names

Aman Raj Singh Mourya70cc6a35d70e
diff --git a/mobile/lib/ui/tabs/shared_collections_tab.dart b/mobile/lib/ui/tabs/shared_collections_tab.dart
index 577884394f..38441ae73a 100644
--- a/mobile/lib/ui/tabs/shared_collections_tab.dart
+++ b/mobile/lib/ui/tabs/shared_collections_tab.dart
@@ -17,11 +17,11 @@ import "package:photos/ui/components/buttons/button_widget.dart";
import "package:photos/ui/components/buttons/icon_button_widget.dart";
import "package:photos/ui/components/divider_widget.dart";
import "package:photos/ui/components/models/button_type.dart";
-import "package:photos/ui/settings/new_album_card_widget.dart";
import 'package:photos/ui/tabs/section_title.dart';
import "package:photos/ui/tabs/shared/all_quick_links_page.dart";
import "package:photos/ui/tabs/shared/empty_state.dart";
import "package:photos/ui/tabs/shared/quick_link_album_item.dart";
+import "package:photos/ui/viewer/gallery/collect_photos_card_widget.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/utils/debouncer.dart";
import "package:photos/utils/navigation_util.dart";
@@ -319,7 +319,7 @@ class _SharedCollectionsTabState extends State<SharedCollectionsTab>
],
)
: const SizedBox.shrink(),
- const NewAlbumCardWidget(),
+ const CollectPhotosCardWidget(),
const SizedBox(height: 32),
],
),
diff --git a/mobile/lib/ui/viewer/gallery/empty_album_state_new.dart b/mobile/lib/ui/viewer/gallery/collect_photos_bottom_buttons.dart
similarity index 80%
rename from mobile/lib/ui/viewer/gallery/empty_album_state_new.dart
rename to mobile/lib/ui/viewer/gallery/collect_photos_bottom_buttons.dart
index d9944f9c99..b5dfc1e0a9 100644
--- a/mobile/lib/ui/viewer/gallery/empty_album_state_new.dart
+++ b/mobile/lib/ui/viewer/gallery/collect_photos_bottom_buttons.dart
@@ -12,21 +12,22 @@ import "package:photos/ui/viewer/gallery/hooks/add_photos_sheet.dart";
import "package:photos/utils/dialog_util.dart";
import "package:photos/utils/share_util.dart";
-class EmptyAlbumStateNew extends StatefulWidget {
- final Collection c;
+class CollectPhotosBottomButtons extends StatefulWidget {
+ final Collection? c;
final SelectedFiles? selectedFiles;
- const EmptyAlbumStateNew(
+ const CollectPhotosBottomButtons(
this.c, {
super.key,
this.selectedFiles,
});
@override
- State<EmptyAlbumStateNew> createState() => _EmptyAlbumStateNewState();
+ State<CollectPhotosBottomButtons> createState() => _EmptyAlbumStateNewState();
}
-class _EmptyAlbumStateNewState extends State<EmptyAlbumStateNew> {
+class _EmptyAlbumStateNewState extends State<CollectPhotosBottomButtons> {
final ValueNotifier<bool> _hasSelectedFilesNotifier = ValueNotifier(false);
+ final GlobalKey shareLinkAlbumButtonKey = GlobalKey();
@override
void initState() {
@@ -41,18 +42,27 @@ class _EmptyAlbumStateNewState extends State<EmptyAlbumStateNew> {
super.dispose();
}
+ // Future<String> _getAlbumShareUrl() async {
+ // try {
+ // final String collectionKey = Base58Encode(
+ // CollectionsService.instance.getCollectionKey(widget.c.id),
+ // );
+ // } catch (e) {
+ // await showGenericErrorDialog(
+ // context: context,
+ // error: e,
+ // );
+ // }
+ // return "";
+ // }
+
@override
Widget build(BuildContext context) {
- final GlobalKey shareLinkAlbumButtonKey = GlobalKey();
-
- Future<String> getAlbumShareUrl() async {
- final PublicURL url = widget.c.publicURLs!.firstOrNull!;
- final String collectionKey = Base58Encode(
- CollectionsService.instance.getCollectionKey(widget.c.id),
- );
- return "${url.url}#$collectionKey";
- }
-
+ final PublicURL url = widget.c!.publicURLs!.firstOrNull!;
+ final String collectionKey = Base58Encode(
+ CollectionsService.instance.getCollectionKey(widget.c!.id),
+ );
+ final String urlValue = "${url.url}#$collectionKey";
return ValueListenableBuilder(
valueListenable: _hasSelectedFilesNotifier,
builder: (context, value, child) {
@@ -71,8 +81,6 @@ class _EmptyAlbumStateNewState extends State<EmptyAlbumStateNew> {
child: Padding(
padding: const EdgeInsets.fromLTRB(24, 0, 24, 12),
child: Column(
- mainAxisAlignment: MainAxisAlignment.end,
- crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Container(
@@ -89,7 +97,7 @@ class _EmptyAlbumStateNewState extends State<EmptyAlbumStateNew> {
shouldSurfaceExecutionStates: false,
onTap: () async {
try {
- await showAddPhotosSheet(context, widget.c);
+ await showAddPhotosSheet(context, widget.c!);
} catch (e) {
await showGenericErrorDialog(
context: context,
@@ -107,11 +115,10 @@ class _EmptyAlbumStateNewState extends State<EmptyAlbumStateNew> {
icon: Icons.adaptive.share,
shouldSurfaceExecutionStates: false,
onTap: () async {
- final String shareUrl = await getAlbumShareUrl();
await shareAlbumLinkWithPlaceholder(
context,
- widget.c,
- shareUrl,
+ widget.c!,
+ urlValue,
shareLinkAlbumButtonKey,
);
},
diff --git a/mobile/lib/ui/settings/new_album_card_widget.dart b/mobile/lib/ui/viewer/gallery/collect_photos_card_widget.dart
similarity index 93%
rename from mobile/lib/ui/settings/new_album_card_widget.dart
rename to mobile/lib/ui/viewer/gallery/collect_photos_card_widget.dart
index d398290c35..5dff4a039c 100644
--- a/mobile/lib/ui/settings/new_album_card_widget.dart
+++ b/mobile/lib/ui/viewer/gallery/collect_photos_card_widget.dart
@@ -13,14 +13,15 @@ import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/utils/dialog_util.dart";
import "package:photos/utils/navigation_util.dart";
-class NewAlbumCardWidget extends StatefulWidget {
- const NewAlbumCardWidget({super.key});
+class CollectPhotosCardWidget extends StatefulWidget {
+ const CollectPhotosCardWidget({super.key});
@override
- State<NewAlbumCardWidget> createState() => _NewAlbumCardWidgetState();
+ State<CollectPhotosCardWidget> createState() =>
+ _CollectPhotosCardWidgetState();
}
-class _NewAlbumCardWidgetState extends State<NewAlbumCardWidget> {
+class _CollectPhotosCardWidgetState extends State<CollectPhotosCardWidget> {
Future<void> _onTapCreateAlbum() async {
final String currentDate =
DateFormat('MMMM d, yyyy').format(DateTime.now());
@@ -45,12 +46,13 @@ class _NewAlbumCardWidgetState extends State<NewAlbumCardWidget> {
routeToPage(
context,
CollectionPage(
- isNewCollection: true,
+ isFromCollectPhotos: true,
CollectionWithThumbnail(c, null),
),
);
} catch (e, s) {
- Logger("CreateNewAlbumIcon").severe("Failed to rename album", e, s);
+ Logger("CollectPhotosCardWidget")
+ .severe("Failed to rename album", e, s);
rethrow;
}
},
diff --git a/mobile/lib/ui/viewer/gallery/collection_page.dart b/mobile/lib/ui/viewer/gallery/collection_page.dart
index b2efa7eeca..f3f044f898 100644
--- a/mobile/lib/ui/viewer/gallery/collection_page.dart
+++ b/mobile/lib/ui/viewer/gallery/collection_page.dart
@@ -12,8 +12,8 @@ import 'package:photos/models/gallery_type.dart';
import 'package:photos/models/selected_files.dart';
import 'package:photos/services/ignored_files_service.dart';
import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
+import "package:photos/ui/viewer/gallery/collect_photos_bottom_buttons.dart";
import "package:photos/ui/viewer/gallery/empty_album_state.dart";
-import "package:photos/ui/viewer/gallery/empty_album_state_new.dart";
import 'package:photos/ui/viewer/gallery/empty_state.dart';
import 'package:photos/ui/viewer/gallery/gallery.dart';
import 'package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart';
@@ -23,13 +23,13 @@ class CollectionPage extends StatelessWidget {
final CollectionWithThumbnail c;
final String tagPrefix;
final bool? hasVerifiedLock;
- final bool isNewCollection;
+ final bool isFromCollectPhotos;
CollectionPage(
this.c, {
this.tagPrefix = "collection",
this.hasVerifiedLock = false,
- this.isNewCollection = false,
+ this.isFromCollectPhotos = false,
Key? key,
}) : super(key: key);
@@ -91,10 +91,10 @@ class CollectionPage extends StatelessWidget {
emptyState: galleryType == GalleryType.ownedCollection
? EmptyAlbumState(
c.collection,
- isNewCollection: isNewCollection,
+ isFromCollectPhotos: isFromCollectPhotos,
)
: const EmptyState(),
- footer: isNewCollection
+ footer: isFromCollectPhotos
? const SizedBox(height: 20)
: const SizedBox(height: 212),
);
@@ -108,8 +108,8 @@ class CollectionPage extends StatelessWidget {
collection: c.collection,
),
),
- floatingActionButton: isNewCollection
- ? EmptyAlbumStateNew(
+ floatingActionButton: isFromCollectPhotos
+ ? CollectPhotosBottomButtons(
c.collection,
selectedFiles: _selectedFiles,
)
diff --git a/mobile/lib/ui/viewer/gallery/empty_album_state.dart b/mobile/lib/ui/viewer/gallery/empty_album_state.dart
index fdaffb2447..72c13c226e 100644
--- a/mobile/lib/ui/viewer/gallery/empty_album_state.dart
+++ b/mobile/lib/ui/viewer/gallery/empty_album_state.dart
@@ -8,16 +8,16 @@ import "package:photos/utils/dialog_util.dart";
class EmptyAlbumState extends StatelessWidget {
final Collection c;
- final bool isNewCollection;
+ final bool isFromCollectPhotos;
const EmptyAlbumState(
this.c, {
super.key,
- this.isNewCollection = false,
+ this.isFromCollectPhotos = false,
});
@override
Widget build(BuildContext context) {
- return isNewCollection
+ return isFromCollectPhotos
? Stack(
children: [
Center(