Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add enable comments setting to public link management

ashilkndcbb36493a41
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index b97e5b894b..251ced56ee 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -203,6 +203,7 @@
},
"allowJoiningAlbum": "Allow joining album",
"allowAddPhotosDescription": "Allow people with the link to also add photos to the shared album.",
+ "enableComment": "Enable comments",
"passwordLock": "Password lock",
"canNotOpenTitle": "Cannot open this album",
"canNotOpenBody": "Sorry, this album cannot be opened in the app.",
diff --git a/mobile/apps/photos/lib/models/api/collection/public_url.dart b/mobile/apps/photos/lib/models/api/collection/public_url.dart
index d379a782c9..8eb63b0745 100644
--- a/mobile/apps/photos/lib/models/api/collection/public_url.dart
+++ b/mobile/apps/photos/lib/models/api/collection/public_url.dart
@@ -6,6 +6,7 @@ class PublicURL {
bool enableCollect;
bool passwordEnabled;
bool enableJoin;
+ bool enableComment;
String? nonce;
int? opsLimit;
int? memLimit;
@@ -18,6 +19,7 @@ class PublicURL {
this.passwordEnabled = false,
this.enableCollect = false,
this.enableJoin = true,
+ this.enableComment = false,
this.nonce,
this.opsLimit,
this.memLimit,
@@ -35,6 +37,7 @@ class PublicURL {
'memLimit': memLimit,
'opsLimit': opsLimit,
'enableJoin': enableJoin,
+ 'enableComment': enableComment,
};
}
@@ -58,6 +61,7 @@ class PublicURL {
opsLimit: map['opsLimit'],
memLimit: map['memLimit'],
enableJoin: map['enableJoin'] ?? true,
+ enableComment: map['enableComment'] ?? false,
);
}
}
diff --git a/mobile/apps/photos/lib/ui/sharing/manage_links_widget.dart b/mobile/apps/photos/lib/ui/sharing/manage_links_widget.dart
index ed628ab75e..e19a9cc909 100644
--- a/mobile/apps/photos/lib/ui/sharing/manage_links_widget.dart
+++ b/mobile/apps/photos/lib/ui/sharing/manage_links_widget.dart
@@ -74,6 +74,8 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
widget.collection!.publicURLs.firstOrNull?.passwordEnabled ?? false;
final isJoinEnabled =
widget.collection!.publicURLs.firstOrNull?.enableJoin ?? true;
+ final enableComment =
+ widget.collection!.publicURLs.firstOrNull?.enableComment ?? false;
final enteColorScheme = getEnteColorScheme(context);
final PublicURL url = widget.collection!.publicURLs.firstOrNull!;
final String urlValue = CollectionsService.instance.getPublicUrl(
@@ -122,7 +124,8 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
title: AppLocalizations.of(context).allowAddingPhotos,
),
alignCaptionedTextToLeft: true,
- menuItemColor: getEnteColorScheme(context).fillFaint,
+ isBottomBorderRadiusRemoved: true,
+ menuItemColor: enteColorScheme.fillFaint,
trailingWidget: ToggleSwitchWidget(
value: () => isCollectEnabled,
onChanged: () async {
@@ -132,6 +135,27 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
},
),
),
+ DividerWidget(
+ dividerType: DividerType.menuNoIcon,
+ bgColor: enteColorScheme.fillFaint,
+ ),
+ MenuItemWidget(
+ key: ValueKey("Enable comment $enableComment"),
+ captionedTextWidget: CaptionedTextWidget(
+ title: AppLocalizations.of(context).enableComment,
+ ),
+ alignCaptionedTextToLeft: true,
+ isTopBorderRadiusRemoved: true,
+ menuItemColor: enteColorScheme.fillFaint,
+ trailingWidget: ToggleSwitchWidget(
+ value: () => enableComment,
+ onChanged: () async {
+ await _updateUrlSettings(context, {
+ 'enableComment': !enableComment,
+ });
+ },
+ ),
+ ),
const SizedBox(height: 24),
MenuItemWidget(
alignCaptionedTextToLeft: true,