This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<void> sendCapturedPhotoToSelectedUsers({ | |
required String pathOfTheTakenPhoto, | |
required int sizeOfTheTakenPhoto, | |
}) async { | |
if (state.isInProgress) { | |
return; | |
} | |
emit(state.copyWith(isInProgress: true)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Future<void> close() async { | |
await _currentUserChannelsSubscription?.cancel(); | |
super.close(); | |
} | |
void reset() { | |
emit( | |
state.copyWith( | |
isInProgress: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Future<void> close() async { | |
await _currentUserChannelsSubscription?.cancel(); | |
super.close(); | |
} | |
void reset() { | |
emit( | |
state.copyWith( | |
isInProgress: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
part of 'chat_management_cubit.dart'; | |
@freezed | |
class ChatManagementState with _$ChatManagementState { | |
const factory ChatManagementState({ | |
required bool isInProgress, | |
required bool isChannelNameValid, | |
required bool isChannelCreated, | |
required bool isCapturedPhotoSent, | |
required String channelName, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
part of 'chat_management_cubit.dart'; | |
@freezed | |
class ChatManagementState with _$ChatManagementState { | |
const factory ChatManagementState({ | |
required bool isInProgress, | |
required bool isChannelNameValid, | |
required bool isChannelCreated, | |
required bool isCapturedPhotoSent, | |
required String channelName, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
part 'chat_setup_state.dart'; | |
part 'chat_setup_cubit.freezed.dart'; | |
@lazySingleton | |
class ChatSetupCubit extends HydratedCubit<ChatSetupState> { | |
late StreamSubscription<ChatUserModel>? _chatUserSubscription; | |
late final IChatService _chatService; | |
ChatSetupCubit() : super(ChatSetupState.empty()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
part of 'chat_setup_cubit.dart'; | |
@freezed | |
class ChatSetupState with _$ChatSetupState { | |
const factory ChatSetupState({ | |
required ChatUserModel chatUser, | |
required ConnectionStatus webSocketConnectionStatus, | |
required bool isUserCheckedFromChatService, | |
}) = _ChatSetupState; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<void> signOut() async { | |
await _authService.signOut(); | |
await _chatService.disconnectUser(); | |
} | |
Future<void> _listenAuthStateChangesStream(AuthUserModel authUser) async { | |
emit( | |
state.copyWith( | |
isInProgress: true, | |
authUser: authUser, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Future<void> sendPhotoAsMessageToTheSelectedUser({ | |
required String channelId, | |
required int sizeOfTheTakenPhoto, | |
required String pathOfTheTakenPhoto, | |
}) async { | |
final randomMessageId = const Uuid().v1(); | |
final signedInUserOption = await _firebaseAuth.getSignedInUser(); | |
final signedInUser = signedInUserOption.fold( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Future<void> createNewChannel({ | |
required List<String> listOfMemberIDs, | |
required String channelName, | |
required String channelImageUrl, | |
}) async { | |
final randomId = const Uuid().v1(); | |
await streamChatClient.createChannel( | |
"messaging", |