Merge pull request #63 from GetStream/capabilities

added mip changes, capabilities changes
This commit is contained in:
Salvatore Giordano
2022-01-27 11:07:21 +01:00
committed by GitHub
6 changed files with 89 additions and 80 deletions
@@ -3,7 +3,7 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 46; objectVersion = 50;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
@@ -177,7 +177,7 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 1140; LastSwiftUpdateCheck = 1140;
LastUpgradeCheck = 1020; LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "The Chromium Authors"; ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = { TargetAttributes = {
97C146ED1CF9000F007C117D = { 97C146ED1CF9000F007C117D = {
@@ -245,7 +245,7 @@
"${BUILT_PRODUCTS_DIR}/DKImagePickerController/DKImagePickerController.framework", "${BUILT_PRODUCTS_DIR}/DKImagePickerController/DKImagePickerController.framework",
"${BUILT_PRODUCTS_DIR}/DKPhotoGallery/DKPhotoGallery.framework", "${BUILT_PRODUCTS_DIR}/DKPhotoGallery/DKPhotoGallery.framework",
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework", "${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
"${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework", "${BUILT_PRODUCTS_DIR}/ReachabilitySwift/Reachability.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
"${BUILT_PRODUCTS_DIR}/SwiftyGif/SwiftyGif.framework", "${BUILT_PRODUCTS_DIR}/SwiftyGif/SwiftyGif.framework",
"${BUILT_PRODUCTS_DIR}/connectivity_plus/connectivity_plus.framework", "${BUILT_PRODUCTS_DIR}/connectivity_plus/connectivity_plus.framework",
@@ -256,14 +256,14 @@
"${BUILT_PRODUCTS_DIR}/image_gallery_saver/image_gallery_saver.framework", "${BUILT_PRODUCTS_DIR}/image_gallery_saver/image_gallery_saver.framework",
"${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework", "${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework",
"${BUILT_PRODUCTS_DIR}/libwebp/libwebp.framework", "${BUILT_PRODUCTS_DIR}/libwebp/libwebp.framework",
"${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework", "${BUILT_PRODUCTS_DIR}/path_provider_ios/path_provider_ios.framework",
"${BUILT_PRODUCTS_DIR}/photo_manager/photo_manager.framework", "${BUILT_PRODUCTS_DIR}/photo_manager/photo_manager.framework",
"${BUILT_PRODUCTS_DIR}/share_plus/share_plus.framework", "${BUILT_PRODUCTS_DIR}/share_plus/share_plus.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework", "${BUILT_PRODUCTS_DIR}/shared_preferences_ios/shared_preferences_ios.framework",
"${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework", "${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework",
"${BUILT_PRODUCTS_DIR}/sqlite3/sqlite3.framework", "${BUILT_PRODUCTS_DIR}/sqlite3/sqlite3.framework",
"${BUILT_PRODUCTS_DIR}/sqlite3_flutter_libs/sqlite3_flutter_libs.framework", "${BUILT_PRODUCTS_DIR}/sqlite3_flutter_libs/sqlite3_flutter_libs.framework",
"${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework", "${BUILT_PRODUCTS_DIR}/url_launcher_ios/url_launcher_ios.framework",
"${BUILT_PRODUCTS_DIR}/video_compress/video_compress.framework", "${BUILT_PRODUCTS_DIR}/video_compress/video_compress.framework",
"${BUILT_PRODUCTS_DIR}/video_player/video_player.framework", "${BUILT_PRODUCTS_DIR}/video_player/video_player.framework",
"${BUILT_PRODUCTS_DIR}/video_thumbnail/video_thumbnail.framework", "${BUILT_PRODUCTS_DIR}/video_thumbnail/video_thumbnail.framework",
@@ -285,14 +285,14 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_gallery_saver.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_gallery_saver.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libwebp.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libwebp.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_ios.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/photo_manager.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/photo_manager.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/share_plus.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/share_plus.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences_ios.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqlite3.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqlite3.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqlite3_flutter_libs.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqlite3_flutter_libs.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher_ios.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_compress.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_compress.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_player.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_player.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_thumbnail.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_thumbnail.framework",
@@ -442,7 +442,10 @@
); );
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
@@ -581,7 +584,10 @@
); );
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
@@ -615,7 +621,10 @@
); );
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "1020" LastUpgradeVersion = "1300"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
@@ -34,8 +34,8 @@ class ChannelPage extends StatefulWidget {
} }
class _ChannelPageState extends State<ChannelPage> { class _ChannelPageState extends State<ChannelPage> {
Message? _quotedMessage;
FocusNode? _focusNode; FocusNode? _focusNode;
MessageInputController _messageInputController = MessageInputController();
@override @override
void initState() { void initState() {
@@ -50,7 +50,7 @@ class _ChannelPageState extends State<ChannelPage> {
} }
void _reply(Message message) { void _reply(Message message) {
setState(() => _quotedMessage = message); _messageInputController.quotedMessage = message;
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) { WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
_focusNode!.requestFocus(); _focusNode!.requestFocus();
}); });
@@ -144,7 +144,6 @@ class _ChannelPageState extends State<ChannelPage> {
threadBuilder: (_, parentMessage) { threadBuilder: (_, parentMessage) {
return ThreadPage(parent: parentMessage!); return ThreadPage(parent: parentMessage!);
}, },
pinPermissions: ['owner', 'admin', 'member'],
), ),
Positioned( Positioned(
bottom: 0, bottom: 0,
@@ -177,11 +176,7 @@ class _ChannelPageState extends State<ChannelPage> {
), ),
MessageInput( MessageInput(
focusNode: _focusNode, focusNode: _focusNode,
quotedMessage: _quotedMessage, messageInputController: _messageInputController,
onQuotedMessageCleared: () {
setState(() => _quotedMessage = null);
_focusNode!.unfocus();
},
), ),
], ],
), ),
@@ -85,11 +85,6 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
); );
} }
var userMember = snapshot.data!.firstWhereOrNull(
(e) => e.user!.id == StreamChat.of(context).currentUser!.id,
);
var isOwner = userMember?.role == 'owner';
return Scaffold( return Scaffold(
backgroundColor: StreamChatTheme.of(context).colorTheme.appBg, backgroundColor: StreamChatTheme.of(context).colorTheme.appBg,
appBar: AppBar( appBar: AppBar(
@@ -150,7 +145,8 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
), ),
centerTitle: true, centerTitle: true,
actions: [ actions: [
if (!channel.channel.isDistinct && isOwner) if (channel.channel.ownCapabilities
.contains(PermissionType.updateChannelMembers))
StreamNeumorphicButton( StreamNeumorphicButton(
child: InkWell( child: InkWell(
onTap: () { onTap: () {
@@ -174,7 +170,9 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
height: 8.0, height: 8.0,
color: StreamChatTheme.of(context).colorTheme.disabled, color: StreamChatTheme.of(context).colorTheme.disabled,
), ),
if (isOwner) _buildNameTile(), if (channel.channel.ownCapabilities
.contains(PermissionType.updateChannel))
_buildNameTile(),
_buildOptionListTiles(), _buildOptionListTiles(),
], ],
), ),
@@ -365,6 +363,8 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
), ),
Expanded( Expanded(
child: TextField( child: TextField(
enabled: channel.ownCapabilities
.contains(PermissionType.updateChannel),
focusNode: _focusNode, focusNode: _focusNode,
controller: _nameController, controller: _nameController,
cursorColor: cursorColor:
@@ -449,47 +449,50 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
// ), // ),
// onTap: () {}, // onTap: () {},
// ), // ),
StreamBuilder<bool>( if (channel.channel.ownCapabilities
stream: StreamChannel.of(context).channel.isMutedStream, .contains(PermissionType.muteChannel))
builder: (context, snapshot) { StreamBuilder<bool>(
mutedBool.value = snapshot.data; stream: StreamChannel.of(context).channel.isMutedStream,
builder: (context, snapshot) {
mutedBool.value = snapshot.data;
return OptionListTile( return OptionListTile(
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
separatorColor: StreamChatTheme.of(context).colorTheme.disabled, separatorColor:
title: AppLocalizations.of(context).muteGroup, StreamChatTheme.of(context).colorTheme.disabled,
titleTextStyle: StreamChatTheme.of(context).textTheme.body, title: AppLocalizations.of(context).muteGroup,
leading: Padding( titleTextStyle: StreamChatTheme.of(context).textTheme.body,
padding: const EdgeInsets.symmetric(horizontal: 16.0), leading: Padding(
child: StreamSvgIcon.mute( padding: const EdgeInsets.symmetric(horizontal: 16.0),
size: 24.0, child: StreamSvgIcon.mute(
color: StreamChatTheme.of(context) size: 24.0,
.colorTheme color: StreamChatTheme.of(context)
.textHighEmphasis .colorTheme
.withOpacity(0.5), .textHighEmphasis
.withOpacity(0.5),
),
), ),
), trailing: snapshot.data == null
trailing: snapshot.data == null ? CircularProgressIndicator()
? CircularProgressIndicator() : ValueListenableBuilder<bool?>(
: ValueListenableBuilder<bool?>( valueListenable: mutedBool,
valueListenable: mutedBool, builder: (context, value, _) {
builder: (context, value, _) { return CupertinoSwitch(
return CupertinoSwitch( value: value!,
value: value!, onChanged: (val) {
onChanged: (val) { mutedBool.value = val;
mutedBool.value = val;
if (snapshot.data!) { if (snapshot.data!) {
channel.channel.unmute(); channel.channel.unmute();
} else { } else {
channel.channel.mute(); channel.channel.mute();
} }
}, },
); );
}), }),
onTap: () {}, onTap: () {},
); );
}), }),
OptionListTile( OptionListTile(
title: AppLocalizations.of(context).pinnedMessages, title: AppLocalizations.of(context).pinnedMessages,
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
@@ -654,7 +657,9 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
); );
}, },
), ),
if (!channel.channel.isDistinct) if (!channel.channel.isDistinct &&
channel.channel.ownCapabilities
.contains(PermissionType.leaveChannel))
OptionListTile( OptionListTile(
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
separatorColor: StreamChatTheme.of(context).colorTheme.disabled, separatorColor: StreamChatTheme.of(context).colorTheme.disabled,
+9 -9
View File
@@ -18,8 +18,14 @@ class ThreadPage extends StatefulWidget {
} }
class _ThreadPageState extends State<ThreadPage> { class _ThreadPageState extends State<ThreadPage> {
Message? _quotedMessage;
FocusNode _focusNode = FocusNode(); FocusNode _focusNode = FocusNode();
late MessageInputController _messageInputController;
@override
void initState() {
super.initState();
_messageInputController = MessageInputController(message: widget.parent);
}
@override @override
void dispose() { void dispose() {
@@ -28,7 +34,7 @@ class _ThreadPageState extends State<ThreadPage> {
} }
void _reply(Message message) { void _reply(Message message) {
setState(() => _quotedMessage = message); _messageInputController.quotedMessage = message;
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) { WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
_focusNode.requestFocus(); _focusNode.requestFocus();
}); });
@@ -60,18 +66,12 @@ class _ThreadPageState extends State<ThreadPage> {
}, },
); );
}, },
pinPermissions: ['owner', 'admin', 'member'],
), ),
), ),
if (widget.parent.type != 'deleted') if (widget.parent.type != 'deleted')
MessageInput( MessageInput(
parentMessage: widget.parent,
focusNode: _focusNode, focusNode: _focusNode,
quotedMessage: _quotedMessage, messageInputController: _messageInputController,
onQuotedMessageCleared: () {
setState(() => _quotedMessage = null);
_focusNode.unfocus();
},
), ),
], ],
), ),
+4 -4
View File
@@ -23,7 +23,7 @@ dependencies:
stream_chat_localizations: stream_chat_localizations:
git: git:
url: https://github.com/GetStream/stream-chat-flutter.git url: https://github.com/GetStream/stream-chat-flutter.git
ref: develop ref: feat/capabilities
path: packages/stream_chat_localizations path: packages/stream_chat_localizations
flutter_local_notifications: ^9.0.0 flutter_local_notifications: ^9.0.0
flutter_svg: ^0.23.0 flutter_svg: ^0.23.0
@@ -42,17 +42,17 @@ dependency_overrides:
stream_chat: stream_chat:
git: git:
url: https://github.com/GetStream/stream-chat-flutter.git url: https://github.com/GetStream/stream-chat-flutter.git
ref: develop ref: feat/capabilities
path: packages/stream_chat path: packages/stream_chat
stream_chat_flutter_core: stream_chat_flutter_core:
git: git:
url: https://github.com/GetStream/stream-chat-flutter.git url: https://github.com/GetStream/stream-chat-flutter.git
ref: develop ref: feat/capabilities
path: packages/stream_chat_flutter_core path: packages/stream_chat_flutter_core
stream_chat_flutter: stream_chat_flutter:
git: git:
url: https://github.com/GetStream/stream-chat-flutter.git url: https://github.com/GetStream/stream-chat-flutter.git
ref: develop ref: feat/capabilities
path: packages/stream_chat_flutter path: packages/stream_chat_flutter
flutter: flutter: