collectionService changes

This commit is contained in:
Abhinav-grd 2021-01-25 00:29:39 +05:30
parent 183f1226b2
commit 75e27aa51f

View file

@ -314,11 +314,13 @@ class CollectionsService {
void _cacheCollectionAttributes(Collection collection) {
_collectionIDToCollections[collection.id] = collection;
final updatedCollection = getCollectionWithDecryptedName(collection);
final collectionWithDecryptedName =
_getCollectionWithDecryptedName(collection);
if (collection.attributes.encryptedPath != null) {
_localCollections[decryptCollectionPath(collection)] = updatedCollection;
_localCollections[decryptCollectionPath(collection)] =
collectionWithDecryptedName;
}
_collectionIDToCollections[collection.id] = updatedCollection;
_collectionIDToCollections[collection.id] = collectionWithDecryptedName;
}
String decryptCollectionPath(Collection collection) {
@ -331,9 +333,10 @@ class CollectionsService {
Sodium.base642bin(collection.attributes.pathDecryptionNonce)));
}
Collection getCollectionWithDecryptedName(Collection collection) {
Collection _getCollectionWithDecryptedName(Collection collection) {
var name;
if (collection.encryptedName != null && collection.encryptedName != "") {
if (collection.encryptedName != null &&
collection.encryptedName.isNotEmpty) {
name = utf8.decode(CryptoUtil.decryptSync(
Sodium.base642bin(collection.encryptedName),
getCollectionKey(collection.id),