Skip to content

Commit 3edbfc9

Browse files
committed
added mip changes, capabilities changes
1 parent b59482d commit 3edbfc9

File tree

4 files changed

+66
-61
lines changed

4 files changed

+66
-61
lines changed

packages/stream_chat_v1/lib/channel_page.dart

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class ChannelPage extends StatefulWidget {
3434
}
3535

3636
class _ChannelPageState extends State<ChannelPage> {
37-
Message? _quotedMessage;
3837
FocusNode? _focusNode;
38+
MessageInputController _messageInputController = MessageInputController();
3939

4040
@override
4141
void initState() {
@@ -50,7 +50,7 @@ class _ChannelPageState extends State<ChannelPage> {
5050
}
5151

5252
void _reply(Message message) {
53-
setState(() => _quotedMessage = message);
53+
_messageInputController.quotedMessage = message;
5454
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
5555
_focusNode!.requestFocus();
5656
});
@@ -144,7 +144,6 @@ class _ChannelPageState extends State<ChannelPage> {
144144
threadBuilder: (_, parentMessage) {
145145
return ThreadPage(parent: parentMessage!);
146146
},
147-
pinPermissions: ['owner', 'admin', 'member'],
148147
),
149148
Positioned(
150149
bottom: 0,
@@ -177,11 +176,7 @@ class _ChannelPageState extends State<ChannelPage> {
177176
),
178177
MessageInput(
179178
focusNode: _focusNode,
180-
quotedMessage: _quotedMessage,
181-
onQuotedMessageCleared: () {
182-
setState(() => _quotedMessage = null);
183-
_focusNode!.unfocus();
184-
},
179+
messageInputController: _messageInputController,
185180
),
186181
],
187182
),

packages/stream_chat_v1/lib/group_info_screen.dart

Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
150150
),
151151
centerTitle: true,
152152
actions: [
153-
if (!channel.channel.isDistinct && isOwner)
153+
if (!channel.channel.isDistinct &&
154+
isOwner &&
155+
channel.channel.ownCapabilities
156+
.contains(PermissionType.updateChannelMembers))
154157
StreamNeumorphicButton(
155158
child: InkWell(
156159
onTap: () {
@@ -365,6 +368,8 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
365368
),
366369
Expanded(
367370
child: TextField(
371+
enabled: channel.ownCapabilities
372+
.contains(PermissionType.updateChannel),
368373
focusNode: _focusNode,
369374
controller: _nameController,
370375
cursorColor:
@@ -449,47 +454,50 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
449454
// ),
450455
// onTap: () {},
451456
// ),
452-
StreamBuilder<bool>(
453-
stream: StreamChannel.of(context).channel.isMutedStream,
454-
builder: (context, snapshot) {
455-
mutedBool.value = snapshot.data;
457+
if (channel.channel.ownCapabilities
458+
.contains(PermissionType.muteChannel))
459+
StreamBuilder<bool>(
460+
stream: StreamChannel.of(context).channel.isMutedStream,
461+
builder: (context, snapshot) {
462+
mutedBool.value = snapshot.data;
456463

457-
return OptionListTile(
458-
tileColor: StreamChatTheme.of(context).colorTheme.appBg,
459-
separatorColor: StreamChatTheme.of(context).colorTheme.disabled,
460-
title: AppLocalizations.of(context).muteGroup,
461-
titleTextStyle: StreamChatTheme.of(context).textTheme.body,
462-
leading: Padding(
463-
padding: const EdgeInsets.symmetric(horizontal: 16.0),
464-
child: StreamSvgIcon.mute(
465-
size: 24.0,
466-
color: StreamChatTheme.of(context)
467-
.colorTheme
468-
.textHighEmphasis
469-
.withOpacity(0.5),
464+
return OptionListTile(
465+
tileColor: StreamChatTheme.of(context).colorTheme.appBg,
466+
separatorColor:
467+
StreamChatTheme.of(context).colorTheme.disabled,
468+
title: AppLocalizations.of(context).muteGroup,
469+
titleTextStyle: StreamChatTheme.of(context).textTheme.body,
470+
leading: Padding(
471+
padding: const EdgeInsets.symmetric(horizontal: 16.0),
472+
child: StreamSvgIcon.mute(
473+
size: 24.0,
474+
color: StreamChatTheme.of(context)
475+
.colorTheme
476+
.textHighEmphasis
477+
.withOpacity(0.5),
478+
),
470479
),
471-
),
472-
trailing: snapshot.data == null
473-
? CircularProgressIndicator()
474-
: ValueListenableBuilder<bool?>(
475-
valueListenable: mutedBool,
476-
builder: (context, value, _) {
477-
return CupertinoSwitch(
478-
value: value!,
479-
onChanged: (val) {
480-
mutedBool.value = val;
480+
trailing: snapshot.data == null
481+
? CircularProgressIndicator()
482+
: ValueListenableBuilder<bool?>(
483+
valueListenable: mutedBool,
484+
builder: (context, value, _) {
485+
return CupertinoSwitch(
486+
value: value!,
487+
onChanged: (val) {
488+
mutedBool.value = val;
481489

482-
if (snapshot.data!) {
483-
channel.channel.unmute();
484-
} else {
485-
channel.channel.mute();
486-
}
487-
},
488-
);
489-
}),
490-
onTap: () {},
491-
);
492-
}),
490+
if (snapshot.data!) {
491+
channel.channel.unmute();
492+
} else {
493+
channel.channel.mute();
494+
}
495+
},
496+
);
497+
}),
498+
onTap: () {},
499+
);
500+
}),
493501
OptionListTile(
494502
title: AppLocalizations.of(context).pinnedMessages,
495503
tileColor: StreamChatTheme.of(context).colorTheme.appBg,
@@ -654,7 +662,9 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
654662
);
655663
},
656664
),
657-
if (!channel.channel.isDistinct)
665+
if (!channel.channel.isDistinct &&
666+
channel.channel.ownCapabilities
667+
.contains(PermissionType.leaveChannel))
658668
OptionListTile(
659669
tileColor: StreamChatTheme.of(context).colorTheme.appBg,
660670
separatorColor: StreamChatTheme.of(context).colorTheme.disabled,

packages/stream_chat_v1/lib/thread_page.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@ class ThreadPage extends StatefulWidget {
1818
}
1919

2020
class _ThreadPageState extends State<ThreadPage> {
21-
Message? _quotedMessage;
2221
FocusNode _focusNode = FocusNode();
22+
late MessageInputController _messageInputController;
23+
24+
@override
25+
void initState() {
26+
super.initState();
27+
_messageInputController = MessageInputController(message: widget.parent);
28+
}
2329

2430
@override
2531
void dispose() {
@@ -28,7 +34,7 @@ class _ThreadPageState extends State<ThreadPage> {
2834
}
2935

3036
void _reply(Message message) {
31-
setState(() => _quotedMessage = message);
37+
_messageInputController.quotedMessage = message;
3238
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
3339
_focusNode.requestFocus();
3440
});
@@ -60,18 +66,12 @@ class _ThreadPageState extends State<ThreadPage> {
6066
},
6167
);
6268
},
63-
pinPermissions: ['owner', 'admin', 'member'],
6469
),
6570
),
6671
if (widget.parent.type != 'deleted')
6772
MessageInput(
68-
parentMessage: widget.parent,
6973
focusNode: _focusNode,
70-
quotedMessage: _quotedMessage,
71-
onQuotedMessageCleared: () {
72-
setState(() => _quotedMessage = null);
73-
_focusNode.unfocus();
74-
},
74+
messageInputController: _messageInputController,
7575
),
7676
],
7777
),

packages/stream_chat_v1/pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dependencies:
2323
stream_chat_localizations:
2424
git:
2525
url: https://github.com/GetStream/stream-chat-flutter.git
26-
ref: develop
26+
ref: feat/capabilities
2727
path: packages/stream_chat_localizations
2828
flutter_local_notifications: ^9.0.0
2929
flutter_svg: ^0.23.0
@@ -42,17 +42,17 @@ dependency_overrides:
4242
stream_chat:
4343
git:
4444
url: https://github.com/GetStream/stream-chat-flutter.git
45-
ref: develop
45+
ref: feat/capabilities
4646
path: packages/stream_chat
4747
stream_chat_flutter_core:
4848
git:
4949
url: https://github.com/GetStream/stream-chat-flutter.git
50-
ref: develop
50+
ref: feat/capabilities
5151
path: packages/stream_chat_flutter_core
5252
stream_chat_flutter:
5353
git:
5454
url: https://github.com/GetStream/stream-chat-flutter.git
55-
ref: develop
55+
ref: feat/capabilities
5656
path: packages/stream_chat_flutter
5757

5858
flutter:

0 commit comments

Comments
 (0)