2024-01-30 17:03:14 -05:00
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
import 'package:veilid_support/veilid_support.dart';
|
|
|
|
|
2024-06-13 14:52:34 -04:00
|
|
|
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.
|
|
|
|
|
2024-05-01 20:58:25 -04:00
|
|
|
class ActiveChatCubit extends Cubit<TypedKey?> {
|
2024-06-13 14:52:34 -04:00
|
|
|
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);
|
2024-06-13 14:52:34 -04:00
|
|
|
_routerCubit.setHasActiveChat(activeChatLocalConversationRecordKey != null);
|
2024-01-30 17:03:14 -05:00
|
|
|
}
|
2024-06-13 14:52:34 -04:00
|
|
|
|
|
|
|
final RouterCubit _routerCubit;
|
2024-01-30 17:03:14 -05:00
|
|
|
}
|