veilidchat/lib/chat/cubits/active_chat_cubit.dart

20 lines
657 B
Dart
Raw Normal View History

2024-01-30 17:03:14 -05:00
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:veilid_support/veilid_support.dart';
import '../../router/router.dart';
2024-06-06 00:19:07 -04:00
// XXX: if we ever want to have more than one chat 'open', we should put the
// operations and state for that here.
class ActiveChatCubit extends Cubit<TypedKey?> {
ActiveChatCubit(super.initialState, {required RouterCubit routerCubit})
: _routerCubit = routerCubit;
2024-01-30 17:03:14 -05:00
2024-05-27 18:04:00 -04:00
void setActiveChat(TypedKey? activeChatLocalConversationRecordKey) {
emit(activeChatLocalConversationRecordKey);
_routerCubit.setHasActiveChat(activeChatLocalConversationRecordKey != null);
2024-01-30 17:03:14 -05:00
}
final RouterCubit _routerCubit;
2024-01-30 17:03:14 -05:00
}