Skip to content

Commit

Permalink
feat: ✨ ability to completely override userReactionCallback (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
vatsaltanna-simformsolutions authored Aug 6, 2024
1 parent 05a0358 commit 14708d7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
hide share icon in image view
* **Fix**: [232](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/232) The audio
record cancelIcon is overflowed pixel
* **Feat** [228](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/228) Ability to
completely override userReactionCallback

## [2.0.0]

Expand Down
4 changes: 4 additions & 0 deletions lib/src/models/reaction_popup_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ class ReactionPopupConfiguration {
/// Provides callback when user react on message.
final ReactionCallback? userReactionCallback;

/// Provides feasibility to completely override userReactionCallback defaults to false.
final bool? overrideUserReactionCallback;

const ReactionPopupConfiguration({
this.userReactionCallback,
this.overrideUserReactionCallback = false,
this.showGlassMorphismEffect = false,
this.backgroundColor,
this.shadow,
Expand Down
12 changes: 7 additions & 5 deletions lib/src/widgets/reaction_popup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,13 @@ class ReactionPopupState extends State<ReactionPopup>
onEmojiTap: (emoji) {
widget.onTap();
if (currentUser != null && _message != null) {
chatController?.setReaction(
emoji: emoji,
messageId: _message!.id,
userId: currentUser!.id,
);
if (!(reactionPopupConfig?.overrideUserReactionCallback ?? false)) {
chatController?.setReaction(
emoji: emoji,
messageId: _message!.id,
userId: currentUser!.id,
);
}
reactionPopupConfig?.userReactionCallback?.call(
_message!,
emoji,
Expand Down

0 comments on commit 14708d7

Please sign in to comment.