mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
Cw 397 chatwoot live support (#1011)
* initial button refactor and gradient background * CW-397 Use a separate Hive instance to avoid Issues with plugins using Hive * CW-397 Add Support Page Strings * CW-397 Add new Support Page * CW-397 Add Support Live Chat Page * CW-397 Add Hive Type Ids Doc * CW-397 Use Newer Chatwoot SDK Version and add new Images * CW-397 Update pubspec_base.yaml * CW-397 Add own Chatwoot Widget * Lowercase `s` skip-ci * CW-397 Fix WebMessageListener * CW-397 Fix Merge conflicts * CW-397 Add Erc20 Hive Type ID * CW-397 Fix Ethereum Hive Error * CW-397 Revert to Restore Button * CW-397 Only use In App chat on mobile * CW-397 Move Chatwoot Website Token to secrets * CW-397 Add Chatwoot Website Token to workflow * CW-397 Move Chatwoot fetchUrl to Support View Model --------- Co-authored-by: Rafael Saes <git@saes.io> Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
This commit is contained in:
parent
e348f12491
commit
af9b5ff10c
63 changed files with 762 additions and 260 deletions
|
@ -1,55 +1,78 @@
|
|||
import 'package:cake_wallet/src/screens/settings/widgets/settings_cell_with_arrow.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_link_provider_cell.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cake_wallet/view_model/settings/link_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/settings/regular_list_item.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/support/widgets/support_tiles.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/view_model/support_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class SupportPage extends BasePage {
|
||||
SupportPage(this.supportViewModel);
|
||||
|
||||
final SupportViewModel supportViewModel;
|
||||
|
||||
final imageLiveSupport = Image.asset('assets/images/live_support.png');
|
||||
final imageWalletGuides = Image.asset('assets/images/wallet_guides.png');
|
||||
final imageMoreLinks = Image.asset('assets/images/more_links.png');
|
||||
|
||||
@override
|
||||
String get title => S.current.settings_support;
|
||||
|
||||
@override
|
||||
AppBarStyle get appBarStyle => AppBarStyle.regular;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
final iconColor = Theme.of(context)
|
||||
.accentTextTheme!
|
||||
.displayLarge!
|
||||
.backgroundColor!;
|
||||
// FIX-ME: Added `context` it was not used here before, maby bug ?
|
||||
return Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: 500),
|
||||
child: SectionStandardList(
|
||||
context: context,
|
||||
sectionCount: 1,
|
||||
itemCounter: (int _) => supportViewModel.items.length,
|
||||
itemBuilder: (_, __, index) {
|
||||
final item = supportViewModel.items[index];
|
||||
|
||||
if (item is RegularListItem) {
|
||||
return SettingsCellWithArrow(title: item.title, handler: item.handler);
|
||||
}
|
||||
|
||||
if (item is LinkListItem) {
|
||||
return SettingsLinkProviderCell(
|
||||
title: item.title,
|
||||
icon: item.icon,
|
||||
iconColor: item.hasIconColor ? iconColor : null,
|
||||
link: item.link,
|
||||
linkTitle: item.linkTitle);
|
||||
}
|
||||
|
||||
return Container();
|
||||
}),
|
||||
return Container(
|
||||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: 330),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: SupportTile(
|
||||
image: imageLiveSupport,
|
||||
title: S.of(context).support_title_live_chat,
|
||||
description: S.of(context).support_description_live_chat,
|
||||
onPressed: () {
|
||||
if (DeviceInfo.instance.isDesktop) {
|
||||
_launchUrl(supportViewModel.fetchUrl());
|
||||
} else {
|
||||
Navigator.pushNamed(context, Routes.supportLiveChat);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: SupportTile(
|
||||
image: imageWalletGuides,
|
||||
title: S.of(context).support_title_guides,
|
||||
description: S.of(context).support_description_guides,
|
||||
onPressed: () => _launchUrl(supportViewModel.guidesUrl),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: SupportTile(
|
||||
image: imageMoreLinks,
|
||||
title: S.of(context).support_title_other_links,
|
||||
description: S.of(context).support_description_other_links,
|
||||
onPressed: () => Navigator.pushNamed(context, Routes.supportOtherLinks),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _launchUrl(String url) async {
|
||||
try {
|
||||
await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue