mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-03 17:40:43 +00:00
CAKE-284 | moved support from settings to main menu; added support_page.dart and support_view_model.dart to the app
This commit is contained in:
parent
35aabcd248
commit
b2b17e66c5
7 changed files with 108 additions and 24 deletions
|
@ -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/change_language.dart';
|
||||||
import 'package:cake_wallet/src/screens/settings/settings.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/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/trade_details/trade_details_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/transaction_details/transaction_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';
|
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/rescan_view_model.dart';
|
||||||
import 'package:cake_wallet/view_model/restore_from_backup_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/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/transaction_details_view_model.dart';
|
||||||
import 'package:cake_wallet/view_model/trade_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';
|
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<TradeDetailsPage, Trade, void>((Trade trade, _) =>
|
getIt.registerFactoryParam<TradeDetailsPage, Trade, void>((Trade trade, _) =>
|
||||||
TradeDetailsPage(getIt.get<TradeDetailsViewModel>(param1: trade)));
|
TradeDetailsPage(getIt.get<TradeDetailsViewModel>(param1: trade)));
|
||||||
|
|
||||||
|
getIt.registerFactory(() => SupportViewModel());
|
||||||
|
|
||||||
|
getIt.registerFactory(() => SupportPage(getIt.get<SupportViewModel>()));
|
||||||
|
|
||||||
_isSetupFinished = true;
|
_isSetupFinished = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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/restore_from_backup_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/restore/wallet_restore_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/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/store/settings_store.dart';
|
||||||
import 'package:cake_wallet/view_model/monero_account_list/account_list_item.dart';
|
import 'package:cake_wallet/view_model/monero_account_list/account_list_item.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
@ -331,6 +332,10 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
||||||
return CupertinoPageRoute<void>(
|
return CupertinoPageRoute<void>(
|
||||||
builder: (_) => getIt.get<RestoreFromBackupPage>());
|
builder: (_) => getIt.get<RestoreFromBackupPage>());
|
||||||
|
|
||||||
|
case Routes.support:
|
||||||
|
return CupertinoPageRoute<void>(
|
||||||
|
builder: (_) => getIt.get<SupportPage>());
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return MaterialPageRoute<void>(
|
return MaterialPageRoute<void>(
|
||||||
builder: (_) => Scaffold(
|
builder: (_) => Scaffold(
|
||||||
|
|
|
@ -51,4 +51,5 @@ class Routes {
|
||||||
static const backup = '/backup';
|
static const backup = '/backup';
|
||||||
static const editBackupPassword = '/edit_backup_passowrd';
|
static const editBackupPassword = '/edit_backup_passowrd';
|
||||||
static const restoreFromBackup = '/restore_from_backup';
|
static const restoreFromBackup = '/restore_from_backup';
|
||||||
|
static const support = '/support';
|
||||||
}
|
}
|
|
@ -47,6 +47,10 @@ class WalletMenu {
|
||||||
title: S.current.settings_title,
|
title: S.current.settings_title,
|
||||||
image: Image.asset('assets/images/settings_menu.png',
|
image: Image.asset('assets/images/settings_menu.png',
|
||||||
height: 16, width: 16)),
|
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:
|
case 7:
|
||||||
Navigator.of(context).pushNamed(Routes.settings);
|
Navigator.of(context).pushNamed(Routes.settings);
|
||||||
break;
|
break;
|
||||||
|
case 8:
|
||||||
|
Navigator.of(context).pushNamed(Routes.support);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
45
lib/src/screens/support/support_page.dart
Normal file
45
lib/src/screens/support/support_page.dart
Normal file
|
@ -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();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -147,34 +147,10 @@ abstract class SettingsViewModelBase with Store {
|
||||||
_settingsStore.currentTheme = theme)
|
_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(
|
RegularListItem(
|
||||||
title: S.current.settings_terms_and_conditions,
|
title: S.current.settings_terms_and_conditions,
|
||||||
handler: (BuildContext context) =>
|
handler: (BuildContext context) =>
|
||||||
Navigator.of(context).pushNamed(Routes.readDisclaimer),
|
Navigator.of(context).pushNamed(Routes.readDisclaimer),
|
||||||
),
|
|
||||||
RegularListItem(
|
|
||||||
title: S.current.faq,
|
|
||||||
handler: (BuildContext context) =>
|
|
||||||
Navigator.pushNamed(context, Routes.faq),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
[VersionListItem(title: currentVersion)]
|
[VersionListItem(title: currentVersion)]
|
||||||
|
|
44
lib/view_model/support_view_model.dart
Normal file
44
lib/view_model/support_view_model.dart
Normal file
|
@ -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<SettingsListItem> items;
|
||||||
|
}
|
Loading…
Reference in a new issue