Skip to content

armgit / ente

Public Imported from GitHub
0

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

Enhance sharing functionality and email validation

AmanRajSinghMourya11ba58ddd31c
diff --git a/mobile/apps/locker/lib/services/collections/collections_api_client.dart b/mobile/apps/locker/lib/services/collections/collections_api_client.dart
index f7f25fd314..8b44b6b874 100644
--- a/mobile/apps/locker/lib/services/collections/collections_api_client.dart
+++ b/mobile/apps/locker/lib/services/collections/collections_api_client.dart
@@ -593,6 +593,7 @@ class CollectionApiClient {
final collection = CollectionService.instance.getFromCache(collectionID);
final updatedCollection = collection!.copyWith(sharees: sharees);
await _updateCollectionInDB(updatedCollection);
+ Bus.instance.fire(CollectionsUpdatedEvent("email_share_added"));
return sharees;
}
@@ -602,6 +603,7 @@ class CollectionApiClient {
final collection = CollectionService.instance.getFromCache(collectionID);
final updatedCollection = collection!.copyWith(sharees: sharees);
await _updateCollectionInDB(updatedCollection);
+ Bus.instance.fire(CollectionsUpdatedEvent("email_share_removed"));
return sharees;
}
diff --git a/mobile/apps/locker/lib/ui/pages/collection_page.dart b/mobile/apps/locker/lib/ui/pages/collection_page.dart
index c6c544e534..cff8800d16 100644
--- a/mobile/apps/locker/lib/ui/pages/collection_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/collection_page.dart
@@ -197,7 +197,6 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>
}
Future<void> _shareCollection() async {
- final collection = widget.collection;
try {
if ((collectionViewType != CollectionViewType.ownedCollection &&
collectionViewType != CollectionViewType.sharedCollection &&
@@ -214,9 +213,13 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>
backgroundColor: getEnteColorScheme(context).backgroundBase,
isScrollControlled: true,
builder: (context) => ShareCollectionBottomSheet(
- collection: collection,
+ collection: _collection,
),
);
+ // Refresh state after share sheet closes
+ if (mounted) {
+ setState(() {});
+ }
} catch (e, s) {
_logger.severe(e, s);
await showGenericErrorDialog(context: context, error: e);
diff --git a/mobile/apps/locker/lib/ui/sharing/add_email_bottom_sheet.dart b/mobile/apps/locker/lib/ui/sharing/add_email_bottom_sheet.dart
index 493cd70e9e..49994339c7 100644
--- a/mobile/apps/locker/lib/ui/sharing/add_email_bottom_sheet.dart
+++ b/mobile/apps/locker/lib/ui/sharing/add_email_bottom_sheet.dart
@@ -1,3 +1,4 @@
+import "package:email_validator/email_validator.dart";
import "package:ente_accounts/services/user_service.dart";
import "package:ente_sharing/models/user.dart";
import "package:ente_sharing/user_avator_widget.dart";
@@ -617,8 +618,7 @@ class _AddEmailBottomSheetState extends State<AddEmailBottomSheet> {
}
bool _isValidEmail(String email) {
- final emailRegex = RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
- return emailRegex.hasMatch(email);
+ return EmailValidator.validate(email);
}
bool _isScheduledDateTimeValid() {