Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Handle public album layouts for deep links

anandbaburajan137ae6f7bd5d
diff --git a/mobile/apps/photos/lib/ui/tabs/home_widget.dart b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
index 0c313efda4..fe872ad76b 100644
--- a/mobile/apps/photos/lib/ui/tabs/home_widget.dart
+++ b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
@@ -51,6 +51,7 @@ import 'package:photos/theme/colors.dart';
import "package:photos/theme/effects.dart";
import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/collections/collection_action_sheet.dart';
+import "package:photos/ui/common/web_page.dart";
import "package:photos/ui/components/buttons/button_widget.dart";
import "package:photos/ui/components/models/button_type.dart";
import 'package:photos/ui/extents_page_view.dart';
@@ -304,6 +305,7 @@ class _HomeWidgetState extends State<HomeWidget> {
final Collection collection = await CollectionsService.instance
.getCollectionFromPublicLink(context, uri);
+
final existingCollection =
CollectionsService.instance.getCollectionByID(collection.id);
@@ -317,6 +319,20 @@ class _HomeWidgetState extends State<HomeWidget> {
);
return;
}
+
+ // Check for trip layout and show in webview
+ if (collection.pubMagicMetadata.layout == "trip") {
+ await routeToPage(
+ context,
+ WebPage(
+ collection.displayName,
+ uri.toString(),
+ canOpenInBrowser: true,
+ ),
+ );
+ return;
+ }
+
final dialog = createProgressDialog(context, "Loading...");
final publicUrl = collection.publicURLs[0];
if (!publicUrl.enableDownload) {
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/shared_public_collection_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/shared_public_collection_page.dart
index 7d6b627782..e81cf1f985 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/shared_public_collection_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/shared_public_collection_page.dart
@@ -20,6 +20,7 @@ import "package:photos/ui/components/models/button_type.dart";
import "package:photos/ui/notification/toast.dart";
import "package:photos/ui/viewer/actions/file_selection_overlay_bar.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
+import "package:photos/ui/viewer/gallery/component/group/type.dart";
import "package:photos/ui/viewer/gallery/gallery.dart";
import "package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
@@ -69,6 +70,20 @@ class _SharedPublicCollectionPageState
logger.info("Building SharedPublicCollectionPage");
final List<EnteFile>? initialFiles =
widget.c.thumbnail != null ? [widget.c.thumbnail!] : null;
+
+ // Determine groupType based on collection layout
+ GroupType groupType;
+ final layout = widget.c.collection.pubMagicMetadata.layout ?? "grouped";
+ switch (layout) {
+ case "continuous":
+ groupType = GroupType.none;
+ break;
+ case "grouped":
+ default:
+ groupType = GroupType.day;
+ break;
+ }
+
final gallery = Gallery(
asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {
widget.files!.sort(
@@ -96,6 +111,7 @@ class _SharedPublicCollectionPageState
selectedFiles: _selectedFiles,
initialFiles: initialFiles,
albumName: widget.c.collection.displayName,
+ groupType: groupType,
header: widget.c.collection.isJoinEnabled &&
Configuration.instance.isLoggedIn()
? Padding(