Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] fixed album name not displaying and app bar fixes

Aman Raj Singh Mourya1bcacc921b01
diff --git a/mobile/lib/models/gallery_type.dart b/mobile/lib/models/gallery_type.dart
index 54028ee8a2..893ab302d6 100644
--- a/mobile/lib/models/gallery_type.dart
+++ b/mobile/lib/models/gallery_type.dart
@@ -393,9 +393,6 @@ extension GalleryAppBarExtn on GalleryType {
}
GalleryType getGalleryType(Collection c, int userID) {
- if (c.type == CollectionType.album) {
- return GalleryType.sharedPublicCollection;
- }
if (!c.isOwner(userID)) {
return GalleryType.sharedCollection;
}
diff --git a/mobile/lib/services/collections_service.dart b/mobile/lib/services/collections_service.dart
index f447949f77..e7280c62ce 100644
--- a/mobile/lib/services/collections_service.dart
+++ b/mobile/lib/services/collections_service.dart
@@ -67,6 +67,7 @@ class CollectionsService {
final Map<int, int> _countCache = <int, int>{};
final _cachedPublicAlbumToken = <int, String>{};
final _cachedPublicAlbumJWTToken = <int, String>{};
+ final _cachedPublicCollectionID = <int>[];
CollectionsService._privateConstructor() {
_db = CollectionsDB.instance;
@@ -177,6 +178,7 @@ class CollectionsService {
cachedUncategorizedCollection = null;
_cachedPublicAlbumToken.clear();
_cachedPublicAlbumJWTToken.clear();
+ _cachedPublicCollectionID.clear();
_cachedKeys.clear();
}
@@ -1054,10 +1056,11 @@ 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;
+ _cachedPublicCollectionID.add(collection.id);
+ collection.setName(_getDecryptedCollectionName(collection));
return collection;
} catch (e, s) {
_logger.warning(e, s);
@@ -1111,6 +1114,10 @@ class CollectionsService {
return null;
}
+ Future<bool> isPublicCollection(int collectionID) async {
+ return _cachedPublicCollectionID.contains(collectionID);
+ }
+
Future<void> setPublicAlbumTokenJWT(int collectionID, String token) async {
_cachedPublicAlbumJWTToken[collectionID] = token;
}
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 542a95dadb..0cde8ed775 100644
--- a/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dart
+++ b/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dart
@@ -1,5 +1,4 @@
import "package:flutter/material.dart";
-import "package:photos/core/configuration.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/collection_meta_event.dart";
import "package:photos/events/collection_updated_event.dart";
@@ -30,15 +29,12 @@ class SharedPublicCollectionPage extends StatelessWidget {
);
final _selectedFiles = SelectedFiles();
+ final galleryType = GalleryType.sharedPublicCollection;
@override
Widget build(BuildContext context) {
final bool isPublicDownload = c.collection.isPublicDownload();
final bool isisEnableCollect = c.collection.isEnableCollect();
- final galleryType = getGalleryType(
- c.collection,
- Configuration.instance.getUserID()!,
- );
final List<EnteFile>? initialFiles =
c.thumbnail != null ? [c.thumbnail!] : null;
final gallery = Gallery(