Skip to content

Commit b7d6d0a

Browse files
authored
Merge pull request #13 from talkjs/feat/participant-notification
Implemented the notification property for participants
2 parents 4e86e06 + 19d1e41 commit b7d6d0a

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.0
2+
3+
- BREAKING CHANGE: Changed the `notify` property of the `Participant` to allow for mentions only
4+
15
## 0.3.1
26

37
- Added explicit support for Android and iOS in pubspec.yaml

lib/src/chatbox.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ class ChatBoxState extends State<ChatBox> {
517517
}
518518

519519
if (participant.notify != null) {
520-
result['notify'] = participant.notify;
520+
result['notify'] = participant.notify!.getValue();
521521
}
522522

523523
execute('$variableName.setParticipant($userVariableName, ${json.encode(result)});');

lib/src/conversation.dart

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,30 @@ extension ParticipantAccessString on ParticipantAccess {
2020
}
2121
}
2222

23+
/// Possible values for participants' notifications
24+
enum ParticipantNotification { off, on, mentionsOnly }
25+
26+
extension ParticipantNotificationString on ParticipantNotification {
27+
/// Converts this enum's values to String.
28+
dynamic getValue() {
29+
switch (this) {
30+
case ParticipantNotification.off:
31+
return false;
32+
case ParticipantNotification.on:
33+
return true;
34+
case ParticipantNotification.mentionsOnly:
35+
return 'MentionsOnly';
36+
}
37+
}
38+
}
39+
2340
// Participants are users + options relative to this conversation
2441
class Participant {
2542
final User user;
2643

2744
final ParticipantAccess? access;
2845

29-
final bool? notify;
46+
final ParticipantNotification? notify;
3047

3148
const Participant(this.user, {this.access, this.notify});
3249

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: talkjs_flutter
22
description: Official TalkJS SDK for Flutter
3-
version: 0.3.1
3+
version: 0.4.0
44
homepage: https://talkjs.com
55

66
environment:

0 commit comments

Comments
 (0)