Exposed score for send reaction in the client side as well
This commit is contained in:
@@ -811,7 +811,7 @@ class Channel {
|
|||||||
Future<SendReactionResponse> sendReaction(
|
Future<SendReactionResponse> sendReaction(
|
||||||
Message message,
|
Message message,
|
||||||
String type, {
|
String type, {
|
||||||
int? score,
|
int score = 1,
|
||||||
Map<String, Object?> extraData = const {},
|
Map<String, Object?> extraData = const {},
|
||||||
bool enforceUnique = false,
|
bool enforceUnique = false,
|
||||||
}) async {
|
}) async {
|
||||||
@@ -830,7 +830,7 @@ class Channel {
|
|||||||
createdAt: now,
|
createdAt: now,
|
||||||
type: type,
|
type: type,
|
||||||
user: user,
|
user: user,
|
||||||
score: 1,
|
score: score,
|
||||||
extraData: extraData,
|
extraData: extraData,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -863,17 +863,11 @@ class Channel {
|
|||||||
|
|
||||||
state?.addMessage(newMessage);
|
state?.addMessage(newMessage);
|
||||||
|
|
||||||
if (score != null) {
|
|
||||||
extraData.putIfAbsent(
|
|
||||||
'score',
|
|
||||||
() => score,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final reactionResp = await _client.sendReaction(
|
final reactionResp = await _client.sendReaction(
|
||||||
messageId,
|
messageId,
|
||||||
type,
|
type,
|
||||||
|
score: score,
|
||||||
extraData: extraData,
|
extraData: extraData,
|
||||||
enforceUnique: enforceUnique,
|
enforceUnique: enforceUnique,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1157,15 +1157,22 @@ class StreamChatClient {
|
|||||||
Future<SendReactionResponse> sendReaction(
|
Future<SendReactionResponse> sendReaction(
|
||||||
String messageId,
|
String messageId,
|
||||||
String reactionType, {
|
String reactionType, {
|
||||||
|
int score = 1,
|
||||||
Map<String, Object?> extraData = const {},
|
Map<String, Object?> extraData = const {},
|
||||||
bool enforceUnique = false,
|
bool enforceUnique = false,
|
||||||
}) =>
|
}) {
|
||||||
_chatApi.message.sendReaction(
|
extraData.putIfAbsent(
|
||||||
messageId,
|
'score',
|
||||||
reactionType,
|
() => score,
|
||||||
extraData: extraData,
|
);
|
||||||
enforceUnique: enforceUnique,
|
|
||||||
);
|
return _chatApi.message.sendReaction(
|
||||||
|
messageId,
|
||||||
|
reactionType,
|
||||||
|
extraData: extraData,
|
||||||
|
enforceUnique: enforceUnique,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// Delete a [reactionType] from this [messageId]
|
/// Delete a [reactionType] from this [messageId]
|
||||||
Future<EmptyResponse> deleteReaction(
|
Future<EmptyResponse> deleteReaction(
|
||||||
|
|||||||
Reference in New Issue
Block a user