Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] added a new gallery type for shared public link

Aman Raj Singh Mouryabda3ec2e3aa3
diff --git a/mobile/lib/models/gallery_type.dart b/mobile/lib/models/gallery_type.dart
index fb07f23a0a..469cae1a98 100644
--- a/mobile/lib/models/gallery_type.dart
+++ b/mobile/lib/models/gallery_type.dart
@@ -20,6 +20,7 @@ enum GalleryType {
quickLink,
peopleTag,
cluster,
+ sharedPublicLink,
}
extension GalleyTypeExtension on GalleryType {
@@ -42,6 +43,7 @@ extension GalleyTypeExtension on GalleryType {
case GalleryType.hiddenOwnedCollection:
case GalleryType.trash:
case GalleryType.cluster:
+ case GalleryType.sharedPublicLink:
return false;
}
}
@@ -65,6 +67,7 @@ extension GalleyTypeExtension on GalleryType {
case GalleryType.sharedCollection:
case GalleryType.locationTag:
case GalleryType.cluster:
+ case GalleryType.sharedPublicLink:
return false;
}
}
@@ -89,6 +92,7 @@ extension GalleyTypeExtension on GalleryType {
case GalleryType.hiddenSection:
case GalleryType.hiddenOwnedCollection:
case GalleryType.sharedCollection:
+ case GalleryType.sharedPublicLink:
return false;
}
}
@@ -111,6 +115,7 @@ extension GalleyTypeExtension on GalleryType {
case GalleryType.trash:
case GalleryType.cluster:
case GalleryType.sharedCollection:
+ case GalleryType.sharedPublicLink:
return false;
}
}
@@ -133,6 +138,7 @@ extension GalleyTypeExtension on GalleryType {
case GalleryType.trash:
case GalleryType.sharedCollection:
case GalleryType.quickLink:
+ case GalleryType.sharedPublicLink:
return false;
}
}
@@ -155,6 +161,7 @@ extension GalleyTypeExtension on GalleryType {
case GalleryType.cluster:
case GalleryType.trash:
case GalleryType.locationTag:
+ case GalleryType.sharedPublicLink:
return false;
}
}
@@ -178,6 +185,7 @@ extension GalleyTypeExtension on GalleryType {
case GalleryType.sharedCollection:
case GalleryType.locationTag:
case GalleryType.cluster:
+ case GalleryType.sharedPublicLink:
return false;
}
}
@@ -205,6 +213,7 @@ extension GalleyTypeExtension on GalleryType {
case GalleryType.favorite:
case GalleryType.cluster:
case GalleryType.sharedCollection:
+ case GalleryType.sharedPublicLink:
return false;
}
}
@@ -233,6 +242,7 @@ extension GalleyTypeExtension on GalleryType {
case GalleryType.localFolder:
case GalleryType.trash:
case GalleryType.sharedCollection:
+ case GalleryType.sharedPublicLink:
return false;
}
}
@@ -275,6 +285,9 @@ extension GalleryAppBarExtn on GalleryType {
this == GalleryType.hiddenOwnedCollection) {
return true;
}
+ if (this == GalleryType.sharedPublicLink && c!.isEnableCollect()) {
+ return true;
+ }
if (this == GalleryType.sharedCollection) {
return c?.getRole(userID) == CollectionParticipantRole.collaborator;
}
@@ -353,6 +366,7 @@ extension GalleryAppBarExtn on GalleryType {
case GalleryType.localFolder:
case GalleryType.locationTag:
case GalleryType.searchResults:
+ case GalleryType.sharedPublicLink:
return false;
case GalleryType.cluster:
case GalleryType.uncategorized:
@@ -368,6 +382,9 @@ extension GalleryAppBarExtn on GalleryType {
}
GalleryType getGalleryType(Collection c, int userID) {
+ if (c.type == CollectionType.album) {
+ return GalleryType.sharedPublicLink;
+ }
if (!c.isOwner(userID)) {
return GalleryType.sharedCollection;
}
diff --git a/mobile/lib/services/collections_service.dart b/mobile/lib/services/collections_service.dart
index bb2031750b..f447949f77 100644
--- a/mobile/lib/services/collections_service.dart
+++ b/mobile/lib/services/collections_service.dart
@@ -1054,6 +1054,7 @@ class CollectionsService {
final Collection collection = Collection.fromMap(collectionData);
final Uint8List collectionKey =
Uint8List.fromList(Base58Decode(albumKey));
+ collection.setName(_getDecryptedCollectionName(collection));
_cachedKeys[collection.id] = collectionKey;
_cachedPublicAlbumToken[collection.id] = authToken;
diff --git a/mobile/lib/ui/viewer/gallery/collection_page.dart b/mobile/lib/ui/viewer/gallery/collection_page.dart
index 3204879f28..0cfecb4410 100644
--- a/mobile/lib/ui/viewer/gallery/collection_page.dart
+++ b/mobile/lib/ui/viewer/gallery/collection_page.dart
@@ -117,8 +117,7 @@ class CollectionPage extends StatelessWidget {
_selectedFiles,
collection: c.collection,
isFromCollectPhotos: isFromCollectPhotos,
- isFromPublicShareLink: isFromPublicShareLink,
- files: sharedLinkFiles!,
+ sharedLinkFiles: sharedLinkFiles,
),
),
bottomNavigationBar: isFromCollectPhotos