Skip to content

Commit

Permalink
feat: Chat optio available only for portal version #2724
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Jun 21, 2024
1 parent 9f044fb commit 283dc87
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
17 changes: 1 addition & 16 deletions lib/chat_room/view/chat_room_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,7 @@ class _ChatRoomViewState<B extends ChatRoomCubit> extends State<ChatRoomView> {
(_) async {
liveChatCubit = context.read<B>();

final displayChatSupport = context
.read<ProfileCubit>()
.state
.model
.profileSetting
.helpCenterOptions
.displayChatSupport;

final isEnterprise =
context.read<ProfileCubit>().state.model.walletType ==
WalletType.enterprise;

if (displayChatSupport || isEnterprise) {
// for enterprise we are initialisation at start
await context.read<AltmeChatSupportCubit>().init();
}
await context.read<AltmeChatSupportCubit>().init();

/// we are on same screen, it is considered as read
context.read<AltmeChatSupportCubit>().hardCodeAllMessageAsRead();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class HelpCenterView extends StatelessWidget {
customChatSupportName = helpCenterOptions.customChatSupportName!;
}

final isEnterprise = context.read<ProfileCubit>().state.model.walletType ==
WalletType.enterprise;

return BasePage(
backgroundColor: Theme.of(context).colorScheme.surface,
useSafeArea: true,
Expand All @@ -70,7 +73,7 @@ class HelpCenterView extends StatelessWidget {
padding: EdgeInsets.zero,
),
const DrawerLogo(),
if (helpCenterOptions.displayChatSupport) ...[
if (helpCenterOptions.displayChatSupport && isEnterprise) ...[
DrawerItem(
title: '${l10n.chatWith} $customChatSupportName',
onTap: () {
Expand Down
8 changes: 6 additions & 2 deletions lib/dashboard/src/view/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ class _DashboardViewState extends State<DashboardView> {
.helpCenterOptions
.displayChatSupport;

final isEnterprise =
context.read<ProfileCubit>().state.model.walletType ==
WalletType.enterprise;

return PopScope(
canPop: false,
onPopInvoked: (_) async {
Expand Down Expand Up @@ -210,7 +214,7 @@ class _DashboardViewState extends State<DashboardView> {
const WertPage()
else
const SearchPage(),
if (displayChatSupport)
if (displayChatSupport && isEnterprise)
const AltmeSupportChatPage()
else
Container(),
Expand Down Expand Up @@ -248,7 +252,7 @@ class _DashboardViewState extends State<DashboardView> {
onTap: () => bottomTapped(2),
isSelected: state.selectedIndex == 2,
),
if (displayChatSupport) ...[
if (displayChatSupport && isEnterprise) ...[
StreamBuilder(
initialData: context
.read<AltmeChatSupportCubit>()
Expand Down

0 comments on commit 283dc87

Please sign in to comment.