forked from AmityCo/amity_social_cloud_sdk_flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added post and comment report module
- Loading branch information
Showing
13 changed files
with
167 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:amity_sdk/core/core.dart'; | ||
import 'package:amity_sdk/domain/domain.dart'; | ||
|
||
class CommentFlagUsecase extends UseCase<bool, String> { | ||
final CommentRepo commentRepo; | ||
|
||
CommentFlagUsecase({required this.commentRepo}); | ||
|
||
@override | ||
Future<bool> get(String params) { | ||
return commentRepo.flagComment(params); | ||
} | ||
|
||
@override | ||
Stream<bool> listen(String params) { | ||
// TODO: implement listen | ||
throw UnimplementedError(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:amity_sdk/core/core.dart'; | ||
import 'package:amity_sdk/domain/domain.dart'; | ||
|
||
class CommentUnflagUsecase extends UseCase<bool, String> { | ||
final CommentRepo commentRepo; | ||
|
||
CommentUnflagUsecase({required this.commentRepo}); | ||
|
||
@override | ||
Future<bool> get(String params) { | ||
return commentRepo.unflagComment(params); | ||
} | ||
|
||
@override | ||
Stream<bool> listen(String params) { | ||
// TODO: implement listen | ||
throw UnimplementedError(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:amity_sdk/core/core.dart'; | ||
import 'package:amity_sdk/domain/domain.dart'; | ||
|
||
class PostFlagUsecase extends UseCase<bool, String> { | ||
final PostRepo postRepo; | ||
|
||
PostFlagUsecase({required this.postRepo}); | ||
|
||
@override | ||
Future<bool> get(String params) { | ||
return postRepo.flagPost(params); | ||
} | ||
|
||
@override | ||
Stream<bool> listen(String params) { | ||
// TODO: implement listen | ||
throw UnimplementedError(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:amity_sdk/core/core.dart'; | ||
import 'package:amity_sdk/domain/domain.dart'; | ||
|
||
class PostUnflagUsecase extends UseCase<bool, String> { | ||
final PostRepo postRepo; | ||
|
||
PostUnflagUsecase({required this.postRepo}); | ||
|
||
@override | ||
Future<bool> get(String params) { | ||
return postRepo.unflagPost(params); | ||
} | ||
|
||
@override | ||
Stream<bool> listen(String params) { | ||
// TODO: implement listen | ||
throw UnimplementedError(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'package:amity_sdk/core/core.dart'; | ||
import 'package:amity_sdk/core/enum/reaction_reference_type.dart'; | ||
import 'package:amity_sdk/domain/domain.dart'; | ||
import 'package:amity_sdk/public/query_builder/comment/comment_flag_query_builder.dart'; | ||
import 'package:amity_sdk/public/query_builder/reaction/reaction_query_builder.dart'; | ||
|
||
extension AmityCommentExtension on AmityComment { | ||
AddReactionQueryBuilder react() { | ||
return AddReactionQueryBuilder( | ||
addReactionUsecase: serviceLocator(), | ||
removeReactionUsecase: serviceLocator(), | ||
referenceType: ReactionReferenceType.COMMENT.value, | ||
referenceId: commentId!); | ||
} | ||
|
||
CommentFlagQueryBuilder report() { | ||
return CommentFlagQueryBuilder( | ||
commentFlagUsecase: serviceLocator(), | ||
commentUnflagUsecase: serviceLocator(), | ||
commentId: commentId!); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
lib/public/query_builder/comment/comment_flag_query_builder.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'package:amity_sdk/domain/usecase/Comment/Comment_flag_usecase.dart'; | ||
import 'package:amity_sdk/domain/usecase/comment/comment_unflag_usecase.dart'; | ||
|
||
class CommentFlagQueryBuilder { | ||
final CommentFlagUsecase _commentFlagUsecase; | ||
final CommentUnflagUsecase _commentUnflagUsecase; | ||
final String _commentId; | ||
CommentFlagQueryBuilder( | ||
{required CommentFlagUsecase commentFlagUsecase, | ||
required CommentUnflagUsecase commentUnflagUsecase, | ||
required String commentId}) | ||
: _commentFlagUsecase = commentFlagUsecase, | ||
_commentUnflagUsecase = commentUnflagUsecase, | ||
_commentId = commentId; | ||
Future<bool> flag() { | ||
return _commentFlagUsecase.get(_commentId); | ||
} | ||
|
||
Future<bool> unflag() { | ||
return _commentUnflagUsecase.get(_commentId); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
lib/public/query_builder/post/post_flag_query_builder.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'package:amity_sdk/domain/usecase/post/post_flag_usecase.dart'; | ||
import 'package:amity_sdk/domain/usecase/post/post_unflag_usecase.dart'; | ||
|
||
class PostFlagQueryBuilder { | ||
final PostFlagUsecase _postFlagUsecase; | ||
final PostUnflagUsecase _postUnflagUsecase; | ||
final String _postId; | ||
PostFlagQueryBuilder( | ||
{required PostFlagUsecase postFlagUsecase, | ||
required PostUnflagUsecase postUnflagUsecase, | ||
required String postId}) | ||
: _postFlagUsecase = postFlagUsecase, | ||
_postUnflagUsecase = postUnflagUsecase, | ||
_postId = postId; | ||
Future<bool> flag() { | ||
return _postFlagUsecase.get(_postId); | ||
} | ||
|
||
Future<bool> unflag() { | ||
return _postUnflagUsecase.get(_postId); | ||
} | ||
} |
File renamed without changes.
25 changes: 0 additions & 25 deletions
25
lib/public/query_builder/reaction/remove_reaction_query_builder.dart
This file was deleted.
Oops, something went wrong.