Skip to content

armgit / ente

Public Imported from GitHub
0

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

Refactor CommentsScreen to FileCommentsScreen

ashilknd0a473f85515
diff --git a/mobile/apps/photos/lib/ui/social/comments_screen.dart b/mobile/apps/photos/lib/ui/social/comments_screen.dart
index fc3d49e5ac..c9368e31ec 100644
--- a/mobile/apps/photos/lib/ui/social/comments_screen.dart
+++ b/mobile/apps/photos/lib/ui/social/comments_screen.dart
@@ -13,21 +13,21 @@ import "package:photos/ui/social/widgets/comment_bubble_widget.dart";
import "package:photos/ui/social/widgets/comment_input_widget.dart";
import "package:uuid/uuid.dart";
-class CommentsScreen extends StatefulWidget {
+class FileCommentsScreen extends StatefulWidget {
final int collectionID;
- final int? fileID;
+ final int fileID;
- const CommentsScreen({
+ const FileCommentsScreen({
required this.collectionID,
- this.fileID,
+ required this.fileID,
super.key,
});
@override
- State<CommentsScreen> createState() => _CommentsScreenState();
+ State<FileCommentsScreen> createState() => _FileCommentsScreenState();
}
-class _CommentsScreenState extends State<CommentsScreen> {
+class _FileCommentsScreenState extends State<FileCommentsScreen> {
final List<Comment> _comments = [];
Comment? _replyingTo;
@@ -65,17 +65,12 @@ class _CommentsScreenState extends State<CommentsScreen> {
Future<void> _loadInitialComments() async {
setState(() => _isLoading = true);
- final comments = widget.fileID != null
- ? await SocialDataProvider.instance.getCommentsForFilePaginated(
- widget.fileID!,
- limit: _pageSize,
- offset: 0,
- )
- : await SocialDataProvider.instance.getCommentsForCollectionPaginated(
- widget.collectionID,
- limit: _pageSize,
- offset: 0,
- );
+ final comments =
+ await SocialDataProvider.instance.getCommentsForFilePaginated(
+ widget.fileID,
+ limit: _pageSize,
+ offset: 0,
+ );
setState(() {
_comments.addAll(comments);
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart b/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart
index 7bc5c9b55d..24868517af 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart
@@ -406,9 +406,9 @@ class FileBottomBarState extends State<FileBottomBar> {
routeToPage(
context,
- CommentsScreen(
+ FileCommentsScreen(
collectionID: file.collectionID!,
- fileID: file.uploadedFileID,
+ fileID: file.uploadedFileID!,
),
).then((_) {
// Refresh comment count when returning from comments screen