mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
Reorganize settings
This commit is contained in:
parent
1efced7607
commit
549975ecc1
28 changed files with 619 additions and 373 deletions
18
lib/di.dart
18
lib/di.dart
|
@ -5,9 +5,14 @@ import 'package:cake_wallet/ionia/ionia_anypay.dart';
|
|||
import 'package:cake_wallet/ionia/ionia_gift_card.dart';
|
||||
import 'package:cake_wallet/ionia/ionia_tip.dart';
|
||||
import 'package:cake_wallet/src/screens/buy/onramper_page.dart';
|
||||
import 'package:cake_wallet/src/screens/setting/display_settings_page.dart';
|
||||
import 'package:cake_wallet/src/screens/setting/other_settings_page.dart';
|
||||
import 'package:cake_wallet/src/screens/setting/privacy_page.dart';
|
||||
import 'package:cake_wallet/src/screens/setting/security_backup_page.dart';
|
||||
import 'package:cake_wallet/src/screens/ionia/cards/ionia_custom_redeem_page.dart';
|
||||
import 'package:cake_wallet/src/screens/ionia/cards/ionia_gift_card_detail_page.dart';
|
||||
import 'package:cake_wallet/src/screens/ionia/cards/ionia_more_options_page.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/connection_sync_page.dart';
|
||||
import 'package:cake_wallet/view_model/ionia/ionia_auth_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/ionia/ionia_buy_card_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/ionia/ionia_custom_tip_view_model.dart';
|
||||
|
@ -59,7 +64,6 @@ 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/wallet_seed_page.dart';
|
||||
import 'package:cake_wallet/src/screens/send/send_template_page.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';
|
||||
|
@ -439,8 +443,6 @@ Future setup(
|
|||
return SettingsViewModel(appStore.settingsStore, yatStore, appStore.wallet!);
|
||||
});
|
||||
|
||||
getIt.registerFactory(() => SettingsPage(getIt.get<SettingsViewModel>()));
|
||||
|
||||
getIt
|
||||
.registerFactory(() => WalletSeedViewModel(getIt.get<AppStore>().wallet!));
|
||||
|
||||
|
@ -477,6 +479,16 @@ Future setup(
|
|||
|
||||
getIt.registerFactory(() => NodeListPage(getIt.get<NodeListViewModel>()));
|
||||
|
||||
getIt.registerFactory(() => ConnectionSyncPage(getIt.get<NodeListViewModel>(), getIt.get<DashboardViewModel>()));
|
||||
|
||||
getIt.registerFactory(() => SecurityBackupPage(getIt.get<SettingsViewModel>()));
|
||||
|
||||
getIt.registerFactory(() => PrivacyPage(getIt.get<SettingsViewModel>()));
|
||||
|
||||
getIt.registerFactory(() => DisplaySettingsPage(getIt.get<SettingsViewModel>()));
|
||||
|
||||
getIt.registerFactory(() => OtherSettingsPage(getIt.get<SettingsViewModel>()));
|
||||
|
||||
getIt.registerFactory(() =>
|
||||
NodeCreateOrEditViewModel(_nodeSource, getIt.get<AppStore>().wallet!));
|
||||
|
||||
|
|
|
@ -5,6 +5,10 @@ import 'package:cake_wallet/src/screens/backup/edit_backup_password_page.dart';
|
|||
import 'package:cake_wallet/src/screens/buy/buy_webview_page.dart';
|
||||
import 'package:cake_wallet/src/screens/buy/onramper_page.dart';
|
||||
import 'package:cake_wallet/src/screens/buy/pre_order_page.dart';
|
||||
import 'package:cake_wallet/src/screens/setting/display_settings_page.dart';
|
||||
import 'package:cake_wallet/src/screens/setting/other_settings_page.dart';
|
||||
import 'package:cake_wallet/src/screens/setting/privacy_page.dart';
|
||||
import 'package:cake_wallet/src/screens/setting/security_backup_page.dart';
|
||||
import 'package:cake_wallet/src/screens/ionia/cards/ionia_account_cards_page.dart';
|
||||
import 'package:cake_wallet/src/screens/ionia/cards/ionia_account_page.dart';
|
||||
import 'package:cake_wallet/src/screens/ionia/cards/ionia_custom_redeem_page.dart';
|
||||
|
@ -16,6 +20,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/settings/connection_sync_page.dart';
|
||||
import 'package:cake_wallet/src/screens/support/support_page.dart';
|
||||
import 'package:cake_wallet/src/screens/unspent_coins/unspent_coins_details_page.dart';
|
||||
import 'package:cake_wallet/src/screens/unspent_coins/unspent_coins_list_page.dart';
|
||||
|
@ -56,7 +61,6 @@ import 'package:cake_wallet/src/screens/contact/contact_page.dart';
|
|||
import 'package:cake_wallet/src/screens/wallet_keys/wallet_keys_page.dart';
|
||||
import 'package:cake_wallet/src/screens/restore/restore_wallet_from_seed_details.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange/exchange_page.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/settings.dart';
|
||||
import 'package:cake_wallet/src/screens/rescan/rescan_page.dart';
|
||||
import 'package:cake_wallet/src/screens/faq/faq_page.dart';
|
||||
import 'package:cake_wallet/src/screens/trade_details/trade_details_page.dart';
|
||||
|
@ -278,6 +282,26 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<NodeListPage>());
|
||||
|
||||
case Routes.connectionSync:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<ConnectionSyncPage>());
|
||||
|
||||
case Routes.securityBackupPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<SecurityBackupPage>());
|
||||
|
||||
case Routes.privacyPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<PrivacyPage>());
|
||||
|
||||
case Routes.displaySettingsPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<DisplaySettingsPage>());
|
||||
|
||||
case Routes.otherSettingsPage:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<OtherSettingsPage>());
|
||||
|
||||
case Routes.newNode:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<NodeCreateOrEditPage>());
|
||||
|
@ -360,9 +384,6 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<ExchangeTemplatePage>());
|
||||
|
||||
case Routes.settings:
|
||||
return MaterialPageRoute<void>(builder: (_) => getIt.get<SettingsPage>());
|
||||
|
||||
case Routes.rescan:
|
||||
return MaterialPageRoute<void>(builder: (_) => getIt.get<RescanPage>());
|
||||
|
||||
|
|
|
@ -77,4 +77,9 @@ class Routes {
|
|||
static const ioniaMoreOptionsPage = '/ionia_more_options_page';
|
||||
static const ioniaCustomRedeemPage = '/ionia_custom_redeem_page';
|
||||
static const onramperPage = '/onramper';
|
||||
static const connectionSync = '/connection_sync_page';
|
||||
static const securityBackupPage = '/security_and_backup_page';
|
||||
static const privacyPage = '/privacy_page';
|
||||
static const displaySettingsPage = '/display_settings_page';
|
||||
static const otherSettingsPage = '/other_settings_page';
|
||||
}
|
||||
|
|
|
@ -1,81 +1,64 @@
|
|||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/wallet_menu_item.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/wallet_type_utils.dart';
|
||||
|
||||
// FIXME: terrible design
|
||||
|
||||
class WalletMenu {
|
||||
WalletMenu(this.context, this.reconnect, this.hasRescan) : items = [] {
|
||||
items.addAll([
|
||||
WalletMenuItem(
|
||||
title: S.current.reconnect,
|
||||
image: Image.asset('assets/images/reconnect_menu.png',
|
||||
height: 16, width: 16),
|
||||
handler: () => _presentReconnectAlert(context)),
|
||||
if (hasRescan)
|
||||
WalletMenuItem(
|
||||
title: S.current.rescan,
|
||||
image: Image.asset('assets/images/filter_icon.png',
|
||||
height: 16, width: 16, color: Palette.darkBlue),
|
||||
handler: () => Navigator.of(context).pushNamed(Routes.rescan)),
|
||||
WalletMenuItem(
|
||||
title: S.current.wallets,
|
||||
image: Image.asset('assets/images/wallet_menu.png',
|
||||
height: 16, width: 16),
|
||||
handler: () => Navigator.of(context).pushNamed(Routes.walletList)),
|
||||
WalletMenuItem(
|
||||
title: S.current.nodes,
|
||||
image: Image.asset('assets/images/nodes_menu.png',
|
||||
height: 16, width: 16),
|
||||
handler: () => Navigator.of(context).pushNamed(Routes.nodeList)),
|
||||
WalletMenuItem(
|
||||
title: S.current.show_keys,
|
||||
image:
|
||||
Image.asset('assets/images/key_menu.png', height: 16, width: 16),
|
||||
handler: () {
|
||||
Navigator.of(context).pushNamed(Routes.auth,
|
||||
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) {
|
||||
if (isAuthenticatedSuccessfully) {
|
||||
auth.close(route: Routes.showKeys);
|
||||
}
|
||||
});
|
||||
}),
|
||||
WalletMenuItem(
|
||||
title: S.current.address_book_menu,
|
||||
image: Image.asset('assets/images/open_book_menu.png',
|
||||
height: 16, width: 16),
|
||||
handler: () => Navigator.of(context).pushNamed(Routes.addressBook)),
|
||||
WalletMenuItem(
|
||||
title: S.current.backup,
|
||||
image: Image.asset('assets/images/restore_wallet.png',
|
||||
height: 16,
|
||||
width: 16,
|
||||
color: Palette.darkBlue),
|
||||
handler: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.auth,
|
||||
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) {
|
||||
if (isAuthenticatedSuccessfully) {
|
||||
auth.close(route:Routes.backup);
|
||||
}
|
||||
});
|
||||
}),
|
||||
WalletMenuItem(
|
||||
title: S.current.settings_title,
|
||||
image: Image.asset('assets/images/settings_menu.png',
|
||||
height: 16, width: 16),
|
||||
handler: () => Navigator.of(context).pushNamed(Routes.settings)),
|
||||
WalletMenuItem(
|
||||
title: S.current.settings_support,
|
||||
image: Image.asset('assets/images/question_mark.png',
|
||||
height: 16, width: 16, color: Palette.darkBlue),
|
||||
handler: () => Navigator.of(context).pushNamed(Routes.support)),
|
||||
WalletMenuItem(
|
||||
title: S.current.connection_sync,
|
||||
image: Image.asset('assets/images/nodes_menu.png',
|
||||
height: 16, width: 16),
|
||||
handler: () => Navigator.of(context).pushNamed(Routes.connectionSync),
|
||||
),
|
||||
WalletMenuItem(
|
||||
title: S.current.wallets,
|
||||
image: Image.asset('assets/images/wallet_menu.png',
|
||||
height: 16, width: 16),
|
||||
handler: () => Navigator.of(context).pushNamed(Routes.walletList),
|
||||
),
|
||||
WalletMenuItem(
|
||||
title: S.current.security_and_backup,
|
||||
image:
|
||||
Image.asset('assets/images/key_menu.png', height: 16, width: 16),
|
||||
handler: () {
|
||||
Navigator.of(context).pushNamed(Routes.securityBackupPage);
|
||||
}),
|
||||
WalletMenuItem(
|
||||
title: S.current.privacy,
|
||||
image:
|
||||
Image.asset('assets/images/eye_menu.png', height: 16, width: 16),
|
||||
handler: () {
|
||||
Navigator.of(context).pushNamed(Routes.privacyPage);
|
||||
}),
|
||||
WalletMenuItem(
|
||||
title: S.current.address_book_menu,
|
||||
image: Image.asset('assets/images/open_book_menu.png',
|
||||
height: 16, width: 16),
|
||||
handler: () => Navigator.of(context).pushNamed(Routes.addressBook),
|
||||
),
|
||||
WalletMenuItem(
|
||||
title: S.current.display_settings,
|
||||
image: Image.asset('assets/images/eye_menu.png',
|
||||
height: 16, width: 16),
|
||||
handler: () => Navigator.of(context).pushNamed(Routes.displaySettingsPage),
|
||||
),
|
||||
WalletMenuItem(
|
||||
title: S.current.other_settings,
|
||||
image: Image.asset('assets/images/settings_menu.png',
|
||||
height: 16, width: 16),
|
||||
handler: () => Navigator.of(context).pushNamed(Routes.otherSettingsPage),
|
||||
),
|
||||
WalletMenuItem(
|
||||
title: S.current.settings_support,
|
||||
image: Image.asset('assets/images/question_mark.png',
|
||||
height: 16, width: 16, color: Palette.darkBlue),
|
||||
handler: () => Navigator.of(context).pushNamed(Routes.support),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -86,23 +69,6 @@ class WalletMenu {
|
|||
|
||||
void action(int index) {
|
||||
final item = items[index];
|
||||
item?.handler();
|
||||
}
|
||||
|
||||
Future<void> _presentReconnectAlert(BuildContext context) async {
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: S.of(context).reconnection,
|
||||
alertContent: S.of(context).reconnect_alert_text,
|
||||
rightButtonText: S.of(context).ok,
|
||||
leftButtonText: S.of(context).cancel,
|
||||
actionRightButton: () async {
|
||||
Navigator.of(context).pop();
|
||||
await reconnect?.call();
|
||||
},
|
||||
actionLeftButton: () => Navigator.of(context).pop());
|
||||
});
|
||||
item.handler();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,10 @@ class NodeHeaderListRow extends StandardListRow {
|
|||
|
||||
@override
|
||||
Widget buildTrailing(BuildContext context) {
|
||||
return Icon(Icons.add,
|
||||
color: Theme.of(context).accentTextTheme!.subtitle1!.color!, size: 24.0);
|
||||
return SizedBox(
|
||||
width: 20,
|
||||
child: Icon(Icons.add,
|
||||
color: Theme.of(context).accentTextTheme!.subtitle1!.color!, size: 24.0),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
155
lib/src/screens/settings/connection_sync_page.dart
Normal file
155
lib/src/screens/settings/connection_sync_page.dart
Normal file
|
@ -0,0 +1,155 @@
|
|||
import 'package:cake_wallet/src/screens/settings/widgets/settings_cell_with_arrow.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:cw_core/node.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/screens/nodes/widgets/node_list_row.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/view_model/node_list/node_list_view_model.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
|
||||
class ConnectionSyncPage extends BasePage {
|
||||
ConnectionSyncPage(this.nodeListViewModel, this.dashboardViewModel);
|
||||
|
||||
@override
|
||||
String get title => S.current.connection_sync;
|
||||
|
||||
final NodeListViewModel nodeListViewModel;
|
||||
final DashboardViewModel dashboardViewModel;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SettingsCellWithArrow(
|
||||
title: S.current.reconnect,
|
||||
handler: (context) => _presentReconnectAlert(context),
|
||||
),
|
||||
StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
|
||||
SettingsCellWithArrow(
|
||||
title: S.current.rescan,
|
||||
handler: (context) => Navigator.of(context).pushNamed(Routes.rescan),
|
||||
),
|
||||
StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
|
||||
NodeHeaderListRow(
|
||||
title: S.of(context).add_new_node,
|
||||
onTap: (_) async => await Navigator.of(context).pushNamed(Routes.newNode),
|
||||
),
|
||||
StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
|
||||
SizedBox(height: 100),
|
||||
Observer(
|
||||
builder: (BuildContext context) {
|
||||
return Flexible(
|
||||
child: SectionStandardList(
|
||||
sectionCount: 1,
|
||||
context: context,
|
||||
dividerPadding: EdgeInsets.symmetric(horizontal: 24),
|
||||
itemCounter: (int sectionIndex) {
|
||||
return nodeListViewModel.nodes.length;
|
||||
},
|
||||
itemBuilder: (_, sectionIndex, index) {
|
||||
final node = nodeListViewModel.nodes[index];
|
||||
final isSelected = node.keyIndex == nodeListViewModel.currentNode.keyIndex;
|
||||
final nodeListRow = NodeListRow(
|
||||
title: node.uriRaw,
|
||||
isSelected: isSelected,
|
||||
isAlive: node.requestNode(),
|
||||
onTap: (_) async {
|
||||
if (isSelected) {
|
||||
return;
|
||||
}
|
||||
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: S.of(context).change_current_node_title,
|
||||
alertContent: S.of(context).change_current_node(node.uriRaw),
|
||||
leftButtonText: S.of(context).cancel,
|
||||
rightButtonText: S.of(context).change,
|
||||
actionLeftButton: () => Navigator.of(context).pop(),
|
||||
actionRightButton: () async {
|
||||
await nodeListViewModel.setAsCurrent(node);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
final dismissibleRow = Slidable(
|
||||
key: Key('${node.keyIndex}'),
|
||||
startActionPane: _actionPane(context, node),
|
||||
endActionPane: _actionPane(context, node),
|
||||
child: nodeListRow,
|
||||
);
|
||||
|
||||
return isSelected ? nodeListRow : dismissibleRow;
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _presentReconnectAlert(BuildContext context) async {
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: S.of(context).reconnection,
|
||||
alertContent: S.of(context).reconnect_alert_text,
|
||||
rightButtonText: S.of(context).ok,
|
||||
leftButtonText: S.of(context).cancel,
|
||||
actionRightButton: () async {
|
||||
Navigator.of(context).pop();
|
||||
await dashboardViewModel.reconnect();
|
||||
},
|
||||
actionLeftButton: () => Navigator.of(context).pop());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
ActionPane _actionPane(BuildContext context, Node node) => ActionPane(
|
||||
motion: const ScrollMotion(),
|
||||
extentRatio: 0.3,
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (context) async {
|
||||
final confirmed = await showPopUp<bool>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: S.of(context).remove_node,
|
||||
alertContent: S.of(context).remove_node_message,
|
||||
rightButtonText: S.of(context).remove,
|
||||
leftButtonText: S.of(context).cancel,
|
||||
actionRightButton: () => Navigator.pop(context, true),
|
||||
actionLeftButton: () => Navigator.pop(context, false));
|
||||
}) ??
|
||||
false;
|
||||
|
||||
if (confirmed) {
|
||||
await nodeListViewModel.delete(node);
|
||||
}
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
icon: CupertinoIcons.delete,
|
||||
label: S.of(context).delete,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
80
lib/src/screens/settings/display_settings_page.dart
Normal file
80
lib/src/screens/settings/display_settings_page.dart
Normal file
|
@ -0,0 +1,80 @@
|
|||
import 'package:cake_wallet/entities/fiat_currency.dart';
|
||||
import 'package:cake_wallet/entities/language_service.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_choices_cell.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_picker_cell.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/themes/theme_list.dart';
|
||||
import 'package:cake_wallet/view_model/settings/choices_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
|
||||
import 'package:cake_wallet/wallet_type_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
|
||||
class DisplaySettingsPage extends BasePage {
|
||||
DisplaySettingsPage(this.settingsViewModel);
|
||||
|
||||
@override
|
||||
String get title => S.current.display_settings;
|
||||
|
||||
final SettingsViewModel settingsViewModel;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
return Observer(builder: (_) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
SettingsSwitcherCell(
|
||||
title: S.current.settings_save_recipient_address,
|
||||
value: settingsViewModel.shouldSaveRecipientAddress,
|
||||
onValueChange: (BuildContext _, bool value) {
|
||||
settingsViewModel.setShouldSaveRecipientAddress(value);
|
||||
}),
|
||||
if (!isHaven)
|
||||
SettingsPickerCell<FiatCurrency>(
|
||||
title: S.current.settings_currency,
|
||||
searchHintText: S.current.search_currency,
|
||||
items: FiatCurrency.all,
|
||||
selectedItem: settingsViewModel.fiatCurrency,
|
||||
onItemSelected: (FiatCurrency currency) => settingsViewModel.setFiatCurrency(currency),
|
||||
images: FiatCurrency.all.map((e) => Image.asset("assets/images/flags/${e.countryCode}.png")).toList(),
|
||||
isGridView: true,
|
||||
matchingCriteria: (FiatCurrency currency, String searchText) {
|
||||
return currency.title.toLowerCase().contains(searchText) ||
|
||||
currency.fullName.toLowerCase().contains(searchText);
|
||||
},
|
||||
),
|
||||
SettingsPickerCell<String>(
|
||||
title: S.current.settings_change_language,
|
||||
searchHintText: S.current.search_language,
|
||||
items: LanguageService.list.keys.toList(),
|
||||
displayItem: (dynamic code) {
|
||||
return LanguageService.list[code] ?? '';
|
||||
},
|
||||
selectedItem: settingsViewModel.languageCode,
|
||||
onItemSelected: settingsViewModel.onLanguageSelected,
|
||||
images: LanguageService.list.keys
|
||||
.map((e) => Image.asset("assets/images/flags/${LanguageService.localeCountryCode[e]}.png"))
|
||||
.toList(),
|
||||
matchingCriteria: (String code, String searchText) {
|
||||
return LanguageService.list[code]?.toLowerCase().contains(searchText) ?? false;
|
||||
},
|
||||
),
|
||||
SettingsChoicesCell(
|
||||
ChoicesListItem<ThemeBase>(
|
||||
title: S.current.color_theme,
|
||||
items: ThemeList.all,
|
||||
selectedItem: settingsViewModel.theme,
|
||||
onItemSelected: (ThemeBase theme) => settingsViewModel.setTheme(theme),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
45
lib/src/screens/settings/other_settings_page.dart
Normal file
45
lib/src/screens/settings/other_settings_page.dart
Normal file
|
@ -0,0 +1,45 @@
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_cell_with_arrow.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_picker_cell.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_version_cell.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
|
||||
import 'package:cw_core/transaction_priority.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
|
||||
class OtherSettingsPage extends BasePage {
|
||||
OtherSettingsPage(this._settingsViewModel);
|
||||
|
||||
@override
|
||||
String get title => S.current.other_settings;
|
||||
|
||||
final SettingsViewModel _settingsViewModel;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
return Observer(builder: (_) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Column(children: [
|
||||
SettingsPickerCell<TransactionPriority>(
|
||||
title: S.current.settings_fee_priority,
|
||||
items: priorityForWalletType(_settingsViewModel.walletType),
|
||||
displayItem: _settingsViewModel.getDisplayPriority,
|
||||
selectedItem: _settingsViewModel.transactionPriority,
|
||||
onItemSelected: _settingsViewModel.onDisplayPrioritySelected,
|
||||
),
|
||||
SettingsCellWithArrow(
|
||||
title: S.current.settings_terms_and_conditions,
|
||||
handler: (BuildContext context) => Navigator.of(context).pushNamed(Routes.readDisclaimer),
|
||||
),
|
||||
StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
|
||||
Spacer(),
|
||||
SettingsVersionCell(title: S.of(context).version(_settingsViewModel.currentVersion))
|
||||
]),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
30
lib/src/screens/settings/privacy_page.dart
Normal file
30
lib/src/screens/settings/privacy_page.dart
Normal file
|
@ -0,0 +1,30 @@
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart';
|
||||
import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
|
||||
class PrivacyPage extends BasePage {
|
||||
PrivacyPage(this.settingsViewModel);
|
||||
|
||||
@override
|
||||
String get title => S.current.privacy_settings;
|
||||
|
||||
final SettingsViewModel settingsViewModel;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Observer(builder: (_) {
|
||||
return SettingsSwitcherCell(
|
||||
title: S.current.settings_save_recipient_address,
|
||||
value: settingsViewModel.shouldSaveRecipientAddress,
|
||||
onValueChange: (BuildContext _, bool value) {
|
||||
settingsViewModel.setShouldSaveRecipientAddress(value);
|
||||
});
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
84
lib/src/screens/settings/security_backup_page.dart
Normal file
84
lib/src/screens/settings/security_backup_page.dart
Normal file
|
@ -0,0 +1,84 @@
|
|||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_cell_with_arrow.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
|
||||
class SecurityBackupPage extends BasePage {
|
||||
SecurityBackupPage(this.settingsViewModel);
|
||||
|
||||
@override
|
||||
String get title => S.current.security_and_backup;
|
||||
|
||||
final SettingsViewModel settingsViewModel;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
SettingsCellWithArrow(
|
||||
title: S.current.show_keys,
|
||||
handler: (_) => Navigator.of(context).pushNamed(Routes.auth,
|
||||
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) {
|
||||
if (isAuthenticatedSuccessfully) {
|
||||
auth.close(route: Routes.showKeys);
|
||||
}
|
||||
}),
|
||||
),
|
||||
StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
|
||||
SettingsCellWithArrow(
|
||||
title: S.current.create_backup,
|
||||
handler: (_) => Navigator.of(context).pushNamed(Routes.auth,
|
||||
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) {
|
||||
if (isAuthenticatedSuccessfully) {
|
||||
auth.close(route: Routes.backup);
|
||||
}
|
||||
}),
|
||||
),
|
||||
StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
|
||||
SettingsCellWithArrow(
|
||||
title: S.current.settings_change_pin,
|
||||
handler: (_) => Navigator.of(context).pushNamed(Routes.auth,
|
||||
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) {
|
||||
auth.close(
|
||||
route: isAuthenticatedSuccessfully ? Routes.setupPin : null,
|
||||
arguments: (PinCodeState<PinCodeWidget> setupPinContext, String _) {
|
||||
setupPinContext.close();
|
||||
},
|
||||
);
|
||||
})),
|
||||
StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
|
||||
Observer(builder: (_) {
|
||||
return SettingsSwitcherCell(
|
||||
title: S.current.settings_allow_biometrical_authentication,
|
||||
value: settingsViewModel.allowBiometricalAuthentication,
|
||||
onValueChange: (BuildContext context, bool value) {
|
||||
if (value) {
|
||||
Navigator.of(context).pushNamed(Routes.auth,
|
||||
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) async {
|
||||
if (isAuthenticatedSuccessfully) {
|
||||
if (await settingsViewModel.biometricAuthenticated()) {
|
||||
settingsViewModel.setAllowBiometricalAuthentication(isAuthenticatedSuccessfully);
|
||||
}
|
||||
} else {
|
||||
settingsViewModel.setAllowBiometricalAuthentication(isAuthenticatedSuccessfully);
|
||||
}
|
||||
|
||||
auth.close();
|
||||
});
|
||||
} else {
|
||||
settingsViewModel.setAllowBiometricalAuthentication(value);
|
||||
}
|
||||
});
|
||||
}),
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
import 'package:cake_wallet/src/screens/settings/widgets/settings_choices_cell.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_version_cell.dart';
|
||||
import 'package:cake_wallet/view_model/settings/choices_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/settings/version_list_item.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/settings/link_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/settings/picker_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/settings/regular_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/settings/switcher_list_item.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_link_provider_cell.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_cell_with_arrow.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_picker_cell.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
|
||||
class SettingsPage extends BasePage {
|
||||
SettingsPage(this.settingsViewModel);
|
||||
|
||||
final SettingsViewModel settingsViewModel;
|
||||
|
||||
@override
|
||||
String get title => S.current.settings_title;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
// FIX-ME: Added `context` it was not used here before, maby bug ?
|
||||
return SectionStandardList(
|
||||
context: context,
|
||||
sectionCount: settingsViewModel.sections.length,
|
||||
itemCounter: (int sectionIndex) {
|
||||
if (sectionIndex < settingsViewModel.sections.length) {
|
||||
return settingsViewModel.sections[sectionIndex].length;
|
||||
}
|
||||
|
||||
return 0;
|
||||
},
|
||||
itemBuilder: (_, sectionIndex, itemIndex) {
|
||||
final item = settingsViewModel.sections[sectionIndex][itemIndex];
|
||||
|
||||
if (item is PickerListItem) {
|
||||
return Observer(builder: (_) {
|
||||
return SettingsPickerCell<Object>(
|
||||
displayItem: item.displayItem,
|
||||
title: item.title,
|
||||
selectedItem: item.selectedItem(),
|
||||
items: item.items,
|
||||
onItemSelected: (dynamic value) => item.onItemSelected(value),
|
||||
images: item.images,
|
||||
searchHintText: item.searchHintText,
|
||||
isGridView: item.isGridView,
|
||||
matchingCriteria: (dynamic value, String searchText) => item.matchingCriteria(value, searchText),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
if (item is SwitcherListItem) {
|
||||
return Observer(builder: (_) {
|
||||
return SettingsSwitcherCell(
|
||||
title: item.title,
|
||||
value: item.value(),
|
||||
onValueChange: item.onValueChange);
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (item is VersionListItem) {
|
||||
return Observer(builder: (_) {
|
||||
return SettingsVersionCell(
|
||||
title:
|
||||
S.of(context).version(settingsViewModel.currentVersion));
|
||||
});
|
||||
}
|
||||
|
||||
if (item is ChoicesListItem) {
|
||||
return SettingsChoicesCell(item);
|
||||
}
|
||||
|
||||
return Container();
|
||||
});
|
||||
}
|
||||
}
|
|
@ -123,6 +123,7 @@ class SectionStandardList extends StatelessWidget {
|
|||
required this.itemBuilder,
|
||||
required this.sectionCount,
|
||||
required BuildContext context,
|
||||
this.dividerPadding = const EdgeInsets.only(left: 24),
|
||||
this.themeColor,
|
||||
this.dividerThemeColor,
|
||||
this.sectionTitleBuilder,
|
||||
|
@ -149,6 +150,7 @@ class SectionStandardList extends StatelessWidget {
|
|||
final List<Widget> totalRows;
|
||||
final Color? themeColor;
|
||||
final Color? dividerThemeColor;
|
||||
final EdgeInsets dividerPadding;
|
||||
|
||||
List<Widget> transform(
|
||||
bool hasTopSeparator,
|
||||
|
@ -178,7 +180,7 @@ class SectionStandardList extends StatelessWidget {
|
|||
|
||||
items.add(sectionIndex + 1 != sectionCount
|
||||
? SectionHeaderListRow()
|
||||
: StandardListSeparator(padding: EdgeInsets.only(left: 24)));
|
||||
: StandardListSeparator(padding: dividerPadding));
|
||||
}
|
||||
|
||||
return items;
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
import 'package:cake_wallet/entities/language_service.dart';
|
||||
import 'package:cake_wallet/store/yat/yat_store.dart';
|
||||
import 'package:cake_wallet/view_model/settings/choices_list_item.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/entities/biometric_auth.dart';
|
||||
|
@ -16,21 +11,12 @@ import 'package:cw_core/node.dart';
|
|||
import 'package:cake_wallet/monero/monero.dart';
|
||||
import 'package:cake_wallet/haven/haven.dart';
|
||||
import 'package:cake_wallet/entities/action_list_display_mode.dart';
|
||||
import 'package:cake_wallet/view_model/settings/version_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/settings/picker_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:cake_wallet/view_model/settings/switcher_list_item.dart';
|
||||
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
||||
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
||||
import 'package:cw_core/transaction_history.dart';
|
||||
import 'package:cw_core/balance.dart';
|
||||
import 'package:cw_core/transaction_info.dart';
|
||||
import 'package:cw_core/transaction_priority.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/themes/theme_list.dart';
|
||||
import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart';
|
||||
import 'package:cake_wallet/wallet_type_utils.dart';
|
||||
|
||||
part 'settings_view_model.g.dart';
|
||||
|
||||
|
@ -59,9 +45,9 @@ abstract class SettingsViewModelBase with Store {
|
|||
TransactionInfo>
|
||||
wallet)
|
||||
: itemHeaders = {},
|
||||
_walletType = wallet.type,
|
||||
walletType = wallet.type,
|
||||
_wallet = wallet,
|
||||
_biometricAuth = BiometricAuth(),
|
||||
sections = <List<SettingsListItem>>[],
|
||||
currentVersion = '' {
|
||||
PackageInfo.fromPlatform().then(
|
||||
(PackageInfo packageInfo) => currentVersion = packageInfo.version);
|
||||
|
@ -97,171 +83,30 @@ abstract class SettingsViewModelBase with Store {
|
|||
// createNewYatUrl += '?sub1=' + createNewYatUrlParameters;
|
||||
//}
|
||||
|
||||
|
||||
sections = [
|
||||
[
|
||||
SwitcherListItem(
|
||||
title: S.current.settings_display_balance,
|
||||
value: () => balanceDisplayMode == BalanceDisplayMode.displayableBalance,
|
||||
onValueChange: (_, bool value) {
|
||||
if (value) {
|
||||
_settingsStore.balanceDisplayMode = BalanceDisplayMode.displayableBalance;
|
||||
} else {
|
||||
_settingsStore.balanceDisplayMode = BalanceDisplayMode.hiddenBalance;
|
||||
}
|
||||
},
|
||||
),
|
||||
if (!isHaven)
|
||||
PickerListItem(
|
||||
title: S.current.settings_currency,
|
||||
searchHintText: S.current.search_currency,
|
||||
items: FiatCurrency.all,
|
||||
selectedItem: () => fiatCurrency,
|
||||
onItemSelected: (FiatCurrency currency) =>
|
||||
setFiatCurrency(currency),
|
||||
images: FiatCurrency.all.map(
|
||||
(e) => Image.asset("assets/images/flags/${e.countryCode}.png"))
|
||||
.toList(),
|
||||
isGridView: true,
|
||||
matchingCriteria: (FiatCurrency currency, String searchText) {
|
||||
return currency.title.toLowerCase().contains(searchText) || currency.fullName.toLowerCase().contains(searchText);
|
||||
},
|
||||
),
|
||||
PickerListItem(
|
||||
title: S.current.settings_fee_priority,
|
||||
items: priorityForWalletType(wallet.type),
|
||||
displayItem: (dynamic priority) {
|
||||
final _priority = priority as TransactionPriority;
|
||||
|
||||
if (wallet.type == WalletType.bitcoin
|
||||
|| wallet.type == WalletType.litecoin) {
|
||||
final rate = bitcoin!.getFeeRate(wallet, _priority);
|
||||
return bitcoin!.bitcoinTransactionPriorityWithLabel(_priority, rate);
|
||||
}
|
||||
|
||||
return priority.toString();
|
||||
},
|
||||
selectedItem: () => transactionPriority,
|
||||
onItemSelected: (TransactionPriority priority) =>
|
||||
_settingsStore.priority[wallet.type] = priority),
|
||||
SwitcherListItem(
|
||||
title: S.current.settings_save_recipient_address,
|
||||
value: () => shouldSaveRecipientAddress,
|
||||
onValueChange: (_, bool value) =>
|
||||
setShouldSaveRecipientAddress(value))
|
||||
],
|
||||
[
|
||||
RegularListItem(
|
||||
title: S.current.settings_change_pin,
|
||||
handler: (BuildContext context) {
|
||||
Navigator.of(context).pushNamed(Routes.auth, arguments:
|
||||
(bool isAuthenticatedSuccessfully, AuthPageState auth) {
|
||||
auth.close(
|
||||
route: isAuthenticatedSuccessfully ? Routes.setupPin : null,
|
||||
arguments: (PinCodeState<PinCodeWidget> setupPinContext,
|
||||
String _) {
|
||||
setupPinContext.close();
|
||||
},
|
||||
);
|
||||
});
|
||||
}),
|
||||
PickerListItem(
|
||||
title: S.current.settings_change_language,
|
||||
searchHintText: S.current.search_language,
|
||||
items: LanguageService.list.keys.toList(),
|
||||
displayItem: (dynamic code) {
|
||||
return LanguageService.list[code] ?? '';
|
||||
},
|
||||
selectedItem: () => _settingsStore.languageCode,
|
||||
onItemSelected: (String code) {
|
||||
_settingsStore.languageCode = code;
|
||||
},
|
||||
images: LanguageService.list.keys.map(
|
||||
(e) => Image.asset("assets/images/flags/${LanguageService.localeCountryCode[e]}.png"))
|
||||
.toList(),
|
||||
matchingCriteria: (String code, String searchText) {
|
||||
return LanguageService.list[code]?.toLowerCase().contains(searchText) ?? false;
|
||||
},
|
||||
),
|
||||
SwitcherListItem(
|
||||
title: S.current.settings_allow_biometrical_authentication,
|
||||
value: () => allowBiometricalAuthentication,
|
||||
onValueChange: (BuildContext context, bool value) {
|
||||
if (value) {
|
||||
Navigator.of(context).pushNamed(Routes.auth, arguments:
|
||||
(bool isAuthenticatedSuccessfully,
|
||||
AuthPageState auth) async {
|
||||
if (isAuthenticatedSuccessfully) {
|
||||
if (await _biometricAuth.canCheckBiometrics() &&
|
||||
await _biometricAuth.isAuthenticated()) {
|
||||
setAllowBiometricalAuthentication(
|
||||
isAuthenticatedSuccessfully);
|
||||
}
|
||||
} else {
|
||||
setAllowBiometricalAuthentication(
|
||||
isAuthenticatedSuccessfully);
|
||||
}
|
||||
|
||||
auth.close();
|
||||
});
|
||||
} else {
|
||||
setAllowBiometricalAuthentication(value);
|
||||
}
|
||||
}),
|
||||
ChoicesListItem(
|
||||
title: S.current.color_theme,
|
||||
items: ThemeList.all,
|
||||
selectedItem: theme,
|
||||
onItemSelected: (ThemeBase theme) => _settingsStore.currentTheme = theme,
|
||||
),
|
||||
],
|
||||
//[
|
||||
//if (_yatStore.emoji.isNotEmpty) ...[
|
||||
// LinkListItem(
|
||||
// title: S.current.manage_yats,
|
||||
// link: manageYatUrl,
|
||||
// linkTitle: ''),
|
||||
//] else ...[
|
||||
//LinkListItem(
|
||||
// title: S.current.connect_yats,
|
||||
// link: connectYatUrl,
|
||||
// linkTitle: ''),
|
||||
//LinkListItem(
|
||||
// title: 'Create new Yats',
|
||||
// link: createNewYatUrl,
|
||||
// linkTitle: '')
|
||||
//]
|
||||
//],
|
||||
[
|
||||
RegularListItem(
|
||||
title: S.current.settings_terms_and_conditions,
|
||||
handler: (BuildContext context) =>
|
||||
Navigator.of(context).pushNamed(Routes.readDisclaimer),
|
||||
)
|
||||
],
|
||||
[VersionListItem(title: currentVersion)]
|
||||
];
|
||||
}
|
||||
|
||||
@observable
|
||||
String currentVersion;
|
||||
|
||||
@computed
|
||||
Node get node => _settingsStore.getCurrentNode(_walletType);
|
||||
Node get node => _settingsStore.getCurrentNode(walletType);
|
||||
|
||||
@computed
|
||||
FiatCurrency get fiatCurrency => _settingsStore.fiatCurrency;
|
||||
|
||||
@computed
|
||||
String get languageCode => _settingsStore.languageCode;
|
||||
|
||||
@computed
|
||||
ObservableList<ActionListDisplayMode> get actionlistDisplayMode =>
|
||||
_settingsStore.actionlistDisplayMode;
|
||||
|
||||
@computed
|
||||
TransactionPriority get transactionPriority {
|
||||
final priority = _settingsStore.priority[_walletType];
|
||||
final priority = _settingsStore.priority[walletType];
|
||||
|
||||
if (priority == null) {
|
||||
throw Exception('Unexpected type ${_walletType.toString()}');
|
||||
throw Exception('Unexpected type ${walletType.toString()}');
|
||||
}
|
||||
|
||||
return priority;
|
||||
|
@ -285,11 +130,12 @@ abstract class SettingsViewModelBase with Store {
|
|||
bool get isBitcoinBuyEnabled => _settingsStore.isBitcoinBuyEnabled;
|
||||
|
||||
final Map<String, String> itemHeaders;
|
||||
List<List<SettingsListItem>> sections;
|
||||
final SettingsStore _settingsStore;
|
||||
final YatStore _yatStore;
|
||||
final WalletType _walletType;
|
||||
final WalletType walletType;
|
||||
final BiometricAuth _biometricAuth;
|
||||
final WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
|
||||
TransactionInfo> _wallet;
|
||||
|
||||
@action
|
||||
void setBalanceDisplayMode(BalanceDisplayMode value) =>
|
||||
|
@ -333,4 +179,35 @@ abstract class SettingsViewModelBase with Store {
|
|||
|
||||
@action
|
||||
void _showTrades() => actionlistDisplayMode.add(ActionListDisplayMode.trades);
|
||||
|
||||
@action
|
||||
Future<bool> biometricAuthenticated()async{
|
||||
return await _biometricAuth.canCheckBiometrics() && await _biometricAuth.isAuthenticated();
|
||||
}
|
||||
|
||||
@action
|
||||
void onLanguageSelected (String code) {
|
||||
_settingsStore.languageCode = code;
|
||||
}
|
||||
|
||||
@action
|
||||
void setTheme(ThemeBase newTheme){
|
||||
_settingsStore.currentTheme = newTheme;
|
||||
}
|
||||
|
||||
String getDisplayPriority(TransactionPriority priority) {
|
||||
final _priority = priority;
|
||||
|
||||
if (_wallet.type == WalletType.bitcoin
|
||||
|| _wallet.type == WalletType.litecoin) {
|
||||
final rate = bitcoin!.getFeeRate(_wallet, _priority);
|
||||
return bitcoin!.bitcoinTransactionPriorityWithLabel(_priority, rate);
|
||||
}
|
||||
|
||||
return priority.toString();
|
||||
}
|
||||
|
||||
void onDisplayPrioritySelected(TransactionPriority priority) =>
|
||||
_settingsStore.priority[_wallet.type] = priority;
|
||||
|
||||
}
|
||||
|
|
|
@ -651,5 +651,9 @@
|
|||
"ignor": "Ignorieren",
|
||||
"use_suggested": "Vorgeschlagen verwenden",
|
||||
"do_not_share_warning_text" : "Teilen Sie diese nicht mit anderen, einschließlich des Supports.\n\nSie werden Ihr Geld stehlen!",
|
||||
"help": "hilfe"
|
||||
"help": "hilfe",
|
||||
"privacy_settings": "Datenschutzeinstellungen",
|
||||
"privacy": "Datenschutz",
|
||||
"display_settings": "Anzeigeeinstellungen",
|
||||
"other_settings": "Andere Einstellungen"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,12 @@
|
|||
"ignor": "Ignore",
|
||||
"use_suggested": "Use Suggested",
|
||||
"do_not_share_warning_text" : "Do not share these with anyone else, including support.\n\nThey will steal your money!",
|
||||
"help": "help"
|
||||
"help": "help",
|
||||
"connection_sync": "Connection and sync",
|
||||
"security_and_backup": "Security and backup",
|
||||
"create_backup": "Create backup",
|
||||
"privacy_settings": "Privacy settings",
|
||||
"privacy": "Privacy",
|
||||
"display_settings": "Display settings",
|
||||
"other_settings": "Other settings"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,9 @@
|
|||
"ignor": "Pasar por alto",
|
||||
"use_suggested": "Usar sugerido",
|
||||
"do_not_share_warning_text" : "No comparta estos con nadie más, incluido el soporte.\n\n¡Te robarán tu dinero!",
|
||||
"help": "ayuda"
|
||||
"help": "ayuda",
|
||||
"privacy_settings": "Configuración de privacidad",
|
||||
"privacy": "Privacidad",
|
||||
"display_settings": "Configuración de pantalla",
|
||||
"other_settings": "Otras configuraciones"
|
||||
}
|
||||
|
|
|
@ -649,5 +649,9 @@
|
|||
"ignor": "Ignorer",
|
||||
"use_suggested": "Utilisation suggérée",
|
||||
"do_not_share_warning_text" : "Ne les partagez avec personne d'autre, y compris avec l'assistance.\n\nIls vont voler votre argent!",
|
||||
"help": "aider"
|
||||
"help": "aider",
|
||||
"privacy_settings": "Paramètres de confidentialité",
|
||||
"privacy": "Confidentialité",
|
||||
"display_settings": "Paramètres d'affichage",
|
||||
"other_settings": "Autres paramètres"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,9 @@
|
|||
"ignor": "नज़रअंदाज़ करना",
|
||||
"use_suggested": "सुझाए गए का प्रयोग करें",
|
||||
"do_not_share_warning_text" : "इन्हें समर्थन सहित किसी और के साथ साझा न करें।\n\nवे आपका पैसा चुरा लेंगे!",
|
||||
"help": "मदद करना"
|
||||
"help": "मदद करना",
|
||||
"privacy_settings": "गोपनीयता सेटिंग्स",
|
||||
"privacy": "गोपनीयता",
|
||||
"display_settings": "प्रदर्शन सेटिंग्स",
|
||||
"other_settings": "अन्य सेटिंग्स"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,9 @@
|
|||
"ignor": "Zanemariti",
|
||||
"use_suggested": "Koristite predloženo",
|
||||
"do_not_share_warning_text" : "Nemojte ih dijeliti ni s kim, uključujući podršku.\n\nUkrast će vam novac!",
|
||||
"help": "pomozite"
|
||||
"help": "pomozite",
|
||||
"privacy_settings": "Postavke privatnosti",
|
||||
"privacy": "Privatnost",
|
||||
"display_settings": "Postavke zaslona",
|
||||
"other_settings": "Ostale postavke"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,9 @@
|
|||
"ignor": "Ignorare",
|
||||
"use_suggested": "Usa suggerito",
|
||||
"do_not_share_warning_text" : "Non condividerli con nessun altro, incluso il supporto.\n\nTi ruberanno i soldi!",
|
||||
"help": "aiuto"
|
||||
"help": "aiuto",
|
||||
"privacy_settings": "Impostazioni privacy",
|
||||
"privacy": "Privacy",
|
||||
"display_settings": "Impostazioni di visualizzazione",
|
||||
"other_settings": "Altre impostazioni"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,9 @@
|
|||
"ignor": "無視",
|
||||
"use_suggested": "推奨を使用",
|
||||
"do_not_share_warning_text" : "サポートを含め、これらを他の誰とも共有しないでください。\n\n彼らはあなたのお金を盗みます!",
|
||||
"help": "ヘルプ"
|
||||
"help": "ヘルプ",
|
||||
"privacy_settings": "プライバシー設定",
|
||||
"privacy": "プライバシー",
|
||||
"display_settings": "表示設定",
|
||||
"other_settings": "その他の設定"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,9 @@
|
|||
"ignor": "무시하다",
|
||||
"use_suggested": "추천 사용",
|
||||
"do_not_share_warning_text" : "지원을 포함하여 다른 사람과 이러한 정보를 공유하지 마십시오.\n\n그들은 당신의 돈을 훔칠 것입니다!",
|
||||
"help": "돕다"
|
||||
"help": "돕다",
|
||||
"privacy_settings": "개인정보 설정",
|
||||
"privacy": "프라이버시",
|
||||
"display_settings": "디스플레이 설정",
|
||||
"other_settings": "기타 설정"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,9 @@
|
|||
"ignor": "Negeren",
|
||||
"use_suggested": "Gebruik aanbevolen",
|
||||
"do_not_share_warning_text" : "Deel deze met niemand anders, ook niet met support.\n\nZe zullen je geld stelen!",
|
||||
"help": "helpen"
|
||||
"help": "helpen",
|
||||
"privacy_settings": "Privacy-instellingen",
|
||||
"privacy": "Privacy",
|
||||
"display_settings": "Weergave-instellingen",
|
||||
"other_settings": "Andere instellingen"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,9 @@
|
|||
"ignor": "Ignorować",
|
||||
"use_suggested": "Użyj sugerowane",
|
||||
"do_not_share_warning_text" : "Nie udostępniaj ich nikomu innemu, w tym wsparcia.\n\nUkradną twoje pieniądze!",
|
||||
"help": "pomoc"
|
||||
"help": "pomoc",
|
||||
"privacy_settings": "Ustawienia prywatności",
|
||||
"privacy": "Prywatność",
|
||||
"display_settings": "Ustawienia wyświetlania",
|
||||
"other_settings": "Inne ustawienia"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,9 @@
|
|||
"ignor": "Ignorar",
|
||||
"use_suggested": "Uso sugerido",
|
||||
"do_not_share_warning_text" : "Não os compartilhe com mais ninguém, incluindo suporte.\n\nEles vão roubar seu dinheiro!",
|
||||
"help": "ajuda"
|
||||
"help": "ajuda",
|
||||
"privacy_settings": "Configurações de privacidade",
|
||||
"privacy": "Privacidade",
|
||||
"display_settings": "Configurações de exibição",
|
||||
"other_settings": "Outras configurações"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,9 @@
|
|||
"ignor": "Игнорировать",
|
||||
"use_suggested": "Использовать предложенный",
|
||||
"do_not_share_warning_text" : "Не делитесь ими с кем-либо еще, в том числе со службой поддержки.\n\nОни украдут ваши деньги!",
|
||||
"help": "помощь"
|
||||
"help": "помощь",
|
||||
"privacy_settings": "Настройки конфиденциальности",
|
||||
"privacy": "Конфиденциальность",
|
||||
"display_settings": "Настройки отображения",
|
||||
"other_settings": "Другие настройки"
|
||||
}
|
||||
|
|
|
@ -650,5 +650,10 @@
|
|||
"ignor": "Ігнорувати",
|
||||
"use_suggested": "Використати запропоноване",
|
||||
"do_not_share_warning_text" : "Не повідомляйте їх нікому, включно зі службою підтримки.\n\nВони вкрадуть ваші гроші!",
|
||||
"help": "допомога"
|
||||
"help": "допомога",
|
||||
"privacy_settings": "Налаштування конфіденційності",
|
||||
"privacy": "Конфіденційність",
|
||||
"display_settings": "Налаштування дисплея",
|
||||
"other_settings": "Інші налаштування"
|
||||
|
||||
}
|
||||
|
|
|
@ -649,5 +649,9 @@
|
|||
"ignor": "忽视",
|
||||
"use_suggested": "使用建议",
|
||||
"do_not_share_warning_text" : "不要與其他任何人分享這些內容,包括支持。\n\n他們會偷你的錢!",
|
||||
"help": "帮助"
|
||||
"help": "帮助",
|
||||
"privacy_settings": "隐私设置",
|
||||
"privacy":"隐私",
|
||||
"display_settings": "显示设置",
|
||||
"other_settings": "其他设置"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue