Skip to content

Commit

Permalink
feat: ✨ ability to completely override userReactionCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
vatsaltanna-simformsolutions committed Aug 2, 2024
1 parent 4de800d commit ce4007a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
## [2.0.1]

* **Fix**: [226](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/226) Fixed
* **Fix**: [226](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/226) Fixed
the icons for starting and stopping recording were reversed
* **Fix**: [217](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/217) Fixed y
position of reaction popup
* **Feat** [223](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/223) Ability to
hide share icon in image view
* **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 ce4007a

Please sign in to comment.