Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Hide join button is join is disabled

Neeraj Guptade885e45ef44
diff --git a/mobile/lib/models/api/collection/public_url.dart b/mobile/lib/models/api/collection/public_url.dart
index 6c72bda8d7..12556873a0 100644
--- a/mobile/lib/models/api/collection/public_url.dart
+++ b/mobile/lib/models/api/collection/public_url.dart
@@ -5,6 +5,7 @@ class PublicURL {
bool enableDownload;
bool enableCollect;
bool passwordEnabled;
+ bool enableJoin;
String? nonce;
int? opsLimit;
int? memLimit;
@@ -16,6 +17,7 @@ class PublicURL {
this.enableDownload = true,
this.passwordEnabled = false,
this.enableCollect = false,
+ this.enableJoin = false,
this.nonce,
this.opsLimit,
this.memLimit,
@@ -32,6 +34,7 @@ class PublicURL {
'nonce': nonce,
'memLimit': memLimit,
'opsLimit': opsLimit,
+ 'enableJoin': enableJoin,
};
}
@@ -54,6 +57,7 @@ class PublicURL {
nonce: map['nonce'],
opsLimit: map['opsLimit'],
memLimit: map['memLimit'],
+ enableJoin: map['enableJoin'] ?? false,
);
}
}
diff --git a/mobile/lib/models/collection/collection.dart b/mobile/lib/models/collection/collection.dart
index 5947e5cca5..df15f47840 100644
--- a/mobile/lib/models/collection/collection.dart
+++ b/mobile/lib/models/collection/collection.dart
@@ -151,6 +151,13 @@ class Collection {
return publicURLs?.first?.enableCollect ?? false;
}
+ bool get isJoinEnabled {
+ if (publicURLs == null || publicURLs!.isEmpty) {
+ return false;
+ }
+ return publicURLs?.first?.enableJoin ?? false;
+ }
+
CollectionParticipantRole getRole(int userID) {
if (isOwner(userID)) {
return CollectionParticipantRole.owner;
diff --git a/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dart b/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dart
index 12aea28fa2..225e3338b9 100644
--- a/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dart
+++ b/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dart
@@ -64,7 +64,9 @@ class _SharedPublicCollectionPageState
@override
Widget build(BuildContext context) {
- logger.info("Building SharedPublicCollectionPage");
+ logger.info(
+ "Building SharedPublicCollectionPage ${widget.c.collection.isJoinEnabled}",
+ );
final List<EnteFile>? initialFiles =
widget.c.thumbnail != null ? [widget.c.thumbnail!] : null;
final gallery = Gallery(
@@ -94,25 +96,27 @@ class _SharedPublicCollectionPageState
selectedFiles: _selectedFiles,
initialFiles: initialFiles,
albumName: widget.c.collection.displayName,
- header: Padding(
- padding: const EdgeInsets.all(8.0),
- child: NotificationWidget(
- startIcon: Icons.people_alt_outlined,
- actionIcon: null,
- actionWidget: ButtonWidget(
- buttonType: ButtonType.primary,
- labelText: "Join",
- buttonSize: ButtonSize.small,
- onTap: _joinAlbum,
- ),
- text: 'Join album',
- subText: widget.c.collection.isCollectEnabledForPublicLink()
- ? "to view and add your photos"
- : 'to add this to shared albums',
- type: NotificationType.notice,
- onTap: () async {},
- ),
- ),
+ header: widget.c.collection.isJoinEnabled
+ ? Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: NotificationWidget(
+ startIcon: Icons.people_alt_outlined,
+ actionIcon: null,
+ actionWidget: ButtonWidget(
+ buttonType: ButtonType.primary,
+ labelText: "Join",
+ buttonSize: ButtonSize.small,
+ onTap: _joinAlbum,
+ ),
+ text: 'Join album',
+ subText: widget.c.collection.isCollectEnabledForPublicLink()
+ ? "to view and add your photos"
+ : 'to add this to shared albums',
+ type: NotificationType.notice,
+ onTap: () async {},
+ ),
+ )
+ : null,
sortAsyncFn: () => widget.c.collection.pubMagicMetadata.asc ?? false,
);