Skip to content

Commit 17077cc

Browse files
committed
option to set restore/scan height for epiccash and a hacked in rescan
1 parent 39612d0 commit 17077cc

File tree

6 files changed

+273
-28
lines changed

6 files changed

+273
-28
lines changed

lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ class _WalletNetworkSettingsViewState
154154
// pop rescanning dialog
155155
Navigator.of(context, rootNavigator: isDesktop).pop();
156156

157+
final String message;
158+
if (wallet is CryptonoteWallet || wallet is EpiccashWallet) {
159+
message = "Rescan started";
160+
} else {
161+
message = "Rescan completed";
162+
}
163+
157164
// show success
158165
await showDialog<dynamic>(
159166
context: context,
@@ -164,7 +171,7 @@ class _WalletNetworkSettingsViewState
164171
builder: (child) =>
165172
DesktopDialog(maxHeight: 150, maxWidth: 500, child: child),
166173
child: StackDialog(
167-
title: "Rescan completed",
174+
title: message,
168175
rightButton: TextButton(
169176
style: Theme.of(context)
170177
.extension<StackColors>()!
@@ -380,11 +387,8 @@ class _WalletNetworkSettingsViewState
380387
),
381388
title: Text("Network", style: STextStyles.navBarTitle(context)),
382389
actions: [
383-
if (ref.watch(pWalletCoin(widget.walletId)) is! Epiccash &&
384-
ref.watch(pWalletCoin(widget.walletId))
385-
is! Mimblewimblecoin ||
386-
ref.watch(pWalletCoin(widget.walletId))
387-
is! Mimblewimblecoin)
390+
if (ref.watch(pWalletCoin(widget.walletId))
391+
is! Mimblewimblecoin)
388392
Padding(
389393
padding: const EdgeInsets.only(
390394
top: 10,
@@ -984,7 +988,6 @@ class _WalletNetworkSettingsViewState
984988
),
985989
),
986990
if (isDesktop &&
987-
ref.watch(pWalletCoin(widget.walletId)) is! Epiccash &&
988991
ref.watch(pWalletCoin(widget.walletId)) is! Mimblewimblecoin)
989992
RoundedWhiteContainer(
990993
borderColor: isDesktop

lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/edit_refresh_height_view.dart

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import '../../../../utilities/constants.dart';
1111
import '../../../../utilities/text_styles.dart';
1212
import '../../../../utilities/util.dart';
1313
import '../../../../wallets/isar/providers/wallet_info_provider.dart';
14+
import '../../../../wallets/wallet/impl/epiccash_wallet.dart';
1415
import '../../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
16+
import '../../../../wallets/wallet/supporting/epiccash_wallet_info_extension.dart';
1517
import '../../../../widgets/background.dart';
1618
import '../../../../widgets/conditional_parent.dart';
1719
import '../../../../widgets/custom_buttons/app_bar_icon_button.dart';
@@ -48,13 +50,19 @@ class _EditRefreshHeightViewState extends ConsumerState<EditRefreshHeightView> {
4850
try {
4951
final newHeight = int.tryParse(_controller.text);
5052
if (newHeight != null && newHeight >= 0) {
51-
await ref
52-
.read(pWalletInfo(widget.walletId))
53-
.updateRestoreHeight(
54-
newRestoreHeight: newHeight,
55-
isar: ref.read(mainDBProvider).isar,
56-
);
5753
final wallet = ref.read(pWallets).getWallet(widget.walletId);
54+
55+
if (wallet is EpiccashWallet) {
56+
await wallet.updateRestoreHeight(newHeight);
57+
} else {
58+
await ref
59+
.read(pWalletInfo(widget.walletId))
60+
.updateRestoreHeight(
61+
newRestoreHeight: newHeight,
62+
isar: ref.read(mainDBProvider).isar,
63+
);
64+
}
65+
5866
if (wallet is CryptonoteWallet && wallet.wallet != null) {
5967
wallet.setRefreshFromBlockHeight(newHeight);
6068
}
@@ -95,7 +103,13 @@ class _EditRefreshHeightViewState extends ConsumerState<EditRefreshHeightView> {
95103
super.initState();
96104
_controller = TextEditingController();
97105
final wallet = ref.read(pWallets).getWallet(widget.walletId);
98-
if (wallet is CryptonoteWallet && wallet.wallet != null) {
106+
if (wallet is EpiccashWallet) {
107+
_controller.text = ref
108+
.read(pWalletInfo(widget.walletId))
109+
.epicData!
110+
.restoreHeight
111+
.toString();
112+
} else if (wallet is CryptonoteWallet && wallet.wallet != null) {
99113
_controller.text = wallet.getRefreshFromBlockHeight().toString();
100114
} else {
101115
_controller.text = ref

lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/wallet_settings_wallet_settings_view.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import '../../../../utilities/text_styles.dart';
2323
import '../../../../wallets/isar/models/wallet_info.dart';
2424
import '../../../../wallets/isar/providers/wallet_info_provider.dart';
2525
import '../../../../wallets/wallet/impl/bitcoin_wallet.dart';
26+
import '../../../../wallets/wallet/impl/epiccash_wallet.dart';
2627
import '../../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
2728
import '../../../../wallets/wallet/wallet_mixin_interfaces/multi_address_interface.dart';
2829
import '../../../../wallets/wallet/wallet_mixin_interfaces/mweb_interface.dart';
@@ -591,8 +592,9 @@ class _WalletSettingsWalletSettingsViewState
591592
),
592593
),
593594
),
594-
if (wallet is CryptonoteWallet) const SizedBox(height: 8),
595-
if (wallet is CryptonoteWallet)
595+
if (wallet is CryptonoteWallet || wallet is EpiccashWallet)
596+
const SizedBox(height: 8),
597+
if (wallet is CryptonoteWallet || wallet is EpiccashWallet)
596598
RoundedWhiteContainer(
597599
padding: const EdgeInsets.all(0),
598600
child: RawMaterialButton(

lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_options_button.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import '../../../../utilities/util.dart';
3131
import '../../../../wallets/crypto_currency/intermediate/frost_currency.dart';
3232
import '../../../../wallets/crypto_currency/intermediate/nano_currency.dart';
3333
import '../../../../wallets/isar/providers/wallet_info_provider.dart';
34+
import '../../../../wallets/wallet/impl/epiccash_wallet.dart';
3435
import '../../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
3536
import '../../../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
3637
import '../../../../wallets/wallet/wallet_mixin_interfaces/spark_interface.dart';
@@ -478,8 +479,9 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
478479
),
479480
),
480481
),
481-
if (isCN) const SizedBox(height: 8),
482-
if (isCN)
482+
if (isCN || wallet is EpiccashWallet)
483+
const SizedBox(height: 8),
484+
if (isCN || wallet is EpiccashWallet)
483485
TransparentButton(
484486
onPressed: onRefreshHeightPressed,
485487
child: Padding(

0 commit comments

Comments
 (0)