diff --git a/lib/di.dart b/lib/di.dart index 2f12d0bc3..8d919c6ac 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -33,6 +33,7 @@ import 'package:cake_wallet/src/screens/send/send_template_page.dart'; import 'package:cake_wallet/src/screens/settings/change_language.dart'; import 'package:cake_wallet/src/screens/settings/settings.dart'; import 'package:cake_wallet/src/screens/setup_pin_code/setup_pin_code.dart'; +import 'package:cake_wallet/src/screens/support/support_page.dart'; import 'package:cake_wallet/src/screens/trade_details/trade_details_page.dart'; import 'package:cake_wallet/src/screens/transaction_details/transaction_details_page.dart'; import 'package:cake_wallet/src/screens/wallet_keys/wallet_keys_page.dart'; @@ -65,6 +66,7 @@ import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model. import 'package:cake_wallet/view_model/rescan_view_model.dart'; import 'package:cake_wallet/view_model/restore_from_backup_view_model.dart'; import 'package:cake_wallet/view_model/setup_pin_code_view_model.dart'; +import 'package:cake_wallet/view_model/support_view_model.dart'; import 'package:cake_wallet/view_model/transaction_details_view_model.dart'; import 'package:cake_wallet/view_model/trade_details_view_model.dart'; import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_edit_or_create_view_model.dart'; @@ -509,5 +511,9 @@ Future setup( getIt.registerFactoryParam((Trade trade, _) => TradeDetailsPage(getIt.get(param1: trade))); + getIt.registerFactory(() => SupportViewModel()); + + getIt.registerFactory(() => SupportPage(getIt.get())); + _isSetupFinished = true; } diff --git a/lib/router.dart b/lib/router.dart index 689945acb..8d58f2d83 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -6,6 +6,7 @@ import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart'; import 'package:cake_wallet/src/screens/restore/restore_from_backup_page.dart'; import 'package:cake_wallet/src/screens/restore/wallet_restore_page.dart'; import 'package:cake_wallet/src/screens/seed/pre_seed_page.dart'; +import 'package:cake_wallet/src/screens/support/support_page.dart'; import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/view_model/monero_account_list/account_list_item.dart'; import 'package:flutter/cupertino.dart'; @@ -331,6 +332,10 @@ Route createRoute(RouteSettings settings) { return CupertinoPageRoute( builder: (_) => getIt.get()); + case Routes.support: + return CupertinoPageRoute( + builder: (_) => getIt.get()); + default: return MaterialPageRoute( builder: (_) => Scaffold( diff --git a/lib/routes.dart b/lib/routes.dart index a7cb8cab9..496eaab56 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -51,4 +51,5 @@ class Routes { static const backup = '/backup'; static const editBackupPassword = '/edit_backup_passowrd'; static const restoreFromBackup = '/restore_from_backup'; + static const support = '/support'; } \ No newline at end of file diff --git a/lib/src/screens/dashboard/wallet_menu.dart b/lib/src/screens/dashboard/wallet_menu.dart index 26649b9eb..946c6ede8 100644 --- a/lib/src/screens/dashboard/wallet_menu.dart +++ b/lib/src/screens/dashboard/wallet_menu.dart @@ -47,6 +47,10 @@ class WalletMenu { title: S.current.settings_title, image: Image.asset('assets/images/settings_menu.png', height: 16, width: 16)), + WalletMenuItem( + title: S.current.settings_support, + image: Image.asset('assets/images/question_mark.png', + height: 16, width: 16)), ]); } @@ -99,6 +103,9 @@ class WalletMenu { case 7: Navigator.of(context).pushNamed(Routes.settings); break; + case 8: + Navigator.of(context).pushNamed(Routes.support); + break; default: break; } diff --git a/lib/src/screens/support/support_page.dart b/lib/src/screens/support/support_page.dart new file mode 100644 index 000000000..2c5d7ef9a --- /dev/null +++ b/lib/src/screens/support/support_page.dart @@ -0,0 +1,45 @@ +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/view_model/settings/link_list_item.dart'; +import 'package:cake_wallet/view_model/settings/regular_list_item.dart'; +import 'package:cake_wallet/view_model/support_view_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:cake_wallet/src/screens/base_page.dart'; +import 'package:cake_wallet/generated/i18n.dart'; + +class SupportPage extends BasePage { + SupportPage(this.supportViewModel); + + final SupportViewModel supportViewModel; + + @override + String get title => S.current.settings_support; + + @override + Widget body(BuildContext context) { + return SectionStandardList( + 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, + link: item.link, + linkTitle: item.linkTitle); + } + + return Container(); + }); + } + +} \ No newline at end of file diff --git a/lib/view_model/settings/settings_view_model.dart b/lib/view_model/settings/settings_view_model.dart index 0211b2276..19214006c 100644 --- a/lib/view_model/settings/settings_view_model.dart +++ b/lib/view_model/settings/settings_view_model.dart @@ -147,34 +147,10 @@ abstract class SettingsViewModelBase with Store { _settingsStore.currentTheme = theme) ], [ - LinkListItem( - title: 'Email', - linkTitle: 'support@cakewallet.com', - link: 'mailto:support@cakewallet.com'), - LinkListItem( - title: 'Telegram', - icon: 'assets/images/Telegram.png', - linkTitle: '@cakewallet_bot', - link: 'https:t.me/cakewallet_bot'), - LinkListItem( - title: 'Twitter', - icon: 'assets/images/Twitter.png', - linkTitle: '@cakewallet', - link: 'https://twitter.com/cakewallet'), - LinkListItem( - title: 'ChangeNow', - icon: 'assets/images/change_now.png', - linkTitle: 'support@changenow.io', - link: 'mailto:support@changenow.io'), RegularListItem( title: S.current.settings_terms_and_conditions, handler: (BuildContext context) => Navigator.of(context).pushNamed(Routes.readDisclaimer), - ), - RegularListItem( - title: S.current.faq, - handler: (BuildContext context) => - Navigator.pushNamed(context, Routes.faq), ) ], [VersionListItem(title: currentVersion)] diff --git a/lib/view_model/support_view_model.dart b/lib/view_model/support_view_model.dart new file mode 100644 index 000000000..4e5633b50 --- /dev/null +++ b/lib/view_model/support_view_model.dart @@ -0,0 +1,44 @@ +import 'package:cake_wallet/generated/i18n.dart'; +import 'package:cake_wallet/routes.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/view_model/settings/settings_list_item.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:mobx/mobx.dart'; + +part 'support_view_model.g.dart'; + +class SupportViewModel = SupportViewModelBase with _$SupportViewModel; + +abstract class SupportViewModelBase with Store { + SupportViewModelBase() { + items = [ + RegularListItem( + title: S.current.faq, + handler: (BuildContext context) => + Navigator.pushNamed(context, Routes.faq), + ), + LinkListItem( + title: 'Email', + linkTitle: 'support@cakewallet.com', + link: 'mailto:support@cakewallet.com'), + LinkListItem( + title: 'Telegram', + icon: 'assets/images/Telegram.png', + linkTitle: '@cakewallet_bot', + link: 'https:t.me/cakewallet_bot'), + LinkListItem( + title: 'Twitter', + icon: 'assets/images/Twitter.png', + linkTitle: '@cakewallet', + link: 'https://twitter.com/cakewallet'), + LinkListItem( + title: 'ChangeNow', + icon: 'assets/images/change_now.png', + linkTitle: 'support@changenow.io', + link: 'mailto:support@changenow.io') + ]; + } + List items; +} \ No newline at end of file