diff --git a/packages/chatty/lib/data/local/stream_api_local_impl.dart b/packages/chatty/lib/data/local/stream_api_local_impl.dart index 8337c92..4a84e35 100644 --- a/packages/chatty/lib/data/local/stream_api_local_impl.dart +++ b/packages/chatty/lib/data/local/stream_api_local_impl.dart @@ -84,6 +84,6 @@ class StreamApiLocalImpl extends StreamApiRepository { User(id: userId), token, ); - return _client.state.user!.name != null && _client.state.user!.name != userId; + return _client.state.user!.name != userId; } } diff --git a/packages/chatty/lib/data/prod/stream_api_impl.dart b/packages/chatty/lib/data/prod/stream_api_impl.dart index 877e210..fa65e76 100644 --- a/packages/chatty/lib/data/prod/stream_api_impl.dart +++ b/packages/chatty/lib/data/prod/stream_api_impl.dart @@ -99,6 +99,6 @@ class StreamApiImpl extends StreamApiRepository { User(id: userId), token, ); - return _client.state.user!.name != null && _client.state.user!.name != userId; + return _client.state.user!.name != userId; } } diff --git a/packages/chatty/lib/ui/common/my_channel_preview.dart b/packages/chatty/lib/ui/common/my_channel_preview.dart index cd2417f..2e168b5 100644 --- a/packages/chatty/lib/ui/common/my_channel_preview.dart +++ b/packages/chatty/lib/ui/common/my_channel_preview.dart @@ -232,29 +232,27 @@ class MyChannelPreview extends StatelessWidget { } var text = lastMessage.text; - if (lastMessage.attachments != null) { - final parts = [ - ...lastMessage.attachments.map((e) { - if (e.type == 'image') { - return '📷'; - } else if (e.type == 'video') { - return '🎬'; - } else if (e.type == 'giphy') { - return '[GIF]'; - } - return e == lastMessage.attachments.last - ? (e.title ?? 'File') - : '${e.title ?? 'File'} , '; - }).where((e) => e != null), - lastMessage.text ?? '', - ]; + final parts = [ + ...lastMessage.attachments.map((e) { + if (e.type == 'image') { + return '📷'; + } else if (e.type == 'video') { + return '🎬'; + } else if (e.type == 'giphy') { + return '[GIF]'; + } + return e == lastMessage.attachments.last + ? (e.title ?? 'File') + : '${e.title ?? 'File'} , '; + }), + lastMessage.text ?? '', + ]; - text = parts.join(' '); - } + text = parts.join(' '); return Text.rich( _getDisplayText( - text!, + text, lastMessage.mentionedUsers, lastMessage.attachments, StreamChatTheme.of(context).channelPreviewTheme.subtitle!.copyWith( @@ -291,15 +289,13 @@ class MyChannelPreview extends StatelessWidget { var textList = text.split(' '); var resList = []; for (var e in textList) { - if (mentions != null && - mentions.isNotEmpty && + if (mentions.isNotEmpty && mentions.any((element) => '@${element.name}' == e)) { resList.add(TextSpan( text: '$e ', style: mentionsTextStyle, )); - } else if (attachments != null && - attachments.isNotEmpty && + } else if (attachments.isNotEmpty && attachments .where((e) => e.title != null) .any((element) => element.title == e)) { diff --git a/packages/chatty/lib/ui/sign_in/sign_in_cubit.dart b/packages/chatty/lib/ui/sign_in/sign_in_cubit.dart index 10d23b2..ee341f2 100644 --- a/packages/chatty/lib/ui/sign_in/sign_in_cubit.dart +++ b/packages/chatty/lib/ui/sign_in/sign_in_cubit.dart @@ -20,10 +20,8 @@ class SignInCubit extends Cubit { emit(SignInState.existing_user); } } catch (ex) { - final result = await _loginUseCase.signIn(); - if (result != null) { - emit(SignInState.none); - } + _loginUseCase.signIn(); + emit(SignInState.none); } } } diff --git a/packages/chatty/lib/ui/themes.dart b/packages/chatty/lib/ui/themes.dart index c99082d..ef9412b 100644 --- a/packages/chatty/lib/ui/themes.dart +++ b/packages/chatty/lib/ui/themes.dart @@ -44,7 +44,7 @@ class Themes { selectedItemColor: primaryColor, unselectedItemColor: Colors.grey[300], ), - textSelectionColor: Colors.white, + textSelectionTheme: TextSelectionThemeData(selectionColor: Colors.white), // switch active color toggleableActiveColor: primaryColor, canvasColor: backgroundDarkColor,